If then else Support

0 favourites
  • 10 posts
From the Asset Store
Comprehensive localization solution for Construct 3 projects, no addons required!
  • 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

  • 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?

  • "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?

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

    <img src="http://i39.tinypic.com/2jam835.jpg" border="0" />

    I'm wondering if I can combine the events to

    "Generic sprite is touched"

    If sprite = Button(x) then set variable =(x)

    Actions

  • Also the background moving thing... I'll figure that out... that's definitely not right the way it is though

  • 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.

  • 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

  • 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. <img src="smileys/smiley36.gif" border="0" align="middle" />

    Anyway, did you sort out all your problems? I'd be happy to help if there's anything else.

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

    <img src="http://i42.tinypic.com/sfiayu.jpg" border="0" />

    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

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