Author Topic: Ground sprite changed on map change  (Read 5076 times)

0 Members and 1 Guest are viewing this topic.

Starlock

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Ground sprite changed on map change
« 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)

PeterB
  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Ground sprite changed on map change
« Reply #1 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().
 
« Last Edit: February 26, 2021, 05:36:56 PM by PeterB »