Timeline for Storing player's tilemap position inside the player object
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 24, 2013 at 11:35 | comment | added | Blau | @SeanMiddleditch I'm only saying that it can be done with integers, not that it would be simple... water+ground = 3, and if you need more enemies in a room than 8, then you have a lot of bits in an integer :), and of course, the bits for enemies/objects cannot be types... must be identificators to hash them in a global array of objects/enemies.. | |
Jul 24, 2013 at 0:21 | comment | added | Sean Middleditch |
Nothing wrong with using integers; I'm just saying to keep only the actual map in your map data, not game objects. If you have a map cell (3,2) you can then easily query a game object data structure for all game objects at cell (3,2) . Why use flags for things that aren't inherently flags (can you be ground and water?) and why limit yourself to only 8 types of enemies, or even 8 types of objects? Even if you do see that enemy type 2 is on the cell, you still need to look up and find the actual object instance with HP and so on in it anyway.
|
|
Jul 23, 2013 at 22:34 | comment | added | Blau | @SeanMiddleditch I agree with you, is simpler using a custom struct for map cells, but using integers is affordable too, it can be done using flags 1: Ground, 2: Water, (4,8,16): 8 enemy ids, .... | |
Jul 23, 2013 at 22:24 | comment | added | Sean Middleditch |
@AnthonyHackett: storing special numbers inside your tile map to represent if an object is there is bad. What if you have two base tiles, like normal floor vs water, and also want to note whether an enemy is there? Or want to have a pile of items in the same spot? Let the tilemap store static world information, use a completely different data structure to store and look up the locations of entities (like a simple hash of their <X,Y> locations).
|
|
Jul 23, 2013 at 22:23 | comment | added | Sean Middleditch | @Byte56: Haha, beat ya! | |
Jul 23, 2013 at 22:22 | comment | added | House | I'm inclined to remove the code from this question as I don't really see how most of it has to do with the question. EDIT, nevermind :p Thanks Sean. | |
Jul 23, 2013 at 22:22 | history | edited | Sean Middleditch | CC BY-SA 3.0 |
ripped out the pages of utterly irrelevant skill code, made title slightly clearer
|
Jul 23, 2013 at 22:21 | answer | added | Blau | timeline score: 1 | |
Jul 23, 2013 at 22:19 | review | First posts | |||
Jul 24, 2013 at 0:04 | |||||
Jul 23, 2013 at 22:10 | history | edited | Anthony Hackett | CC BY-SA 3.0 |
added 2161 characters in body
|
Jul 23, 2013 at 22:08 | comment | added | Anthony Hackett | I just need to know how to literally create the array and if I should house the variable to tab their position in the object's individual class or a new class for each map. I can create all the functions myself. | |
Jul 23, 2013 at 22:05 | comment | added | Pieter Geerkens | So much depends on what you have not told us, that it is difficult to know where to begin with what you have. | |
Jul 23, 2013 at 21:59 | history | asked | Anthony Hackett | CC BY-SA 3.0 |