Once i saw a game that is kind of a endless runner with a box being the main character.
the box starts in the floor (make jumps, run, like any other of this style), but when touches, it glues on the top wall. If touch happen again, the box will go back to the floor.
How can i do that?
Only have the simple code:
local floor = display.newRect( display.contentWidth/2, 0, display.contentWidth, 40 ); physics.addBody( floor, "static"); local wallTop = display.newRect( display.contentWidth/2, display.contentHeight - 5, display.contentWidth, 40 ); physics.addBody( wallTop, "static"); local rect = display.newRect( display.contentCenterX, display.contentCenterY, 16, 16 ); rect.strokeWidth = 3 rect:setFillColor( 0.5 ) rect:setStrokeColor( 1, 0, 0 ); physics.addBody( rect, "dynamic", {bounce = 0, density = 1, friction = 0});
Do i use transition? what if the top wall is not always covering the entire top screen? and i have to know the exactly point to move the box?
Like random platform:
[ ] (blank) [ ]