Solarus-Games English Forum

Solarus => Bugs & Feature requests => Topic started by: Diarandor on August 07, 2015, 06:36:48 PM

Title: Bug freezing hero?
Post by: Diarandor on August 07, 2015, 06:36:48 PM
Hi! I am using this code in the script of a map

local map = ...
function map:on_started()
  map:get_hero():freeze()
  sol.audio.play_sound("ok")
end

but the hero does not freeze (the sound plays, so the event is initialized). I suspect this could be a bug of the map:on_started() events. I have tried even with empty maps and nothing happens. This is very strange. Can anyone confirm this is not just me?

EDIT: I was trying to use this to make a cutscene for the intro. But since I don't need to display the hero I will use hero:set_enabled(false) instead of hero:freeze(). Anyway, this could be a problem to make cutscenes where the hero appears and we need to freeze him.
Title: Re: Bug freezing hero?
Post by: Christopho on August 07, 2015, 06:54:59 PM
Try to freeze the hero in map:on_opening_transition_finished() instead.
Title: Re: Bug freezing hero?
Post by: Diarandor on August 07, 2015, 07:04:20 PM
Thanks a lot!!!  With that event it works fine. I had never used it.
So there is no bug.
Title: Re: Bug freezing hero?
Post by: the bread on August 07, 2015, 08:37:59 PM
Another possible bug about freezing the hero: When I tried to freeze the hero when swimming, the swimming animation was replaced by the stopped one. I've attached a screenshot to this post.
Title: Re: Bug freezing hero?
Post by: Christopho on August 07, 2015, 08:56:23 PM
Freezed means changing the hero's state, so instead of swimming he does nothing. But you can still change the animation of the sprite.
Title: Re: Bug freezing hero?
Post by: Diarandor on August 12, 2015, 05:03:05 PM
Anyway, I want to point out that in the map script 0.lua of zsdx you wrote:

function map:on_started(destination)
  hero:freeze()
  ...
end

which does not freeze the hero. Although that's not important at all since you have no weapon at the begining, so no sound will start if you press the action command.
Title: Re: Bug freezing hero?
Post by: Christopho on August 12, 2015, 06:00:48 PM
Nice catch :)
So he is not freezed, I did not know. It had no consequence because the game is suspended during this whole map due to dialogs (it is the intro map).