Is there a way to force a tilemap to update?

0 favourites
  • 5 posts
From the Asset Store
Build a thrilling space station scenario with these level assets and characters.
  • I have some events that set the tiles in a tilemap, then I have a behavior that modifies the tilemap, however it doesn't appear to have its tilemap_data property updated after the first events set tiles in the map.

    Is there a way to force the tilemap_data to be updated before I run the behavior code?

  • I can't think of anything tilemap does that's not synchronous, other than changing the texture.

    If there was, it would most likely happen the next tick.

  • hm.. I just tried adding a Wait 1.0, and it still doesn't update the tilemap_data

    My behavior reads the this.inst.tilemap_data

    Based on that, it alters it and then returns a jsonString that can then be loaded back into the tilemap.

    so, if I edit the tilemap via construct2 events beforehand, the this.inst.tilemap_data is never updated.

  • You need to look at what the tilemap plugin does when it modifies the tilemap. It looks like it sets some booleans indicating things need to be updated, then in turn the draw function calls another function that checks the booleans and updates as needed.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Okay,

    I changed my behavior to rely on the actual cell/tile data instead of the tilemap_data value.

    So now I can retrieve the updated map.

    Can't rely on the tilemap_data because that never gets updated after creation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)