One button with 2 diff. conditions, and actions

Get help using Construct 2

Post » Mon Dec 30, 2013 2:25 pm

Hi all!

I'm new here and I would like to ask your help!
I started a project (a multiplatform game for mobiles and for tablets), and I got the following problem. What I want to do in my game is that after I touch the 'button' sprite the other sprite will be spwaned on the screen and a variable value will be changed to 1, and after a second touch on the same button, the other spite will will disapears and the variable change back to 0. I will use this to a character hold a weapon sprite (spawn into his hands) and change the variable value to 1 from 0, and with the same button I (when variable is 1) can delete the weapon from his hands. The problem is that I won't work if I made 2 event for the same button and adding into them another extra condition ( so 1 event is "if you touch the button and the variable is 0 then..." the orher one is when you touch the same button just the variable will be 1)

I made a simple capx to represent this. You can dl it form:
dropbox.com/s/nmmx5madjwfnbqm/touch_test.capx

For this I have a global variable, default value is 0. I have 2 objects (a red and a yellow square, and I destroy the red one on start of layout). Normaly, I think this event sheet will makes what I want, but when you run it then it seems to me both of the touch events have run down, and ignores the conditions with the variable value..
Note that, if you disable the destroy action then it works well (ofc exept the destroy), the variable will change. And if you disable the action wich sets the variable to 0 then the destroy action works..

I'm confused about why only one action can run down in this way. Hope you can help..

Thanks in advance!
peterm
B
3
Posts: 2
Reputation: 179

Post » Mon Dec 30, 2013 2:49 pm

here is one way to do this

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Mon Dec 30, 2013 2:51 pm

never noticed the wait 0 you had in - probably not needed ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Mon Dec 30, 2013 3:07 pm

Thanks RamPackWobble! It works, even without the wait 0.

Cheers!
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: dop2000, jorgmaquoi, luckyrawatlucky, Rable, senecaa and 14 guests