# Webcam pong

**URL:** <https://forum.kirupa.com/t/webcam-pong/185570>\
**Category:** flash\
**Created:** [April 14, 2006, 10:09am UTC](https://forum.kirupa.com/t/webcam-pong/185570 "2006-04-14T10:09:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamZZ](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AdamZZ](https://forum.kirupa.com/u/AdamZZ)\
**Post date:** [April 14, 2006, 10:09am UTC](https://forum.kirupa.com/t/webcam-pong/185570/1 "2006-04-14T10:09:15Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![sed\_thh](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@sed\_thh](https://forum.kirupa.com/u/sed_thh)\
**Post date:** [April 14, 2006, 10:13am UTC](https://forum.kirupa.com/t/webcam-pong/185570/2 "2006-04-14T10:13:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AdamZZ](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AdamZZ](https://forum.kirupa.com/u/AdamZZ)\
**Post date:** [April 14, 2006, 10:28am UTC](https://forum.kirupa.com/t/webcam-pong/185570/3 "2006-04-14T10:28:05Z")

</div>

thanks 😃  
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 😃 but one prob x0 , the ball stands still in the middle :S

offtopic: i like your 3d engine 😃

---

<div class="post-metadata">

**Author:** ![sed\_thh](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@sed\_thh](https://forum.kirupa.com/u/sed_thh)\
**Post date:** [April 14, 2006, 1:09pm UTC](https://forum.kirupa.com/t/webcam-pong/185570/4 "2006-04-14T13:09:03Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![AdamZZ](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AdamZZ](https://forum.kirupa.com/u/AdamZZ)\
**Post date:** [April 14, 2006, 2:11pm UTC](https://forum.kirupa.com/t/webcam-pong/185570/5 "2006-04-14T14:11:40Z")

</div>

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 😃 cause the y value of the paddle2 is the same as the ball 😃

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

---

<div class="post-metadata">

**Author:** ![frankiebones](https://avatars.discourse-cdn.com/v4/letter/f/3bc359/32.png) [@frankiebones](https://forum.kirupa.com/u/frankiebones)\
**Post date:** [April 14, 2006, 3:25pm UTC](https://forum.kirupa.com/t/webcam-pong/185570/6 "2006-04-14T15:25:09Z")

</div>

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

[http://incomplet.gskinner.com/index2.html#vidpong](http://incomplet.gskinner.com/index2.html#vidpong)

FB

---

<div class="post-metadata">

**Author:** ![AdamZZ](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AdamZZ](https://forum.kirupa.com/u/AdamZZ)\
**Post date:** [April 14, 2006, 8:43pm UTC](https://forum.kirupa.com/t/webcam-pong/185570/7 "2006-04-14T20:43:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sed\_thh](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@sed\_thh](https://forum.kirupa.com/u/sed_thh)\
**Post date:** [April 15, 2006, 9:08am UTC](https://forum.kirupa.com/t/webcam-pong/185570/8 "2006-04-15T09:08:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 15, 2006, 9:13am UTC](https://forum.kirupa.com/t/webcam-pong/185570/9 "2006-04-15T09:13:26Z")

</div>

You can find a pong game and source here:  
[http://ffiles.com/view\_listing.php?sid=237&cat=25](http://ffiles.com/view_listing.php?sid=237&cat=25)  
:hr:

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

---

<div class="post-metadata">

**Author:** ![AdamZZ](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AdamZZ](https://forum.kirupa.com/u/AdamZZ)\
**Post date:** [April 15, 2006, 10:04am UTC](https://forum.kirupa.com/t/webcam-pong/185570/10 "2006-04-15T10:04:02Z")

</div>

Thanks all 😃 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 😃 A big hug too all of you. the paddles doesnt jump to the right place anymore 😃 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
