Why isnt this working?

12 posts

Flag Post

Simple Code, that for some reason isnt doing its job.

if (_root.lives<0){
play()
}

 
Flag Post

You’re going to have to give me some more context. What is it doing? How is it messing up? Is there any error message? What is lives set to?

 
Flag Post

At the begging lives is set to 3 and goes down each time the ball leaves the screen. I have a counter of this so I know for sure lives are going down. I want it so that when the lives go below zero, it goes to the next frame, which would be the gameover screen.

When doing this it just simply ignores the ‘play’ code. If i put in a random boolean it sets it off, but anything else is simply ignored.

 
Flag Post

Where is this code? In aa function, in a moveie clip, etc?

My hint, try using this._play()

 
Flag Post

Its in a movieclip under the enterFrame onClipEvent.

So what would I put in front of the ._play if I just wanted to go to the next frame?

 
Flag Post

Looks like you need a > instead of a <.

‘Cause you’re at “if lives is LESS THAN zero, play the game through”

EDIT: Oh didn’t read that reply. Hmm…

 
Flag Post

Well, you might want to consider using gotoAndPlay(“frame_label”). Otherwise, it might just be playing the current frame, which likely has a stop command in it.

 
Flag Post

you might want to place a trace(“lives is less then 0”) inside the if statement or trace(_root.lives) before it, just to be on the safe side.
then try _root.play() (i assume you what the main time line to play)

 
Flag Post

Try this.nextFrame(); instead of this.play();

(or just nextFrame(); should work fine in your case.)

 
Flag Post

You, sir, brilliant. thank you.

 
Flag Post

You’re welcome.

 
Flag Post

I meant to put “this.play()” No underscore – sorry.