Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Is it ok having a matrix of objects...?

$
0
0

@Carlos wrote:

... or it is not? or do exist better options?

in my case, i'm trying to make a little game, kind of a rogue like tile and turn based game. For now the map is only 15x15, though i'm not sure if it will change.
So, i've always used a list of objects but in this particular case i was wondering if there's a better option, one that makes the programmation easier.

For example, i can easily check if there's something in the upper tile just with:
if(objects[player_X][player_Y - 1] != null);

if i create por example an arrow to the right:
objects[player_X + 1][player_Y] = new Arrow();

or if a monster moves to the right:
objects[monster_X + 1][player_Y] = objects[monster_X][player_Y];
objects[monster_X][player_Y] = null;

etc

I actually was thinking in a matrix of pointers, but i don't really know if that's what i have or i'm just programming some kind of abomination jajaja

anyway, any insight or recommendation? thanks!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles