Changing colour of tiles

Hello all!

Long time programmer, but first time Game Maker user! Been trying to make sure I can do all the bits I want to achieve in my game before starting the project. One of these things is, I want to be able to make pulsing walls, i.e. walls that expand and contract with music, as well as the colour of said walls changing. I've successfully done colour changing on sprites using image_blend and that is perfect. However, I wanted to use tiles to do the walls, and not sprites. It seems like these things can only be realistically be achieved with sprites.

Would this be the correct way to do it? It also appears the "correct" way to collide with walls is to use invisible sprites, so using actual sprites for the walls instead of tiles seems to make sense? These sprites will be a single colour so won't look odd over lapping. Will enlarged sprites (image_xscale, yscale) collide automatically using the collide event?

Thanks!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, to answer your last question first, yes, enlarged sprites will detect collisions as long as they are the sprite assigned to the instance and they are made bigger by setting the image_x/scale values. However... You can use tiles for the walls too and simply create your own collision detection using a DS grid too... My game Skein uses a ds_grid and tiles for ALL collisions and 90% of the graphics. :)

You can set the colour of a tile much like the sprites as long as you have the tile ID, and you can get the tile ID using the dedicated function tile_get_ids or one of the tile depth functions. Check the manual! It's slightly more complicated, but it's certainly possible and should be a bit quicker on the old CPU/GPU too.

I will say though that if you are using objects with sprites for this and your FPS is still fairly high (at least triple the room speed is my rule of thumb) then you should just go with them if that's what's easier for you. I used grids and tiles for SKein because in later levels I have literally thousands of enemies and needed the optimisation. :)
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
To further add, tile' colors are to be changed via tile_set_blend function.
 
Top