Skip to main content
Known Participant
October 2, 2009
Answered

Need help with end menu script

  • October 2, 2009
  • 1 reply
  • 430 views

I'm making game, where i must collect points. In end menu screen, i want that if my score's over 200, a next level button will be visible.

Now it's visible every time when timer's out

I have tried this code

if (score < 200){

  this.visible == false;

}

else

if (score >=200){

  this.visible == false;

}

This topic has been closed for replies.
Correct answer Ned Murphy

1) the conditionals would have no choice but to make this invisible due to you having all possible values of score turning this invisible (one of them oughta be "true")

2) the _visible property has an underscore preceding it

3) to assign a value to something you need to use =     To compare things for equality you use ==

4) are you sure "this" is what you intend to target?  I cannot tell from the code due to not knowing what timeline it occupies, but "this" represents the timeline that the code is in... so you made need to use the button's instance name instead since buttons do not normally have a timeline that you can put code like that in...

if (score < 200){

  this._visible = false;

}

else if (score >=200){

  this._visible = true;

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
October 2, 2009

1) the conditionals would have no choice but to make this invisible due to you having all possible values of score turning this invisible (one of them oughta be "true")

2) the _visible property has an underscore preceding it

3) to assign a value to something you need to use =     To compare things for equality you use ==

4) are you sure "this" is what you intend to target?  I cannot tell from the code due to not knowing what timeline it occupies, but "this" represents the timeline that the code is in... so you made need to use the button's instance name instead since buttons do not normally have a timeline that you can put code like that in...

if (score < 200){

  this._visible = false;

}

else if (score >=200){

  this._visible = true;

}

ShootiryAuthor
Known Participant
October 2, 2009

Thanks!

Ned Murphy
Legend
October 2, 2009

You're welcome