Rolling a ball?

Talk about making games.

Rolling a ball?

Postby zicho » Sun Nov 05, 2006 1:01 pm

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?
zicho
 
Posts: 2
Joined: Sun Nov 05, 2006 12:56 pm
Score: 0 Give a positive score

Postby Novice » Sun Nov 05, 2006 1:46 pm

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.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby zicho » Sun Nov 05, 2006 2:04 pm

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?
zicho
 
Posts: 2
Joined: Sun Nov 05, 2006 12:56 pm
Score: 0 Give a positive score

Postby Novice » Sun Nov 05, 2006 2:54 pm

Use physical response. Do a forum search or look at a tutorial.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest