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

2016/2/18

Making Objects Fall Slower(Gravity)

jmeinicole jmeinicole

2016/2/18

#
hey guys Do you know how to get objects to fall slower (like from the to of the world)?
danpost danpost

2016/2/19

#
jmeinicole wrote...
hey guys Do you know how to get objects to fall slower (like from the to of the world)?
I think you need to be a little more specific as to how these objects should fall. Option one: they could move at a steady, slow pace (like floating down); or they could move slowly, at first, and increase speed as they fall (actually simulating gravity). Option two: they could move at simple rates of one, two, three pixels per move; or, they could appear to move at simple slower rates of one-half, one-third, or one-quarter pixels per move; or they could be made to appear to move at pretty much any in-between rate of speeds as well. You should choose one of each option and let us know what you are hoping to accomplish so we do not have to guess at it.
jmeinicole jmeinicole

2016/2/21

#
I would like the objects to move at a steady, slow pace (like floating down).
Super_Hippo Super_Hippo

2016/2/21

#
Like that?
setLocation(getX(), getY()+1);
jmeinicole jmeinicole

2016/2/21

#
Yes, I want them to fall like that but slower.
danpost danpost

2016/2/21

#
You could slow down the scenario speed and make other moving actors move at a faster pace to compensate. However, there are better ways to accomplish what you want to do. It is not clear how to deal with it as it depends on exactly what speed or speeds you require for the actor. If you only need it to move like once in so many act cycles, it would be just a matter of adding a counter. If you require fractional speeds requiring more than a one in the numerator, then you will need two instance fields -- one for a more exact y-coordinate for the actor and the other for the speed.
You need to login to post a reply.