Webcam pong

ok so i have made an pong game in flash. or im trying to xD.
but i need help on how to get the ball to move from on side to the other and if the paddle is in the way it bounces back can you help me??

the paddle moves up and down really fast, im calibrating it all the time to make it move smoothly and i cant upload the new version all the time . thats why the paddle is wierd in this swf file.

(when this is finished im gonna give you the code to it.)

if (goLeft){
ball._x–;
}else{
ball._x++;
}

if (goUp){
ball._y–;
}else{
ball._y++;
}

if (ball._x<ball._width/2)goLeft=false
if (ball._x>(Stage.Width-ball._width/2))goLeft=true
if (ball._y<ball._height/2)goUp=false
if (ball._y>(Stage.Width-ball._height/2))goUp=true

that’s bouncing

thanks :smiley:
a big hug to you (im a member in extreme tutorials forum and everytime someone helps me i give them a big hug (just so you know, i dont want you to think im crazy :D))

ok i think i got it no errors :smiley: but one prob x0 , the ball stands still in the middle :S

offtopic: i like your 3d engine :smiley:

  1. name the ball mc to ‘ball’
  2. if the code is not on the same level as the ball use path (like _root.ball instead of ball when ball is on the stage)
  3. make sure the code runs continously (like inside an event handler)

but how can i make the paddle hit it?? i have tried and failed :S

muhahaha you can never beat the computer in this game :smiley: cause the y value of the paddle2 is the same as the ball :smiley:

pong file updated got a ball and two paddles 1 for u 1 for comp.

You mean a webcam pong game like what grant skinner made huh?

http://incomplet.gskinner.com/index2.html#vidpong

FB

yea something like that but i have problems with the paddle it like lagging to the right spot.

if (ball._x<Number(leftpaddle._x+leftpaddle._width+ball._width/2)){
if (ball._y>Number(leftpaddle._y-ball._width/2) and ball._y<Number(leftpaddle._y+leftpaddle._height+ball._width/2)){
//hit
goLeft=false
}
}
if (ball._x<leftpaddle._x-ball._width-10){
//the ball is out
}

the code still needs some polishing tough

You can find a pong game and source here:
http://ffiles.com/view_listing.php?sid=237&cat=25
:hr:

Unfortunately I don’t have a web-cam to make the paddles move :frowning:

Thanks all :smiley: i dont think i need nor want any more help im gonna work on the pong game and we will see how good it gets :smiley: A big hug too all of you. the paddles doesnt jump to the right place anymore :smiley: they are much more smoothly now. when i get this working i have only 1 thing left to do. make the ball and paddles better xD they are ugly now.
and i need sound effects

but i cant find sound effects can someone show me a page where i can download free sound effects for games. (i have searched)

the canadian i have one problem :S i cant get the black out of your pong game