Cripes 2.0: EntityMap

Published February 12, 2009
Advertisement
Just a little update on the Cripes 2.0 design. I changed the EntityManager class into an EntityMap class - a cosmetic change - so I could rationalize giving it a width and height, for the reasons I mentioned before. With that done, I created a Clip() function like the Map class's, and moved the code I previously had in the World for mapping adding the entities to the EntityMap. Much better! Just get the clips, copy the entity clip onto the map clip, and voila.

Slight problem (but very easily fixed): Copying the entity map directly onto the map clip overwrites the map clip entirely. This is bad. Luckily, I thought ahead and decided that '\0' signified "air", as opposed to ' ', which looks the same but is still physically "there". Perfect solution: only copy an entity map block if the character isn't '\0'. Of course, now I'm wanting for a way to designate a clear foreground/background color, but I really don't need it. It would be cool... but I just don't need it, and it's less trivial than this. Oh well! ^_^

EDIT: Yes, this means I can have sprites with holes in them through which you can see the map. Whole lot of good it does me when the Snipes world is just black with blue walls, eh?

EDIT 2: Class layout updated!
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!
Profile
Author
Advertisement
Advertisement