having a problem with if statement

  • hiya,

    okay heres the deal i am trying to set up a toggle for music and some other options and the only way i can figure out how to do this is to set up flag variables which set the option to on or off

    <img src="http://i251.photobucket.com/albums/gg290/theshack98/example.png" border="0" />

    but when i do this it just seems to culminate in another layer of music on top of the existing layer/s of music. It seems to discount the fact that the variable music has been changed.

  • Create a local variable under event 2 (name "hasChanged" for example, number)

    Event 3 add an action set hasChanged to 1

    Event 4 and 5 add a condition "hasChanged = 1"

    Event 4 and 5 add an action "hasChanged = 0"

    It will allow to prevent the "automatic switching" since it will execute event 5 only if "hasChanged = 1", that is to say that music = 0 AND event4 wasn't executed yet, since hasChanged is still = 1

  • thanks for the response i am a bit of a noob at this and i am trying to understand what you are saying here. Now so you are saying create another test variable which i use in conjunction with my global variable music?

  • Yes that's it exactly.

  • okie dokie so this is what i have, must be close eh? sorry bout this but am still trying to learn this structure, it doesn't seem to want to behave like a simple if..then..else sort of scenario

    <img src="http://i251.photobucket.com/albums/gg290/theshack98/example2.png" border="0" />

  • lol okay i've fixed the problem, thanks for your help!

  • morpheous,

    what was the fix? so we don't have to chase the oracle down for the answer.

  • This manual article is useful in solving the current situation.

    To correct morpheous' last screenshot :

    Event4 and 5 must be mixed into a single event of 2 conditions.

    Same for 6 and 7.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yep sure thing, here it is

    <img src="http://i251.photobucket.com/albums/gg290/theshack98/example3.png" border="0" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)