# My pong game

**URL:** <https://forum.kirupa.com/t/my-pong-game/200969>\
**Category:** flash\
**Created:** [September 17, 2006, 5:34am UTC](https://forum.kirupa.com/t/my-pong-game/200969 "2006-09-17T05:34:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PoisonedV](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@PoisonedV](https://forum.kirupa.com/u/PoisonedV)\
**Post date:** [September 17, 2006, 5:34am UTC](https://forum.kirupa.com/t/my-pong-game/200969/1 "2006-09-17T05:34:38Z")

</div>

I am working on a pong game. my code is this:

```auto

//first beta test
//hide mouse
function init(){
    Mouse.hide();
    
    //ball speed
    ball.dx = 15;
    ball.dy = 5;
} //end init

ball.move = function(){
    ball._x += ball.dx;
    ball._y += ball.dy;
} // end ball.move function

player.onEnterFrame = function(){
  //player paddle follows mouse’s y value
    player._y = _root._ymouse;
} // end enterFrame

ball.onEnterFrame = function() {
    ball.move();
    ball.checkBoundaries();
    ball.checkPaddles();
} //end enterframe

ball.checkBoundaries = function(){
  //bounce off top and bottom walls
  if (ball._y < 0){
    ball.dy = -ball.dy;
  } // end if

  if (ball._y > Stage.height){
    ball.dy = -ball.dy;
  } // end if

  //if past left of screen, opponent scores 
  //wrap for now
  if (ball._x < 0){
    trace("Opponent Scores");
    ball._x = Stage.width;
  } // end if

  //if past right of stage, player scores, 
  //bounce for now
  if (ball._x > Stage.width){
    trace ("Player scores");
    ball.dx = -ball.dx;
  } // end if
} // end checkboundaries

ball.checkPaddles = function(){
  //check to see if ball touches paddle
  if (ball.hitTest(player)){
    //simply bounce off for now
    ball.dx = -ball.dx;
  } // end if
} // end checkPaddles

```

but for some reason it doesnt move the ball!
