When touch is released -> Animate (then disable touch)

enginsoysalenginsoysal Member Posts: 4
edited November -1 in Working with GS (Mac)
Hi guys,

Im new at gamesalad and so far I like what I've seen.

I have a project going on wich does the following:

Actor receives event -> touch is released

Animate

(26 images that animate)

The problem is that after the touch has been released it should disable the touch so the user can't touch the actor while animating. At the moment when it's touched again while animating it starts back from the top. I need it to finish the animation without restarting.

Is there a way to do this?

Thanks,

Engin

Comments

  • CaniohCanioh Member Posts: 200
    Create a boolean attribute called "can touch" then put all the rules and behaviors that you mentioned into a new rule that says: When Attribute "Can Touch" is true: And then all your rules. And then in your release behavior say "change attribute" can touch to false. :D
  • enginsoysalenginsoysal Member Posts: 4
    Hi Canioh,

    Thanks for the quick reply.

    Unfortunately I can't seem to make it work. As I said I'm pretty new at gamesalad and have a lot to learn.

    The first thing is that I don't know where to create a new boolean calling it "canTouch".

    I tried at the scene but thought how can this effect the actor? So I created a new boolean on the actor calling it "canTouch".

    I created a new rule:

    attribute -> self.canTouch is True

    (then in the behaviours)
    Rule:
    Actor receives event -> touch is release

    Animate
    (and then the 26 images)

    On the preview it works. When i click on it it animates.

    Now I have to create a rule that states canTouch = false and this is where I get stuck.

    Adding a "Change Attribute" I get the Expression Editor and if I put in "false" or "1" or "0" it does nothing. It doesn't animate my actor anymore.

    I'm a little stuck here and some help would be appreciated.

    Thanks,

    Engin
  • enginsoysalenginsoysal Member Posts: 4
    Hi T-ShirtBooth,

    I see where you're going with this but this is not actually what I want.

    I have a ball rotating 180 degrees from its pivot point. When the ball is touched it animates it by rotating. But the downsize is that when it's animating you can touch it again and thus it stops the animation and starts all over.

    What I want is that the touch function should be disabled while the ball is rotating untill it's finished...

    Engin
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    what tshirt said is what you want to do i just think he might have messed the wording up

    self.can touch should be set to true

    have a rule when touch is pressed AND self.can touch is true
    in that rule put your animate behavior, and a change attribute behavior changing self.can touch to false
    then have a timer in that rule after(how many seconds your animation takes) with run to completion checked, and have a change attribute behavior in that timer changin self. can touch to true

    that will work since while the animation is taking place, can touch will be false so it wont re animate, and you can only re animate once the last once has finished

    cheers
  • enginsoysalenginsoysal Member Posts: 4
    Thanks guys... it worked ... (almost thought I was stupid for not getting it right away :( ... )

    Will post the game if it's finished :)...

    Engin
  • MotherHooseMotherHoose Member Posts: 2,456
    rather than a timer...to trigger for change in canTouch

    you could nest(add) a Rule under your animation...

    when self.Image = (last image in animation)
    changeAttribute game.canTouch To: true

    MH
Sign In or Register to comment.