Page 1 of 1

Rolling a ball?

PostPosted: Sun Nov 05, 2006 1:01 pm
by zicho
Hello. I am new to this scene of developing Games in Game Editor, although I have experience with the software Games Factory. Since I am running Linux on my machine, Games Factory isn't an option since it doesn't work, so im trying to get the hang of Game Editor, but I have encountered an issue;

I want to have a ball (from a top view), that rolls when you press up, and when you let go it speeds down little by little until it stops. It should be the same in every direction (left right down up). Can someone help me with this, if it's even possible?

PostPosted: Sun Nov 05, 2006 1:46 pm
by Novice
On key down "Up":
Code: Select all
yvelocity-=0.5;

On key down "down"
Code: Select all
yvelocity+=0.5;

On key down "left":
Code: Select all
xvelocity-=0.5;

On key down "down"
Code: Select all
xvelocity+=0.5;

In draw actor
Code: Select all
yvelocity*=.95;
xvelocity*=.95;

Adjust "95" to change the slowdown rate.

PostPosted: Sun Nov 05, 2006 2:04 pm
by zicho
Thanks a bunch! And if you wanna make collisions, how do you make the ball bounce back at the same strength it had when it rolled into the obstacle?

PostPosted: Sun Nov 05, 2006 2:54 pm
by Novice
Use physical response. Do a forum search or look at a tutorial.