Why isnt this working?

Subscribe to Why isnt this working? 12 posts

avatar for Conundrum Conundrum 56 posts
Flag Post

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

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

 
avatar for Phoenix00017 Phoenix00017 7375 posts
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?

 
avatar for Conundrum Conundrum 56 posts
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.

 
avatar for yrudoy yrudoy 341 posts
Flag Post

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

My hint, try using this._play()

 
avatar for Conundrum Conundrum 56 posts
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?

 
avatar for Josh1billion Josh1billion 530 posts
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…

 
avatar for Phoenix00017 Phoenix00017 7375 posts
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.

 
avatar for pel6413 pel6413 74 posts
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)

 
avatar for Mitijea Mitijea 70 posts
Flag Post

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

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

 
avatar for Conundrum Conundrum 56 posts
Flag Post

You, sir, brilliant. thank you.

 
avatar for Mitijea Mitijea 70 posts
Flag Post

You’re welcome.

 
avatar for yrudoy yrudoy 341 posts
Flag Post

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