Touch event kept in memory?

Coda24Coda24 Member Posts: 4
edited November -1 in Working with GS (Mac)
OK... moving this to Forum as suggested by a user.

So I’m running into an issue that I can’t resolve. Maybe someone can help.
1) I created two actors

2) Actor “A” – When you Touch Press this actor, it changes an Attribute called “myPush” from 0 to 5 (I use Display text to show this number)and when you “Touch Release” it, it changes the attribute to 9.

3) Actor B has a similar function. Touch Press changes Attribute called “mySecondPush” from 0 to 15 and Touch Release changes it to 45 (I also use Display Text to show this number)

4) Actor B has a rule though, that it’s only “active” as long as myPush = 9. That means that you have to Touch and Release Actor A, before Actor B does anything.
Everything works fine if I first press Actor “A” then Actor “B”… Actor “A” shows 5 then 9 (as I release), and Actor “B” now shows 15 then 45 when I release…..

NOW HERE IS MY ISSUE:

If I first press Actor B, nothing happens (as it should). But when I
then press Actor A, the text on Actor B suddenly changes to “45”??? It’s as if the game is storing the touch event and waiting to execute when the “A” rule is met.

That doesn’t seem right to me. The touch event should not be held in memory, and if it is, then how do I clear it?

Comments

  • aarioaario Member, PRO Posts: 256
    try adding touch inside to the rules on both actors A an B
  • okkleokkle Member Posts: 32
    I had the same problem, although changing touch to 'inside' was unreliable as it worked for one actor, setting off events as soon as touched, but for the other actor with exactly the same conditions it decided it needed to be held to carry out the full actions. No idea why, I asked here and got no answer, I assume it's a glitch. But I have a way around if you have the same issue:

    Use the 'released' touch command and set up a boolean attribute for when each actor is pressed, so 'actorApressed' and 'actorBpressed'.

    Make the corresponding actors turn that attribute to true when they are released and false otherwise. Then tell the actors that when the opposing attribute is true to destroy itself.

    So in actorA:
    `When touch is released - change attribute game.actorApressed = true, Otherwise game.actorApressed = false`
    &
    `When game.actorBpressed = true - destroy self.`
    And vice versa.

    Now when you press one, the other will cease to exist.

    Then add a command so after 0.1 seconds the actor you just released re-spawns the actor that just deleted itself.

    This seems to wipe any commands kept in memory and has worked well for me.
  • Coda24Coda24 Member Posts: 4
    thanks okkle.... I'll give that a try. The way it's working now, doesn't make to me, but it is what it is.
Sign In or Register to comment.