dumb question #34

eboyeboy Member Posts: 239
edited November -1 in Working with GS (Mac)
I want to create a button that when pressed, activates an animation but when released the animation actor goes away/ I was trying to figure it out but nothing I did worked...could someone help out this stupnaggle.

Comments

  • butterbeanbutterbean Member Posts: 4,315
    This is off the top of my head, there could be a better way:

    Create global game attribute: Game.buttonpressed

    Create a rule within the button actor that you're pushing

    Rule: When touch is pressed:

    change attribute: game.buttonispressed to true

    Rule: When touch is released:

    change attribute: game.buttoninspressed to false

    Within the actor you want animated do this:

    Rule: When game.buttonispressed is true

    Animate: "whatever you want animated"

    In the animation piece: (what it is you're adding to the actor or animating)

    The best way you could do this is make the "animation" a separate actor and destroy it after a few seconds that way when you push the button again, it will activate the animation as new

    Hope this helps!
  • synthesissynthesis Member Posts: 1,693
    That is a dumb question!!! (just kidding)
    Have 2 rules
    Rule 1:
    when touch is pressed
    animate...

    Rule 2:
    when touch is released:
    changeImage to.... (if you want no image...use a blank/transparent png file...if you want the actor still present in the scene...and this will get rid of the animation to relieve a little processor strain)

    AND

    change self.alpha to 0
    change self.position.Y to 800 (or some location out of the screen)
    The alpha setting will make it invisible and Y position adjustment will move it out of sight so you can't press it again. Then you can move it back later if needed.

    Or you can destroy it if you never will need it again in the scene.
Sign In or Register to comment.