This project has moved. For the latest updates, please go here.

Simulating a Hill in top-down view

Topics: Developer Forum, User Forum
Feb 24, 2011 at 8:51 PM


I am making a game which involves a ball rolling around on the screen. The view is top down.


I would like the ball to speed up when it rolls down a "hill" and slow down when it rolls up a "hill." The hills ofcourse will just be different textures, as the view is top down so there is no height.


I have successfully done the down hill by using the OnCollision event and returning false, and multiplying the LinearVelocity by some factor every time OnCollision is fired (and it continues to fire as long as ball is on hill).

This does not work on the uphill though, instead of multiplying I divided. This eventually just makes the ball stop on the hill. I would like it to roll back down.


Any ideas how to accomplish this?



Feb 25, 2011 at 5:48 AM

You could probably use the GravityController to simulate this.  Maybe use a negative force for a hill and a positive force for a dip.

Feb 25, 2011 at 7:06 AM

Yes, I agree, and only activate the gravity controller when the player is on the hill.

Feb 25, 2011 at 6:54 PM



Thanks so much