How do I place tile at object coordinate?

  • I am experimenting with some random level generation and am using objects with basic movement instructions to help me place geometry in a scene.

    It works quite well but isn't very performant because I end up placing thousands of 32x32 objects in the level. I thought it might be smarter to use the tilemap object.

    This is what it currently looks like:

    So I have these little objects that move around and when they collide with an invisible 32x32 object they change it's 'tile type' to 1 - and when a tile type is 1, that object spawns the geometry object. Instead of spawning the geometry object however I'd like to place a tile from a tilemap.

    From what I can tell, I need to feed tilemap coordinates into the object, what I can't work out is how to reference the tilemap coordinate based on the position of a non-tilemap object.

    I'm sure the way I'm doing this is the ramblings of a mad man and there are much better ways of doing this lol

    ps - this is for a highly experimental mode for Brute

  • something like

    https://goo.gl/0EMOgg

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • RamPackWobble - interesting, doesn't work in my project as is but I will explore this technique, thank you

  • Tilemaps have an expression tilemap.positionToTileX(coordX)

    Another way to do it is floor(coordX/tilewidth)*tilewidth, assuming the tilemap is positioned at 0,0

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