Hey everyone
Just wondering if I am doing this the best way.
I have a 3x3 "grid" that an object moves on with the bottom row being the "front" and the top row being the "back" and the object shrinks or grows based on which row it is in to give the illusion of depth, similar to those old sprite scaling games like Space Harrier. Since the "cells" on the grid at the back get closer together on the X axis with each row towards the back, the grid has the shape of a trapezoid.
---*-*-*---
--*--*--*--
-*---*---*-
I was having trouble thinking of a way to implement movement of the object within this trapezoidal grid in the cleanest way possible. The objects in the grid don't need to move smoothly, they are "snapped" to each cell. The player moves horizontally along the bottom of the grid (an extra 4th row with the same X values as the "front" row of the grid above mentioned grid)
Controlling the size of the object is no problem, a simple if y=## then set size of the sprite on the active object
The objective is to:
- allow the scaled object to detect if there is an object existing in any adjacent cell of this 3d grid
- allow the object to move to an unoccupied adjacent "cell" if possible
- allow the object to perform an action if it is, say, lined up with the player, or adjacent to the player, or some other condition
Right now I use an array, with 2 z layers:
1 - to keep track of occupied spots, and what is occupying them
2 - to dictate the X,Y coordinates of each "Cell" on the play area
I had an idea to use the advanced gameboard object, placed out of the play area, instead of the array to accomplish "1" above. So the object in the gameboard grid would be what moves (out of sight) and the object in the play area on the "3d" grid would just have its position updated to the irregularly sized "3d" grid. I am leaning towards this because I think for this purpose the advanced gameboard is a bit more straightforward to manage and has built in ability to detect occupied cells etc. That does require a bunch of additional objects though
I like to make things as clean and efficient as possible though so doing this with the least # of objects and lines would be best, so just looking for any better ideas of how to accomplish this or maybe I have it figured out, if so that is great.
Also I would like to say I have done a few posts here and everyone is so helpful, it's really great. Cheers