Solarus Forum

Solarus => Development => Topic started by: Zeror on July 20, 2015, 11:02:49 pm

Title: Falling down animation
Post by: Zeror on July 20, 2015, 11:02:49 pm
How can i do a falling down animation?
Like when you fall down into a hole from an upper floor to a lower floor.

Can't find how it's done.
Title: Re: Falling down animation
Post by: polyglot762 on July 21, 2015, 11:40:09 pm
If you go to sprites
then to hero
then to tunic1,2,3 (any of those)
then select falling.
PG
Title: Re: Falling down animation
Post by: Zeror on July 22, 2015, 12:30:09 am
I mean the animation that happens when you fall down a floor. The part where you see Link landing somewhere.
Title: Re: Falling down animation
Post by: Diarandor on July 22, 2015, 02:48:49 am
You should clarify more your question, it is quite ambiguous. Anyway, you should check Christopho's tutorials on youtube.

If you mean how to make the hero fall from a map to a different map, you may find the answer in this tutorial:
https://www.youtube.com/watch?v=4VIVdz3LPM4
Title: Re: Falling down animation
Post by: Zeror on July 22, 2015, 11:32:56 am
I mean this:

https://youtu.be/xf2IO7P5DVA?t=4m20s

On 4m25s you see that Link falls down a hole and ends up on a new map (the castle dungeon). The falling down animation on the upper map is not what i mean. That animation you see on the new map where link falls from the ceiling to the floor IS what i mean.

I know how to connect maps for this in Solarus, but not how to add the falling down animation to it.
Title: Re: Falling down animation
Post by: Diarandor on July 22, 2015, 12:59:46 pm
I have never done this, so maybe this is not the best way to do it. This is what I would do, I hope it works.

Use the event teletransporter:on_activated() to set a custom state on the hero (or save the info that he is falling in some boolean variable). Then, on the method game:on_map_changed(), that you may have already defined in some of your main scripts, you call a function to simulate the falling "animation" in case it is necessary (I would save that function in some other script).

To do this function for the falling animation, you should freeze the hero, maybe make him able to traverse walls or ignore obstacles, create the shadow at his coordinates, change hero's position, start the movement and, at the end of the movement restore everything to normal.
Title: Re: Falling down animation
Post by: Christopho on July 22, 2015, 01:15:04 pm
I confirm, this animation is not provided by the engine. You can script it as Diarandor suggests.
Title: Re: Falling down animation
Post by: Zeror on July 23, 2015, 04:20:41 pm
I have never done this, so maybe this is not the best way to do it. This is what I would do, I hope it works.

Use the event teletransporter:on_activated() to set a custom state on the hero (or save the info that he is falling in some boolean variable). Then, on the method game:on_map_changed(), that you may have already defined in some of your main scripts, you call a function to simulate the falling "animation" in case it is necessary (I would save that function in some other script).

To do this function for the falling animation, you should freeze the hero, maybe make him able to traverse walls or ignore obstacles, create the shadow at his coordinates, change hero's position, start the movement and, at the end of the movement restore everything to normal.
And this goes in main.lua or should i use another file for it?

/me is still learning and stuff...
Title: Re: Falling down animation
Post by: Diarandor on July 23, 2015, 07:03:28 pm
You can write everything directly in the event game:on_map_changed(map), but I would write a function in another script (made just for this) and call it in the event. You can do it as you prefer, that's not important.

I don't know how are your scripts. I have the event game:on_map_changed(map) defined in my game manager script, although you may have it in the main.lua. I cannot help you more, sorry.