Howdy, Stranger!


Restore Actor Image Question


I have a character with a stock image and then several animations, e.g. moving right, and moving left. These are all done via a series of PNG Frames

I have a "wait" animation, that waits for 7 seconds of no input and then carries out a wait animation which can be interrupted if key input is detected

My problem is that, when I interrupt the wait animation with a movement animation, once the movement has completed it defaults to the last frame that the wait animation was at, rather than defaulting back to the stock image. (restore actor image when done)

Can I set the restore image? This would probably fix all my problems ;)


  • Two.ETwo.E Posts: 568Member, BASIC


    What you could do is add the image you want to be "Restored" to the end of your animation and then untick "Restore Image when complete".
    ie add the stock image to the end.

    This way your animation will end on your custom image. Just an idea.

  • aarondodd111aarondodd111 Posts: 3Member

    Thanks, I appreciate your response.

    The problem I have though, is that my movement is a set distance based on a length of time

    so when you press the right key once it will move right for say 2 seconds, and then if you hold the key for longer than the 2 second duration, it then loops creating a 2nd instance of the movement so even if you only held the right key for 3 seconds, it will move for the total of 4 seconds

    Which then means, I need my animation to loop and continue movement, without including that default image you're referring too.

    We're assuming in my case that we don't know how long we want the animation to run for, therefore I need to make a way to ensure it always defaults to an image of my choosing if the movement of 2 seconds has finished and there is no continuation of the key press.

  • Two.ETwo.E Posts: 568Member, BASIC

    Let's look like this. If an animation is going to restore it's last image (before animation starts) then here are two solutions:

    Have you tried changing the image to the Stock Image when the wait is interrupted with the behaviour placed above the animations behaviour.
    The walking animation will take affect straight afterwards, and the stock image will be regarded as the last image.

    Or, simply have rules that if Animation is finished (an no key input is detected) "Ie. Actors Image = "Run_End" then change image to Stock Image.

    If you work out the conditions that require an actor to be a Stock Image, but it into a rule. And have the rule change image.


  • aarondodd111aarondodd111 Posts: 3Member


    So I had thought that. BUT here's my second issue.

    As mentioned the character will walk for 2 seconds (animate for 2 seconds) regardless of whether the key is pressed or held.

    And so what happens is, if I pressed the key for say 0.5 seconds and the key comes up, the stock image rule kicks in for 1 frame so what you end up with is the actor animates for 0.5 seconds, flicks to the stock frame, and then continues the animation.

    It was definitely a step closer to what I wanted but I can see that frame still interrupts the animation.

    I might need to go back to the fundamentals here ;)

    My end goal is this in terms of movement

    So i want my actor to always walks X distance no matter on whether you hold or press the move key in series of X movements as mentioned

    so say x = movement+ 50 (assuming they're moving right in this case)

    then if you press the right key once it will move + 50
    if you hold the key your actor will move +50 x the amount of seconds you hold the key in 2 second increments (actor moves +25 per second)

    IF you let go of the key when your actor is only at +30 if their movement, they will still finish the full movement to satisfy x + 50

    The only way I thought I could achieve this in game salad is the following rule below, maybe there is an easier way, but the "move to" doesn't seem to work as expected.

    If right key press is down
    TIMER for 2 seconds
    Animation, loop YES, restore actor image YES

    Change Attribute (create real variable = moveDestinationX)
    SET self.moveDestinationX to self.position.x+50

    self.position.x to self.moveDestinationX for 2 seconds
    using linear function

    Is there not a rule to check if a key is simply pressed rather than held down? I think this might solve my problem.

  • Two.ETwo.E Posts: 568Member, BASIC

    I don't understand how the above solution doesn't solve your problem?

    As I mentioned earlier, you will need to check if the actor is displaying the last image in the animation of your walk including as empty key inputs. You will have to check the end image of all types of animations if need be.

    The image will only be changed once animation has ended and there is no key input.


Sign In or Register to comment.