How To Make Touch Not Hold?
I'm kind of stumped on this at the moment. My game involves taping the correct button that corresponds to what it being shown, then the one shown changes. However if someone holds the button down, if the next one would be incorrect it treats it like you got it wrong. Does this make sense? I'm not really sure how to word it, but anyway. This is how it works at the moment:
I have an integer attribute "attack" which when the button is pressed changes that attribute to 1,2,or 3 depending on which button it was. The 'enemy' actor (The thing that you have to choose the correct button to defeat) is destroyed if attribute "attack"
is correct, depending on what the enemy actor is, then once destroyed it spawns another one which could be different and would need a different button to be pressed.
The problem is if you hold the button down for to long, and the next enemy would be incorrect, you lose a life. I need a way so that holding the button down doesn't do anything to the next enemy, only the first one.
I hope you can understand what my problem is here, and how to help. Any help on this would be greatly appreciated.
Thanks
Best Answer
-
Armelline Posts: 5,369
Have distinct "touch is pressed" and "touch is released" rules. In the "touch is pressed" rule, work out if a life is to be taken away. In the "touch is released" rule, do the triggering of the destroy and selection of the next enemy to spawn.
Assuming you mean something like the attached?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Answers
Edit: programming below is incorrect - amendments explained later in this thread.
Hi @Mattcus Off the top of my head, try something like:
a Boolean attribute, let's call it SelectGo
Just after your Touch Rule in each button, add
Change Attribute SelectGo to true
Now the other behaviours take outside of this touch rule in each case, in its own Rule:
and add in each button:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks for the reply, however that doesn't seem to work. It still does the same thing it did before.
OK, mine was an educated guess without seeing any actual programming, obviously didn't work out in this case: personally the only way I'll be able to help now, is if I saw your programming where you've identified your problem. (Or even your full game file).
Or hopefully someone else can help you.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Ok, After a bit of messing around I've gotten it to work now. I used Armelline's suggestion to have it trigger after the button is released, not pressed. I don't why I didn't think of it before, because it seems so obvious now. Thanks for the help guys.
Glad it worked out, @Mattcus, with the suggestion from @Armelline.
For the record for other users who might have a similar problem, my solution does work - I've used that little "system" quite a few times in the past; it's quite "watertight". (So I don't know why it didn't work for you in your case).
So if anyone else wanted the "reactions" to still happen on touch pressed, the way I showed is one way to avoid repeated actions if that's happening but you don't want that:
i.e the touch pressed making a boolean set to to true; then a separate rule: when the boolean is true, do your thing, and that'll work once only as required.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
@Mattcus
Hang on, I see where I've gone wrong!!! I forgot to mention You'll need a separate boolean for each button.... darn, drat & poodles.... sorry..... (now I know why it didn't work for you...)
So I'll amend above to SelectGo1; make new booleans SelectGo2, SelectGo3, etc., for each of the other buttons, it'll definitely work then...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps