[MX04]Code not firing when comparing two _x positions
Hi,
Just for a bit of practice i have developed this simple game where you dynamically add sections of track to a movie & then get a ball to move down them.
It all works great, but I was having a bit of a problem getting the ball to move along the center of a track when it went from say a straight to a vertical piece of track, as I was using hitTest to detect a collision & that was firing when the ball hit the edge of a track & not the center causing the ball to run along the outside of the track.
To get round this I used this simple piece of code:
code:
if (holdNum == 2) {
trace(xFactor);
if (_root.ballOne._x>=xFactor) {
xSpeed = 0;
ySpeed = -2;
}
Which basically tests the tracks _x position against that of the ball & acts accordingly. "holdNum" tells Flash what type of section it is eg. straight or vertical - problem is that it does not fire?
Anyone any ideas
Thank you
fla attached