Setting local boolean variables

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I intend to use (local) boolean variables to keep some intermediate results from a number of calculations, but can't find how to set the value of the local variables that I want to use. I can't use System->Set value, since the boolean local variables aren't shown in the variable drop down list. I can't use System->Set boolean either, since then I am ony allowed to choose between True and False and can't enter an expression which is what I want.

    How should I do this? Most likely I am missing something simple!

  • Hi. At the risk of being wrong in your case; I was also struggling with this the other day. In my case, the local variable was a property of an object and therefore within an event I had to add Action>Pick Object>toggle Boolean>select instance variable from list

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • MikaelS

    That sounds about right. Cant set them to an expression in the current version of c3.

    That hit me too.

    Got to couple them to a condition.

    Condition ... testing an expression

    _____ set boolean


    ______unset boolean.

    Got to be careful with the logical part of that condition. The 'else' runs only if its parent did not run. (is false)

    Those conditions that start with 'Is ....' are conditions that return a 'false/true' as result.

    The conditions that pick return a 'false/true' if the picklist is empty.

    Those that start with 'On ....' have no 'else', they are triggers.

    Whats left, is those that start with 'Compare .....'.

    You can compare in two ways.

    Say ...

    Regular way. Comparing two expressions that hold a value (Sprite.x ... 5000 .. pi ... sin(90) ...etc)


    Using logical expressions.

    Value one = Sprite.x > 50 & Sprite.x < 200

    Value two = 1

    Construct takes '0' as false when using logical expressions. And '1' as true.

    You can also use logical expressions like this.

    Sprite.X = 1? 1 : 0

    Returns 1 if Sprite.X = 1 else 0.

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