Sprite Based on Surroundings

Get help using Construct 2

Post » Tue Feb 25, 2014 3:12 pm

Here you are.

dropbox.com/s/jzs0r2dt81hrvlg/MyGamev2.capx
B
4
Posts: 11
Reputation: 251

Post » Tue Feb 25, 2014 5:34 pm

And here it is
The events were all right. Only problem was your tilemap : it was set to tiles of 32x32 but your image was 240*60. I stretched it to 256*64 and all was all right.
B
17
S
8
G
4
Posts: 473
Reputation: 6,191

Post » Fri Apr 04, 2014 4:48 pm

@guizmus Is there a way to change the size of the selection of tilemap say i have 16x16 tiles that i want to use? when i put a tilemap ive made that the tiles are 16x16 when i try to select one it selects like 2 because it is grabing 32x32.
B
16
S
2
Posts: 34
Reputation: 914

Post » Tue Dec 09, 2014 9:21 am

@Guizmus If i was using an array how could i check the surrounding cells? My question is very similar to this one that has been asked but im not using the bitwise method, im using the array generation method.

I wanted to know if its possible to check the surrounding cells around a certain sprite? I needed to know this because i want my dirt sprite to change if it is exsposed to air transforming it into a grass covered dirt sprite.

I just need help trying to figure out how to check the surrounding cells.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,378

Post » Tue Dec 09, 2014 10:00 am

I've quickly edited Rojohound's terrain gen capx to show how you can turn top sprites to grass.

terrainGen.capx

After generating the terrain press spacebar.

To check surrounding tiles you'll need to loop through the array. I checked for the current cell value being "1" which is a solid then to check surrounding tiles I used CurX (this stays as it is because we're not interested in left&right surroundings) and then CurY-1 which will check "1" cell above the current cell is "0" which is air.

If you planning on doing more like this you WILL be using bitwise numbers eventually since that has nothing to do with the fact that your terrain gen is array based it is a method of setting tiles/sprites based on surroundings.

There is another example of mine HERE and a link to my blog post about using bitwise numbers for tiling levels.
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Previous

Return to How do I....?

Who is online

Users browsing this forum: Microbex and 23 guests