This site requires JavaScript, please enable it in your browser!
Greenfoot back
Possiblydominator
Possiblydominator wrote ...

2012/6/30

My character is ignoring platforms

Possiblydominator Possiblydominator

2012/6/30

#
Hi I'm working on a platformer to try to learn some stuff about greenfoot. I have jump, run, and gravity all set up, but an odd little bug is that my character can jump straight through the bottom of the platforms. I want to know how to stop this from happening. If anyone can help, it would be appreciated.
danpost danpost

2012/7/1

#
One way to stop it from doing so, it to break each movement into individual steps. That is, if your actor is moving 5 pixels per frame, then move it 5 times, moving one pixel at a time and checking for intersecting obstacles each time. If an obstacle becomes present, just move back that last step (1 pixel). Check out my Barriers and Bars Demo for an example.
You need to login to post a reply.