PDA

View Full Version : [Beginner] Making an object move both directions in AS 3.0


lallous
11-19-2009, 06:01 PM
Hello everyone,

I'm facing an issue with my very simple Flash project. I have a wall which I want it to move forwards till it reaches an x position of 300 and then I want it to go back to 0. I want this to continue looping.

So far, I have made the wall move forwards to position 300 but when it tries to return it gets stuck because the forward variable is not switching to 0 in the else statement.

I have attached my project for clarification of what i stated above .
Please forgive the ugly graphics as I only wanted to test the idea :p.


Thank you,

lallous
11-20-2009, 06:06 AM
Nevermind guys, I was able to solve it. I was declaring a variable in the on_enter_frame function so it was always getting reset to the initial value.