FORUMS: list search recent posts

How To Program A "Bounce Back" Movement?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ariel Mizrahi
How To Program A "Bounce Back" Movement?
on Feb 13, 2008 at 3:53:38 am

I'm programming a game on flash, its a ping pong game, of course I'm using action script to program it...

I have a ping pong table and a ball, with action script I programed the ball to automatically start moving to the right side on my screen when entering that specific frame using this command:

"this.ball_mc.onEnterFrame = function() {
this._x++;
};"

this.ball_mc (is the instance of my ball, which is obviously a movie clip) on enter frame (is the command that will be executed "when entering that specific frame") and then the function without conditionals (leaving the parenthesis in blank) and then inside the keys "{}" I introduced the function

this. (refering to the ball, because we are still inside of the instance) and then the funcion "_x++" which means to start moving positively (++) in the x part of my scene (x = horizontal).

But, my real question is:

How to do (the ball) to bounce back when it reaches the maximum of the horizontal side (when it reaches the maximum it disappears), I want the ball, instead of disappearing to bounce back when it reaches for example x 700.

Does anyone know how to program that move (function)?

Any help will be really appreciated,

THANKS!!!,

Ariel


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]