Author Topic: [Solved]Freeze hero?  (Read 1246 times)

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
[Solved]Freeze hero?
« 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.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1179
    • View Profile
Re: Freeze hero?
« Reply #1 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 1059
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Freeze hero?
« Reply #2 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?
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: Freeze hero?
« Reply #3 on: April 27, 2017, 04:32:30 pm »
Quote
I 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().
     

Quote
The 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."

Diarandor

  • Hero Member
  • *****
  • Posts: 1059
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Freeze hero?
« Reply #4 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.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
[Solved]Freeze hero?
« Reply #5 on: April 27, 2017, 09:33:36 pm »
@Diarandor
That makes sense. Thanks you for the help and tips.