Location storage and usage:

Help!

I am trying to make a board game style game with free movement; the kind where you can choose to move up-left-right-down at each individual space.

The way I am going about this is by making multiple instances of a "space" location, and moving the sprite to the location from the old space to the new space. I am storing all these locations in a 2D array that I will reference by using the player's location ID, which will change as they move.

For example, the location array looks like this.

Locations[0,0] = inst_1.x //Location of space 1
Locations[0,1] = inst_1.y
Locations[1,0] = inst_2.x ////Location of space 2
Locations[1,1] = inst_2.y    

And then after that, using a 1D array to define available directions available at each space in binary. In other words, it would look like this:

//Directions North, East, South, West in binary
AvailableDirections[0] = 1101 //You can move north, east, and west from space 1

AvailableDirections[1] = 0101 //You can move east and west from space 2

Am I going about this in a bad way? I can't help but feel I am doing this in a really sloppy manner.

Posted Aug 5, 2020, 10:57 AM UTC

16
Loading comments…