Falling Animation doesnt work. can anyone help me?
Hey there,
I'm creating an endless runner which got randomly spawned platforms, coming in from the right going to the left.
i have created an inAir animation for my character. set up with an Jump boolean and a rule when player collides with platform.
when i jump the animation works perfect, but if i just walk off a platform and fall down my character keeps running(animation) while falling down.
does anybody know how make my inAir animations work while falling of platforms?
thank you.
Best Answers
-
gamestew Posts: 11
thats actually a good thing, falling off the side of a ledge should have a more dramatic animation any way, just put this in the final else part of your fall / jump rule
else if self.Y.veloc <0 play animation
Unity has a drag and drop function/plugin now, its way more affordable then this communist setup.
-
nickname5862 Posts: 51
@njvdberge@gmail.com
First: "occur" means "happen", when something occurs, it triggers, happens, or however you want to call it.
Second: I think it is hard to understand but will try to think of as many ways to fix this problem...
way 1: Change the boolean attribute self.jumping to a integer attribute. This way, you do: if 0, run, if 1, jump, and if 2, fall. I don't know if this works, but it could?
way 2: I don't see why @gamestew idea cannot work. Even with randomly spawned heights, you can still do that. I assume that you jump with linear.velocity.y (i don't know any other way), and when it is less that 0 (0 is standing still qua y position, less is dropping exponentially) play the animation. it won't be any problem, except if you want your animation not to be playing when falling onto another platform.
In that case: Only play your animation when being lower than the chosen height.....If those ideas do not work or you have a question, respond!
Answers
Rule - when collides with platform
(do your running animation in this rule).
Else - jump animation
That way it will only animate when it's touching the platform and the other while not touching.
@njvdberge@gmail.com
If you tell the animation to occur when it's not touching the ground this should fix your issue.
Hey,
first thank you all for your responses.
"gamestew"
i don't think this will work in my game, because the platforms are spawning in random heights.
see below for my situation
"AJaymz"
i have tried this is many different ways. when i do that the animations does not work proper anymore.
see below for my situation
"RabidParrot"
i don't know what you mean with occur?
see below for my situation
my case it isn't that easy, i have another collusion system.
when you start the game the player is sitting on a platform, when you touch the screen you will start the game. when gameStart is false the sit animation will play.
my player setup: when my player hits the platform the player will fall down.
my platform setup: when the bottom 5 pixels of the character are = or > the top 5 pixels of the platform, when that happens the platform collides with the player.
the only way the animations act normal to the platforms and jump is when i have one rule self.jumping false play run animation and when is true play inAir animation.
i hope you guys understand what my problem is.
*and sorry for my bad English
first of all sorry gamestew for now believing you. it works perfect right now.
and nickname5862 thnx for telling me all your info. it works!