Quick question about toggle buttons

0 favourites
From the Asset Store
A challenging game that needs quick responses!
  • so i set everything up as far as i knew how to, then i got a syntax error right here

    Edit: don't use that operator for multiple cases.... you can see why.

    How is that easier than "Set self.my_state to (self.my_state + 1) % 3"?

  • i have that for the setting the state. Im talking about setting the text, the screenshot is for the text portion

  • Have an array with the state names, and index into it with self.state

    then just Set text to array.At( self.state)

    But to answer your question:

    self.difficultyprint & ( (self.difficultystate = 0) ? self.difficultyeasy : ( (self.difficultystate = 1) ? self.difficultynormal : self.difficultyhard))

    That's off the top of my head, untested!

  • do you just use events to set the values of the array?

  • do you just use events to set the values of the array?

    For just a few, sure. Or load from JSON file.

  • alright. i did that, then debugged the layout and realized it isn't even toggling the state of my instance variables haha

  • i really appreciate all your help. im sure im being difficult XD

  • im thinking im just going to revisit this aspect at a later time..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another great way to fill an array is with the CSV2Array plugin..

    You can write the csv in excell or libre/open-office and add it to the project-files..

    It really helps me to visualize the array..

  • i looked into that but since i only have three values that i need for this particular array i didnt think i really needed to go that far. all i need is

    (0, 0, 0): Easy

    (1, 0, 0): Normal

    (2, 0, 0): Hard

    Then i need one custom sprite button that starts on "Difficulty: Easy"

    click once: "Difficulty: Normal"

    click again: "Difficulty: Hard"

    click one more time: "Difficulty: Easy"

    and it loops that way.

    pretty much the exact same system that Minecraft uses excluding a "peaceful" mode.

    Im not entirely familiar with the rules here at the scirra forums but i dont suppose I can request that someone makes an example .capx (compatible with r173 and no external plugins) that has this system setup for me so i can transfer it to mine. As long as its not imposing and they have the time? as simple as possible yet still able to be customized and configured to adapt to another scenario if i run into this problem in the future.

    thanks in advance and thanks for the help from everyone so far.

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