# How do I place tile at object coordinate?

Get help using Construct 2

### » Wed Sep 16, 2015 7:44 am

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
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

### » Wed Sep 16, 2015 8:10 am

something like

https://goo.gl/0EMOgg
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,912

### » Wed Sep 16, 2015 8:30 am

@RamPackWobble - interesting, doesn't work in my project as is but I will explore this technique, thank you
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

### » Wed Sep 16, 2015 10:21 am

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
B
51
S
24
G
70
Posts: 1,196
Reputation: 41,370