Stack Traceback?

I am developing a flappy birds like game_

FOLLOWING this video at 6:36 mark. He is using rectangles (react) I am using a stall image, instead of tubes, my still image is an enemy the player has to avoid. In my code, you will see as “Yum Yum”

I prefer to not get the answer just thrown about, would rather prefer it came with an explanation exposing my mistake so I can attain the gem from the error:


I’ve attached images of the Stack Traceback error I am getting, line 21 - states it is calling a nil value. Nil meaning non existent to my understanding or mistyped from it’s source?

From what I see or can tell, all the code is existent and seems on the up and up. Something else I am not seeing.


It’s (CORNER) that is causing the issue, I remove it, game progresses, but then my asset moves towards flappy, when it should be, flappy towards the asset.

Will test further.


Line 21: rectMode(CORNER)

Initially, I placed it after my asset, thinking it was meant for the rectangles the instructor created as tubes. With that thought in mind, i told myself, well, your asset is the tube in our case, so place it after.

Turns out, rectMode is for something else, that is not the tubes, coming at the flappy. My other thought that lead to the error, was in thinking rectMode was associated with the tubes, because they are rectangles.

@tactfulgamer rectMode is for rectangles and since the tubes are rectangles, rectMode applies to them also. What rectMode actually does is define how rectangles are draw and usually gets set once in setup. There are 4 options for rectMode, CENTER, RADIUS, CORNER, CORNERS. More info on them can be found in the Codea Reference. Just a quick explanation, CENTER means all rectangles will be drawn centered on the x,y values. CORNER means all rectangles will be drawn with the lower left corner at the x,y values.

Thank you @dave1707