Quick question about toggle buttons

Get help using Construct 2

Post » Thu Aug 14, 2014 2:56 am

discoverthecurse wrote:so i set everything up as far as i knew how to, then i got a syntax error right here

Image


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"?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Aug 14, 2014 2:40 pm

i have that for the setting the state. Im talking about setting the text, the screenshot is for the text portion
B
6
Posts: 30
Reputation: 292

Post » Thu Aug 14, 2014 11:28 pm

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!
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 15, 2014 2:40 pm

do you just use events to set the values of the array?
B
6
Posts: 30
Reputation: 292

Post » Fri Aug 15, 2014 2:42 pm

discoverthecurse wrote:do you just use events to set the values of the array?


For just a few, sure. Or load from JSON file.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 15, 2014 2:58 pm

alright. i did that, then debugged the layout and realized it isn't even toggling the state of my instance variables haha
B
6
Posts: 30
Reputation: 292

Post » Fri Aug 15, 2014 3:07 pm

i really appreciate all your help. im sure im being difficult XD
B
6
Posts: 30
Reputation: 292

Post » Fri Aug 15, 2014 3:14 pm

im thinking im just going to revisit this aspect at a later time..
B
6
Posts: 30
Reputation: 292

Post » Fri Aug 15, 2014 3:36 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Aug 15, 2014 4:17 pm

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.
B
6
Posts: 30
Reputation: 292

Previous

Return to How do I....?

Who is online

Users browsing this forum: blue visionary, namaewayukidesu and 10 guests