Stopping a looped animation when timer attached to it stops

In my game the player has to complete a task in 30 seconds or else they lose. I have this egg timer actor, which shows them how much time they have left. The egg timer actor has animation (1second long) where the hand animates round 360degrees. It also displays the time left on top of it. Here are my rules:

Rule 1: if 'self.Timer ON' is true, then for 30 seconds loop this animation and return to initial image when done.

Rule 2: if 'self.Timer ON' is true, then every 1 second take away 1 from 'self.TIME' (integer attribute)

This works well, and I even have it so that after 30 seconds if the user didn't complete the task and the 'You Lose' message shows, the timer stops (same for 'You Win' message).

My problem here is, how do I get the animation to stop as well? I need the animation to stop in these instances:

Scenario 1: Time is up and player didn't complete task, so you get the 'You Lose' message. Stop timer, stop animation.

Scenario 2: Player completed task correctly within time, so you get the 'You Win' message. Stop timer, stop animation.

Scenario 3: Player didn't complete the task correctly within the time, so you the 'You Lose' message. Stop timer, stop animation.

I know in these instances, some people have said that you just put the stop animation clause in the 'else' part of my Rule 1. But I've tried that and I don't know what to put. I've done: if 'self.Timer ON' is false, then..........change image to frame 1 of animation??? That doesn't work, so if you have any ideas please let me know!

Many many many thanks in advance!

1LuVP4nc4k3S

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    You need to add another condition to the rule containing the animation that cuts it off once an answer is selected.
  • 1LuVP4nc4k3S1LuVP4nc4k3S Member Posts: 62
    Oops! Thanks @FryingBaconStudies for the response. I've actually figured it out! What you've said though, I think I may have incorporated too below...

    1. I made sure the first thing I stated was what happens when the timer isn't going:

    If 'self.Timer ON' is false, then constrain 'self.image' to (*a new actor I made which just has the first frame of the animation as its image). This means that the egg timer doesn't animate and just shows a still of the first frame when the timer isn't counting down.

    *I then needed to make sure that the else part of that rule was covered, so else...'self.Timer ON' is true

    2. I could then explain what then happens when 'self.Timer ON' is true (i.e. timer is counting down). As in make sure it animates self for 30 seconds.

    As for the win/lose messages:

    Scenario 1: If 'scene.time' is 30seconds, and 'self.Timer ON' is false, then show lose message

    Scenario 2: Because I take care of when the win message show elsewhere in the game, I just needed to make sure this actor understood what state it needed to be in when this win message showed, so: if win message is showing, then set 'self.Timer ON' to false

    Scenario 3: Same as above: if lose message is showing, then set 'self.Timer ON' to false

    Hope this helps for anyone else with the same problem!

    Thanks again for your response FryingBaconStudies!

    1LuVP4nc4k3S
  • 1LuVP4nc4k3S1LuVP4nc4k3S Member Posts: 62
    Actually....this isn't working... :(

    I still need help on this!

    @FryingBaconStudies, can I PM you about this?
  • 1LuVP4nc4k3S1LuVP4nc4k3S Member Posts: 62
    Oops, I meant @FryingBaconStudios.... :P
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Don't use the otherwise section make separate rule for the reverse. Otherwise can be tricky when using a Boolean.
  • 1LuVP4nc4k3S1LuVP4nc4k3S Member Posts: 62
    I've played around with this a lot now and set different rules now, but I still haven't quite got it. The countdown timer and the egg-timer animation now successfully stop when the player has completed the task in time - that's fine.

    But I still can't get the egg-timer animation and countdown to stop once the player completes the task and the 'you win' message appears.
Sign In or Register to comment.