How do I use a boolean to inhibit an action?

From the Asset Store
11 loops of RPG, chiptune/8-bit music. Suitable for any pixel art game.
  • Hi all,

    I am trying to check whether a boolean is true each time the player presses Z and, if this boolean is true, and the player presses Z again, inhibit the function it calls from being called again.

    I have used booleans to inhibit actions before but for some reason in my current set up the boolean condition is being ignored and the function is still called.

    Here is a screenshot of my configuration:

    Why is the boolean condition being ignored?

  • Do you have 2 instances of player ? If not then the boolean must be true...you can check in debug mode.

  • I only have one instance of player.

    I have checked in debug mode and it is set to true but is set to false while the player is using the "hoe" tool.

    Even though it is set to false, I can still Press Z and call the "Hoe" function, despite the boolean condition not being met. So weird! Is this a bug?

  • There will be a reason for it, if you can share the file it will be easy to work out what has gone wrong.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'll have to explain what you want to happen? The events are different to what you shared before and you have it set to call the function in any of the directions.

  • sorry for the delay.

    Essentially I'm trying to inhibit the movement and other actions (such as changing the character animation) when the "NotUsingTool" is false.

  • Under the movement logic you need to add conditions to the key presses for the global variable, this will stop the ability to move when that variable is false. In the same way that you added it to the Z key press, you need it on the movement key presses.

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