Skip to main content
13 events
when toggle format what by license comment
Jul 25, 2015 at 5:10 vote accept Panda
Jul 25, 2015 at 5:08 comment added Madmenyo No problem, there are a lot of technical terms. I'm programming for more then a decade now and still mess up the wording sometimes :). I made an edit of my post to make it even clearer.
Jul 25, 2015 at 5:07 history edited Madmenyo CC BY-SA 3.0
added 20 characters in body
Jul 25, 2015 at 5:06 comment added Panda Alright, that makes sense. Sorry for the bad wording again, I feel like I messed this up a bit with how I worded it :P
Jul 25, 2015 at 5:06 history edited Madmenyo CC BY-SA 3.0
added 1515 characters in body
Jul 25, 2015 at 4:48 comment added Madmenyo Depends on what you want really. It's less scalable, you can have the int refer to anything you want but if you want a lot of specific entity to have different properties you end up with a big dictionary. A entity is such a broad discription you are probably better off ditching it. It's not very efficient way either, since for each int you have to iterate a list of all types. Much more efficient is a separate class and store those object in a array. Your method does however take less memory and less space when you want to store your map.
Jul 25, 2015 at 4:33 comment added Panda Sorry for the strange wording, I couldn't come up with a better way to put it. Yes, I have an array of ints where each int represents an entity. My question is essentially if I should instead ditch the representation way of it and directly store the objects directly like you have shown in your example.
Jul 25, 2015 at 4:28 comment added Madmenyo It's not clear to me what you mean by instance of each static object. A object cannot be static. A class can have the static keyword but this would never belong to the object you create from the class. So I am not sure what you exactly want. Do you just have int[][] map = new int[width][height] where the int refers to the type of entity? You need to link that int somewhere to something, I mean you could link it to a texture but you can also link it to another object. You can also populate the array with objects you actually need like Tile[][] tileMap = new Tile[width][height].
Jul 24, 2015 at 19:14 comment added Panda However there is only one instance of each static entity object. Adding a position field to the object itself won't work because it will just be the position of the entity that was created last. I think dnk drone.vs.drones may be correct that I cannot easily do what I want.
Jul 24, 2015 at 17:26 comment added Madmenyo You ad a x and y field to the class of the object you are instanciating. Or add a object of the class I just presented.
Jul 24, 2015 at 17:15 comment added Panda I must be misunderstanding you. How can I add the position of the entity to the actual object if there is only one instance of the object?
Jul 24, 2015 at 10:44 history edited Madmenyo CC BY-SA 3.0
added 137 characters in body
Jul 24, 2015 at 10:34 history answered Madmenyo CC BY-SA 3.0