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

2015/5/15

Need some help with character moving

ac130kire ac130kire

2015/5/15

#
Basically I have all the movement stuff, but I want some extra things such as gravity. The MAIN thing is that I want to be able to move my character along a surface by seeing the background color it is standing on or via some other method. Also how would I toggle a new level/scenario. If someone could tell me where to find this or give a sample I will really appreciate it. You are awesome! So something like the character will only move left, right and jump when on black and on blue it will only be able to move left and right. Also when on Red it will proceed to the next level. Background:
danpost danpost

2015/5/15

#
Gravity is just a continuous adding to the vertical velocity. That is, represent the vertical speed of your character with a field (instance variable) and add a constant (gravity) to it every act cycle (continuous adding). Do not forget to use the field when moving the actor vertically. Using the background color would be very tedious -- especially since there are already methods available in the Actor class to check for intersection with other objects. Create Actor subclasses for the objects that represent Ground or Platform (black); also, do the same for the Gate or Door (red)
You need to login to post a reply.