Indestructible

Published June 05, 2009
Advertisement
I've been messing about some more with indestructible tiles and have been wondering whether such things are better done using objects, either by a game entity or as an object tile layer. With an explicit object it'd give me more freedom to move it around and do things with it; it'd also be simpler to animate as it becomes divorced from the tilemap itself.

Storing the collision map is interesting. At the moment I'm not doing it properly, I'm still using the original tile info. My plan is to store some info about the collision info in a separate tilemap. The original plan was to use an array of bools, I may still use this - but I'm pondering whether I could pack the data into ints instead. So an int holds 32 bits, which coincidentally is the width and height of my tile. If I have a couple of ints, I can pack in the collision info for the whole tile and do some quick block or row tests. If the value is 0, I can immediately know that the block is empty and move on instead of trying to test each pixel in between. It does feel like premature optimisation though...
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement