If then else Support

Get help using Construct 2

Post » Thu Jun 20, 2013 3:16 pm

Hey all,

In some ways, I find the GUI system in Construct 2 extremely taxing - I want to make a simple trigger:
User is touching Button(x),
set value of y to (x)
Then:
all the other actions I want


Instead, I'm only finding a way to make 3 separate events,
"If user is touching Button 1, then set value to 1
If user is touching Button 2, then set value to 2
If user is touching Button 3, then set value to 3

Then (separate trigger?!)
User touches Button 1
User touches Button 2
User touches Button 3

Actions:
All my actions"

Is there anyway we can just... code? If I use Java, can I still export the code into an iOS app? I think we should have a lot more options for the conditions- we should be able to say "Generic sprite selected" and save values to the Dictionary by the name of the sprite, or, at the very least, be able to carry out multiple actions based on the condition of the sprite being interacted with. I looked at Ashley's if then else guide, but it didn't help or work when I tried to implement it.

Thanks a lot!
-John
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 3:20 pm

I'm not trying to be like this, but how come there isn't a "Run this trigger" option? How come we can't name triggers?
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 3:30 pm

"My God, this guy is still posting?!"

Is there a way to disable and enable triggers? For example, if I wanted to ask a person if they are SURE they want to buy something, and I have a "Yes" button, is there a way to start out with all of the triggers responding to a "Yes" button click disabled, and then when the time comes, enable one of them to respond to the action appropriately? So if one of my questions is "Do you wanna see a movie?" and the next is "do you think I'm good looking?" is there a way to have the same button respond differently?
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 3:52 pm

There are ways to do everything you have described in this thread, but you need to understand; This is not programming in a traditional sense. Though if you understand how to use C2, your programming skills will come in very handy.

On to the questions: Setting a value depending on which button is pressed is pretty simple. Many ways to do it, but I would recommend using an instance variable:

ButtonsSimple.capx (r134)

As for your other questions, I'm unsure what you mean by "trigger", a button, an action, an event, a condition? All these could be described as triggers, but I haven't used that term, so I'm unsure what you mean by it. And in the last post there's too much back and forth in your explanation, I have no idea what you're looking for.

By the way, have you read the Beginner's Guide? Even if you don't feel like a beginner because of your programming experience, it's important to understand how C2 operates. You can do almost anything in C2, but the approach is often different compared to programming from scratch.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jun 20, 2013 4:17 pm

Hi Nimtrix,

Thanks for responding, I haven't bought Construct 2 yet, so I have the r132 version. I know how to use variables, I'll try to be more clear.


I'm wondering if I can combine the events to
"Generic sprite is touched"
If sprite = Button(x) then set variable =(x)
Actions
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 4:18 pm

Also the background moving thing... I'll figure that out... that's definitely not right the way it is though
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 4:22 pm

You can use beta versions without buying a license, however I'm afraid you'll need a license to use families, which is what you'll need to do the "Generic sprite touched" thing. Add all objects to a family, then make an event based off that family.

As a workaround to families, you can use one object with different animations (if they are not animated you can simply use frames in the same animation). This way you can make events for the object, then separate them based off which animation/frame they have.

Edit: I recommend downloading release 134 (even if you don't care about the capx I posted), apparently 135 has some issues with alt+tabbing. To save time looking for the release page, click the link in my signature.Nimtrix2013-06-20 16:25:37
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jun 20, 2013 4:34 pm

Hahaha wow! That makes a lot more sense... Thanks for the link to r134, I couldn't find it anywhere. I'm pretty excited to be able to use object families, after fiddling with the program forever... As you can see, I have been messing around with animations/setting animation speeds to 0.

Thanks again
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Post » Thu Jun 20, 2013 4:55 pm

No problem.

It's a common problem people not finding the beta releases, hence my signature, used to be worse before the site re-design.

Anyway, did you sort out all your problems? I'd be happy to help if there's anything else.Nimtrix2013-06-20 16:55:32
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jun 20, 2013 6:30 pm

Here's my new code... pretty pumped about it



Basically, every time one of the buttons is clicked it becomes highlighted, and the other ones appear to deselect. I still haven't found a way to select every button that's NOT selected, but shouldn't be too hard to figure out. The real version of Construct 2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> free
B
9
S
2
G
2
Posts: 47
Reputation: 1,822

Next

Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS and 2 guests