Corona SDK - Make a character pass through a platform
Posted
by
Andy Res
on Stack Overflow
See other posts from Stack Overflow
or by Andy Res
Published on 2012-10-13T17:53:17Z
Indexed on
2012/10/14
3:37 UTC
Read the original article
Hit count: 134
I'm building a game that has a character which should jump up on multiple platforms.
The jumping functionality is done, but I would like if the character is just below a platform (static body), when I press the "jump" button, the character should pass through that platform and then sit on it.
Right now it collides with the platform, and character cannot jump on it.
Do you have any idea how this can be achieved?
Right now the platforms are represented by rectangles with "static" body type:
local platform = display.newRect( 50, 280, 150, 10 )
platform:setFillColor ( 55, 55, 55)
physics.addBody ( platform, "static", {density=1.0, friction=1.0, bounce=0 })
And I was thinking if I could change, or remove the body type of platform when the character collids with it, so he can pass trough platform, but I don't know how to do this, or in general if this will work... maybe there are some built in techniques on how to achieve the effect I want?
© Stack Overflow or respective owner