Page 1 of 1

pong ball

PostPosted: Wed Apr 11, 2007 6:46 am
by SergeLo00001
so i decided to make a pong game, and got the paddles and all down, ecept now im stuck on th epart where i want space to make the ball move at a random direction at a certain speed from the center.
i dont even have an idea what i could do to make it move.
im really stuck :(
some one please help.

PostPosted: Wed Apr 11, 2007 12:07 pm
by pixelpoop
on the create actor event of the ball put this in the script editor

Code: Select all
angle=rand(360);
//creates a random angle to start

directional_velocity=2;
//change the 2 to whatever you want your initial velocity to be

PostPosted: Wed Apr 11, 2007 12:47 pm
by makslane

PostPosted: Wed Apr 11, 2007 7:15 pm
by SergeLo00001
o, thanks. thats simple enough.
i wqas makingit hard by trying to do it all in one code.
thanks. :D

I was thinking, once it picks an angle, the ball will be moving at that slope
for the whole game until it goes out.
So what is necesary for me to have is that one thing where if it hits on side of a paddle it will go that way, you know what i mean? like in blasterball.
Would that be hard to do?
it sounds hard :(

PostPosted: Wed Apr 11, 2007 7:30 pm
by SergeLo00001
maybe i need like the paddle to be 5 actors together?
_
|_|
|_|
|_|
|_|
|_|

if it hits the center one, it will go out at 0 degrees angle
one above center 30
top one, say 60
and so on fo the bottom ones.

Thats what im thinking of right now, dont even know if thats possible to do yet.
If you got a better idea please hit me up, appreciate ur help.

PostPosted: Wed Apr 11, 2007 7:31 pm
by makslane
Just use the Physical Response action in a Collision event.

PostPosted: Thu Apr 12, 2007 12:20 am
by Game A Gogo
or there could be this, not sure if it would work:
Code: Select all
angle=direction(x,y,Player.x,Player.y)+180;

I'm not even sure this would help you at all....

PostPosted: Thu Apr 12, 2007 5:55 am
by SergeLo00001
actually game_a_gogo, i thought about it, and at first it sounded right.
But say the ball comes in at a negetive slope, hits the bottom of the paddle, it would have to keep going in a negetive slope, instead the 180 degrees would make it go back up.
You know what i mean?

Im actually right now thinking of making the paddles round, and let phusical response do everything for me :wink:

PostPosted: Thu Apr 12, 2007 6:08 am
by SergeLo00001
i dunno how to make the ball bounce off the walls and paddle, i just had it but i dont know what i did. :(

k i have the same exact thing for two different walls, bounces off one, but no the other, just starts rubbing against it.

Also after bouncing off a wall the speed slows down, how do i prevent that?

One more thing. I push space to get the ball moving, how do i make it so i am only able to press it once to make it move per round i guess. Because right now i can keep pressing it and it changes direction.

PostPosted: Fri Apr 13, 2007 4:45 am
by Sgt. Sparky
for the space issue:
if(ball.directional_velocity == 0)execute_your_action_here;
for the physical responce issue:
specify the mass, put it to 0.000000000000001 for event actor,
set the final velocity multiplyer to 1 :D
I hope that helps. :)