pong ball

Talk about making games.

pong ball

Postby SergeLo00001 » Wed Apr 11, 2007 6:46 am

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.
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score

Postby pixelpoop » Wed Apr 11, 2007 12:07 pm

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
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Wed Apr 11, 2007 12:47 pm

makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby SergeLo00001 » Wed Apr 11, 2007 7:15 pm

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 :(
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score

Postby SergeLo00001 » Wed Apr 11, 2007 7:30 pm

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.
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score

Postby makslane » Wed Apr 11, 2007 7:31 pm

Just use the Physical Response action in a Collision event.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Game A Gogo » Thu Apr 12, 2007 12:20 am

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....
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby SergeLo00001 » Thu Apr 12, 2007 5:55 am

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:
Last edited by SergeLo00001 on Thu Apr 12, 2007 6:29 am, edited 3 times in total.
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score

Postby SergeLo00001 » Thu Apr 12, 2007 6:08 am

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.
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Fri Apr 13, 2007 4:45 am

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. :)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest