How do I keep sprites on global layers consistent?

  • If I put an object on a global layer (such as a tilemap), and then switch layouts, how do I make the tilemap stay the same (in terms of tiles) if I load the next layout? It keeps getting reset and I have no code would change it. I tried making the object global, as well, but it then made a copy of the same tilemap on a different parallax layer...(pretty sure that's a bug, but I don't really have time to figure out why.)

  • You can make the object global but don't make it global and put it on a global layer, do one or the other. The tilemap shouldn't reset if you put in on a global layer. Even in the editor view you should see the tilemap in both layouts because the layer is global.

  • plinkie - yeah, that's what I was afraid of. It must be a bug then :( Back to the drawing board!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No I didn't say it was a bug, I said you can keep it as a global object or you can put it on a global layer. If the tiles are resetting then you must have events that are resetting it or you are looking at a different tilemap object.

  • plinkie - Correct, the object is not a global object, but the layer is. There's no visible code that would clear any of it, only add to it. And it is adding correctly, but it's deleting what was added on the previous layout.

    Unless I'm unaware as to how "set tile" works and it actually clears the map and sets the tile specified? It's literally the only line of code that is affecting the tilemap.

  • Ah, yes it is a bug. Made a brand new project to test it; tilemaps get reset on next layout. I'll put it on the github.

    Thanks plinkie!

  • Looks fine to me, please share the new file :)

  • plinkie - okay! I was wrong :). Apparently global layers actually are meant to delete and recreate the initial object on start of layout. I want to do more testing to see if the same goes for sprites, but it seems a global object on a non global layer should work.

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