Solarus-Games English Forum

Solarus => Development => Topic started by: Zefk on April 27, 2017, 05:38:00 AM

Title: [Solved]Freeze hero?
Post by: Zefk on April 27, 2017, 05:38:00 AM
Is there a way to freeze the hero, but still allow hero:set_animation("animation") and then unfreeze the hero?

I know something similar can be done by drawing a sprite at the hero coordinates and setting the hero visibility to false. Also, this can be done with a movement because it disables the hero control and that does not cancel the animation when trying to move the hero until the movement is completed.
Title: Re: Freeze hero?
Post by: Christopho on April 27, 2017, 09:09:25 AM
I don't understand the question. You can call hero:set_animation() when the hero is frozen, there is no problem.
Title: Re: Freeze hero?
Post by: Diarandor on April 27, 2017, 09:36:41 AM
The question is unclear. Maybe he intends to keep an animation while the hero is not frozen. Is that so?
Title: Re: Freeze hero?
Post by: Zefk on April 27, 2017, 04:32:30 PM
QuoteI don't understand the question. You can call hero:set_animation() when the hero is frozen, there is no problem.

@Christopho
My mistake. I got it to work now. It seems hero:freeze() just does not work on map:on_started().
     

QuoteThe question is unclear. Maybe he intends to keep an animation while the hero is not frozen. Is that so?

@Diarandor
I actually would like to know that. For example, is it possible to have the hero walk around using a "stopped" animation instead of "walking"? My first thought would be to change the hero:set_tunic_sprite_id(sprite_id) and have the animation for "walking" be "stopped."
Title: Re: Freeze hero?
Post by: Diarandor on April 27, 2017, 07:36:50 PM
The easy way is to change the tunic sprite. Another way is to code a script for an animation fix (using the sprite events of the tunic sprite), but this may produce other problems and complicate things, so avoid doing this if possible.
Title: [Solved]Freeze hero?
Post by: Zefk on April 27, 2017, 09:33:36 PM
@Diarandor
That makes sense. Thanks you for the help and tips.