How do I place tile at object coordinate?

Get help using Construct 2

Post » 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:

Image

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

Image

ps - this is for a highly experimental mode for Brute
B
43
S
13
G
8
Posts: 612
Reputation: 7,372

Post » 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
33
G
47
Posts: 1,194
Reputation: 30,812

Post » 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
43
S
13
G
8
Posts: 612
Reputation: 7,372

Post » 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
41
S
19
G
65
Posts: 1,085
Reputation: 37,842


Return to How do I....?

Who is online

Users browsing this forum: jaytrott86, Yahoo [Bot] and 6 guests