Can I put my fall animation in anything other than always updating function?

Jovial Games

  • Posts: 132
Hey guys,

I have a question, when my character falls, I want it to change to fall animation. The code for that works but what happens is that it interferes with my winning animation. Since, its an always updating function, I am unable to switch to win animation upon level completion. I've attached screenshots of my code below, please help me fix it, thank you! :D

Rocktapus

  • *
  • Posts: 23
Hi Jovial

I think the simplest way working with the code you already have would be to use a variable to control whether or not the updating event is ran.

 Add an "IF" wrapper with local variable to the top of the update event called something like " Win";

If (win = false) - run update code

Then when you character enters region 0 immediately set this variable to True to stop the update code from running and then set your animations as you would like.

Hope this helps

Jovial Games

  • Posts: 132
Hey, thanks for responding!

 I think I understand what you mean but I'm not sure on how I'd be implementing that. Could you please go into more detail? Would be very generous of you!

supremelorax

  • Posts: 41
Greetings Jovial,

Rocktapus is referring to using a boolean, and potentially an attribute or true/false to set your 'if' statement.

For example: You can create an attribute either tied to true/false or a number like 0 and 1. When the fall happens, set this attribute to 'true' or '1'. All other times it will be 'false' or '0.' When the fall happens this attribute changes and then triggers your 'updating' event. Just make sure to then set the attribute back to 'false' or '0' at the end of that code block series or it will continue...

Jovial Games

  • Posts: 132
Thank you Supremelorax, you are very kind to explain it in detail. I still have some questions, kind of a noob in this so please bear with me :)

How will I put an if statement above when updating? Or will it be this way:

''When updating
If fall = true
do the rest of the code''
''set fall = false''

Also, will this be a game attribute (the one in purple) or only attribute (the one in blue)

supremelorax

  • Posts: 41
Jovial, I am pretty new to this too but logic is something I enjoy in any form!

As far as game vs. scene attribute, it depends if you are going to need to store it over time throughout your game as if for game stats or the like (end game: how many times you fell... haha), for this I think scene attribute (blue) although if the same thing is needed in each scene (and it would work since it is just looking for that same variable) maybe that is where a purple one would come in handy. We would need a more experienced Stencyler to weigh in on that. 'When updating' happens once every time the game refreshes or something like that so it is constantly cycling and looking for that variable to change.

It would look exactly like what you put there.

Jovial Games

  • Posts: 132
I tried doing everything but it is still not working. The animation does not change when it enters the region where I have the second code.

LIBERADO

  • *
  • Posts: 2718
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.