Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Stack Traceback?

edited March 7 in Questions Posts: 26

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:

Video:

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.

Comments

  • Posts: 26

    UPDATE:

    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.

  • Posts: 26

    SOLVED:

    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.

  • dave1707dave1707 Mod
    Posts: 7,558

    @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.

  • Posts: 26

    Thank you @dave1707

Sign In or Register to comment.