Question and Help

Hello to the GS community !

I have on simple question, first:
Can we select an image (ex: on the image2.png of the animation if I press a key...) from an animation ?

Currently I have created a timer that changes image every 0.5 seconds, i don't know how to loop this timer animation,if I don't touch or press any key.

For example, this is what i want :

I have an animation of three images (actually i do it with a timer but i can't loop it), on the two first images, if i touch or press key, it's playing animation 1.
On the third image if i touch or press key, it's playing animation 2.

I read on the forum, to use something like a integer 0 or 1 maybe it would be good.

What's the best way to do that ?

Thx



Comments

  • allc1865allc1865 Member, PRO Posts: 777
    Do you want your character to be animated?
  • allc1865allc1865 Member, PRO Posts: 777
    There's a loop checkbox on the animate behavior.
  • vectorlexipvectorlexip Member Posts: 3
    Yes, i know,
    but i want to have an action (ex : change image or animation) if i touch or press a key on a particular image of the animation
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2013

    Hi @vectorlexip You're thread title: "Question and Help"… you don't say! 99.9% of threads started contain a question and the poster requires help… see what I mean? Best to make your thread titles more descriptive in future, relevant to your question… you've a better chance of answers anyhow.

    To interrupt an animation using the Animate behaviour is doable, but not replace one of the images in the behaviour during runtime. So the only way I can think of doing this is to have your animation loops as Change Image behaviour sequences with timers and booleans, and that way you can include "When" rules for each frame, to change it accordingly with relevant key presses. Sounds like it could become quite complex though…

    P.S Welcome to the Forums. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • vectorlexipvectorlexip Member Posts: 3
    Hello and Thx for your answer,

    I understand your proposal, actuallly i have just three images, that why i think about a timer to play each image.
    I try to use a behavior like 0 or 1 (integer) to have a rule if you touch or press keys on the image2.pgn it will play animation1 and if i touch or press a key on image3.png an other animation'll play. If i don't touch the "timer animation" runs

    Thank you for your welcome ;)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2013

    Thanks for more info, OK, with only 3 images looping, it definitely would be fine with Change Image behaviours then… So try something like:

    ---in your 3-image actor----MainLoop either starts as 1 or change attribute to 1 in a go button or similar----

    When Attribute MainLoop is 1
    Change Image your image 1
    When touch is pressed or key A is down
    Change Attribute Animate to 1
    Change Attribute Mainloop to 0
    Otherwise
    Timer: After 1 second
    Change Attribute MainLoop to 2

    When Attribute MainLoop is 2
    Change Image your image 2
    When touch is pressed or key B is down
    Change Attribute Animate to 2
    Change Attribute Mainloop to 0
    Otherwise
    Timer: After 1 second
    Change Attribute MainLoop to 3

    When Attribute MainLoop is 3
    Change Image your image 3
    When touch is pressed or key C is down
    Change Attribute Animate to 3
    Change Attribute Mainloop to 0
    Otherwise
    Timer: After 1 second
    Change Attribute MainLoop to 1

    -------
    ---and in your animation actor:
    Rule: when Animate = 1
    Animate your animation sequence 1

    Rule: when Animate = 2
    Animate your animation sequence 2

    Rule: when Animate = 3
    Animate your animation sequence 3

    totally untested but it's in the right ballpark. Hope it helps.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • vectorlexipvectorlexip Member Posts: 3
    i tried and it's work !!! Thank you !
Sign In or Register to comment.