Solarus-Games English Forum

Solarus => Development => Topic started by: Starlock on December 21, 2020, 05:29:32 PM

Title: Ground sprite changed on map change
Post by: Starlock on December 21, 2020, 05:29:32 PM
I was remaking my custom grass to be more optimal by using a modified ground with an animation change to the grass sprite. It works perfectly except for when you go to a different map it will change back to the default animation for a second before changing back to the modified animation. Does anyone know of any workaround, I've tried using map:on_started(), map:on_finished(), game:on_map_changed() and none of these so far have worked.

Code: [Select]
  entity:add_collision_test("overlapping", function(entity, hero)
    if hero:get_sprite("ground") ~= nil then
    hero:get_sprite("ground"):set_animation("purple")
    end
  end)
Title: Re: Ground sprite changed on map change
Post by: PeterB on January 10, 2021, 10:58:15 AM
I have seen in another post that there is a delay at the start of the map with map:on_started(). So If you have set this up in function map:on_started() it would be better to call it in function map:on_opening_transition_finished().