i am trying to get something to animate only when a ball is shot would i use a timer or attribute?

i'm working on my second game ever. And i am trying to get the plant as shown below to animate, but only when a ball is shot from it. how would i proceed to do that?

Best Answer

  • scuurproscuurpro Posts: 63
    edited May 2014 Accepted Answer

    I created a template for you because I screwed up explaining it to you

Answers

  • macman123macman123 Member Posts: 98

    this what i want it to do.

  • macman123macman123 Member Posts: 98

    for some reason thee picture is not posting sorry.

  • colandercolander Member Posts: 1,610

    You have to zip any files before uploading

  • macman123macman123 Member Posts: 98

    http://gsanimator.com/product/a-plant-animation/

    this is the link for the picture and how i wat it to animate

  • scuurproscuurpro Member, PRO Posts: 63
    edited May 2014

    Create a Boolean that says Animate Plant

    Than create two rules

    Rule 1
    The first rule is when Ball is shot
    change Attribute Animate Plant to true

    Rule 2
    The second Rule is When Animate Plant is true

    Animate Plant
    Than change Animate to False in this same Rule so that it doesn't keep animating.

  • macman123macman123 Member Posts: 98

    @colander‌ i was trying to send the link to the animated pic of what i wanted from a url. thanks though

  • macman123macman123 Member Posts: 98

    @scuurpro‌ thanks i'll try that.

  • colandercolander Member Posts: 1,610
    edited May 2014

    Use a game level boolean attribute and set it to true in the actor with the event that fires the ball. In you plant actor have a rule If boolean attribute = true run the animation once and reset the boolean attribute back to false.

  • macman123macman123 Member Posts: 98

    @scuurpro‌ so when ball is shot should the that be an attribute too?

  • macman123macman123 Member Posts: 98

    @colander‌ im not understanding that totally. do you want me to put the attribute in the plant?

  • macman123macman123 Member Posts: 98

    or have 2 attributes.

  • macman123macman123 Member Posts: 98

    oh ok thanks. where is it?

  • macman123macman123 Member Posts: 98

    oh i see it

  • macman123macman123 Member Posts: 98

    @scuurpro‌ thanks for the template. i understand now.

  • colandercolander Member Posts: 1,610

    A game level boolean attribute is just a switch to turn something on or off. You can also use an integer and use 0 as off and 1 as on. I prefer integers because later on I may want to change it and add more conditions i.e. 0 is off 1 do this 2 do that, etc.

    What actor triggers you plant actor to fire? Whatever it is lets say a button actor, put the attribute in a rule "When button is pressed" and change its value to true. Then in the Plant actor create a rule "Attribute game.bWhateverNameYouLike = true (Or 1 if you are using and integer)" run the animation and then reset your attribute back to false or 0.

  • macman123macman123 Member Posts: 98

    what triggers the plant is a timer cause i wanted him to shoot by himself at first but i changed my mind. so now its click.

Sign In or Register to comment.