dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: changing the speed of a ball

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    128
    This is the code I have:
    on Clipevent (load)

    if (this.hitTest(_root.gameboard.paddle)) {
    xspeed = -xspeed;
    pHit.start();
    }


    What I am trying to do is make the ball speed up everytime it hits the paddle. I would think using a set variable with xspeed=xspeed+(5) would work, but all it does is speed it up once. Any ideas? thanks,

    Andy

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    588
    xspeed = xspeed + 5

    will work. However, make sure that you use onClipEvent(enterFrame), not "load", because load executes once, while enterFrame executes with each frame that is drawn.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center