Flags

This forum is currently in read-only mode.
From the Asset Store
Flags
$5 USD
An educational memory game about countries’ names and their flags!
  • Is this a possibility for objects? It's kind of tiring always having to use variables when all you want to do is to just easily toggle between an 'on' and 'off' state for sprites etc.

  • Since Construct is a much more DIY game maker than most (well, some), then if this feature were to be implemented, you'd probably have to be setting up the flags yourself anyway, in the same sort of manner that variables are set up. It would be just as easy to set up a variable. And it would be just as easy to make a "set flag to off" action as it is to make a "set value to 0" action.

    And even if you were to have some flags set up for you automatically, what would be a good amount? Five? Ten? Who can say? There's really no good answer for something like that, everyone has different needs for their games. So the logical answer would be to not have any set up automatically, and have the user set up their own flags as needed. Which brings us back to point #1.

    I don't mean to be a naysayer, I'm just wondering what advantage flags would have over variables. A flag is pretty much just a binary variable anyway. Variables can do the same thing, but also much more. So I really can't see a reason why you would want to introduce a new feature that, in essence, is just a crippled version of a current feature.

  • Even though flags are not neccesary, they would play a big role in making code easier to understand. When I've flags achieved by conditions:

    ('myVal') is greater than 0

    ('myVal') is lower or equal 0

    Or:

    ('myVal') is equal to 1

    ('myVal') is equal to 0

    Or some other solutions... they all still look harded to see than "TRUE" and "FALSE". This is a big help in organizing your code. But I think that "Flags" are not of greatest importance at the moment.

  • Yep...

    I too, at the start was the same...

    but, well, there's no need for it, if you can make how many vars you whant...

    this is far away from making me to care about... but the worst for me without a doubt are those events to change anims... cus thei're not working too well... XD

  • I personally just use number variables for flags - 1 for on and 0 for off. I'm perfectly comfortable using it considering I'm from a programming background, but if you prefer, you could just as easily use text like "yes"/"no", "y"/"n", "on"/"off", "true"/"false" etc...

    If you use a number you can toggle it with 1 - value (1 - 1 = 0, 1 - 0 = 1), or with text you could still use: value = "yes" ? "no" : "yes"

  • Just to pitch in here:

    Personally I don't see flags as necessary; they'd need to be set up via properties anyways, so it's just some more clutter. Variables are the proper solution, just switch between 1 and 0 like Ashley said.

    One thing that could be done is boolean variables (using a combobox with On/Off or so in it), I'd imagine that'd be easy to add.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah thanks for clearing all this up guys

  • The one thing flags are easier for is that you can "toggle" them, but that could easily be achieved with a simple Else event.

  • I think true and false should be keywords in expressions.

    Set 'Myvalue' to true

    And it would be identical to

    Set 'Myvalue' to 1.

    only problem would be that true + true would equal 2 though

  • Agree with David, that's definitely sensible.

  • That would work, and you could also add that "toggle" would change 1 to 0 and vice versa.

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