[Feature] More Tilemap Expressions

Discussion and feedback on Construct 2

Post » Tue Dec 15, 2015 5:28 pm

Hey! I make level/map/terrain generators, some of which are for sale on the Asset store (links below ;) ) In feedback, I've been asked if my rendering action could use tilemaps rather than sprites. I'd love to do this, given the performance boosts, but the Tilemap function doesn't have enough expressions :( Having access to user-set properties like tile width and height, offset and so-on, would be a great help!

https://www.scirra.com/store/royalty-free-game-templates/terrain-generator-1774
https://www.scirra.com/store/royalty-free-game-templates/dungeon-generator-1500
B
25
S
7
Posts: 216
Reputation: 2,254

Post » Tue Dec 15, 2015 6:14 pm

I think you're going to have to be a little more specific.
Image ImageImage
B
165
S
49
G
148
Posts: 8,050
Reputation: 97,092

Post » Tue Dec 15, 2015 8:00 pm

Fair - for example, a lot of the time I've found myself wanting to have a condition on an event to limit it to run for each tile in the array. As it is, I have to use fixed integers here, and adjust them if I adjust the properties of the tilemap, like so assuming you have a tile width of 32:

For ( 0 to int(Tilemap.Width/32) )

However, if I were able to call one of these expressions instead:

For ( 0 to Tilemap.Width/Tilemap.TileWidth )
For ( 0 to Tilemap.ArrayWidth )

I (and the people who purchase my assets) wouldn't have to adjust these properties when they swap out tilemaps for a different resolution. I feel that a great strength of C2 is in rapid prototyping - and that prototypes are easily accelerated to full-scale projects without a 'full rewrite' mentality necessary.
B
25
S
7
Posts: 216
Reputation: 2,254

Post » Tue Dec 15, 2015 8:46 pm

I agree those would be useful additions, but if you want to get them now you can do this:

Code: Select all
global text tilesJSON=""
global number horizontalTiles=0
global number verticalTiles=0

Start of layout
--- set tilesJSON to tilemap.tilesJSON
--- set horizontalTiles to int(mid(tokenat(tilesJSON, 4, """"), 1,20))
--- set verticalTiles to int(mid(tokenat(tilesJSON, 6, """"), 1,20))
B
88
S
30
G
90
Posts: 5,114
Reputation: 60,839

Post » Tue Dec 15, 2015 11:05 pm

Wahey! Nice, thanks - much better than previous workarounds. I've been delaying the inevitable by not familiarising myself more with the JSON format really... but as you say - would still be useful to have the in-built expressions! :P

Thanks R0J0hound!
B
25
S
7
Posts: 216
Reputation: 2,254


Return to Construct 2 General

Who is online

Users browsing this forum: BackendFreak, Digitalarray, Solomon, Tokinsom and 4 guests