Hello everyone,
Here’s where I’m at:
I’m new to coding, coming from a animation background. Went through a bunch of tutorials, but I’ve found the best way for me to learn is to do projects. I’ve made a few arcade prototypes which are fun and now decided to make a puzzle game, because it uses totally different mechanics.
The game requires grid movement, one unit at a time, x or y, but also wrapping so:
00 01 02 03
10 11 12 13
20 21 22 23
30 31 32 33
In the 4x4 matrix if at point 03 you must be able to move into: 02, 13, 00, 33.
I have at the moment, the ability to select the GameObject which will be 1 of 4 GameObjects the player can manipulate on the grid, and can assign it a new position on the matrix, via click counting. 1st click assigns the GameObject you going to move, 2nd click sets it’s position to a clicked tile which corresponds to the matrix positions.
I thought of having each tile have a collision object on it, the GameObject then raycasts in the x and y directions, if it hits a tile those become available for moving into otherwise all tiles are unable to be occupied. ( not sure if this is a good solution or not )
So again my idea is : Assign tiles values for if they occupied or not by raycasting from the PlayerObject.
If a tile is unoccupied and is 1 unit away from the PlayerObject it becomes “available”.
How do I limit the selected GameObject to only 1 unit tiles away from it’s current position, whilst maintaining the wrapping?
Thanks in advance.
PS, if you going to suggest code I’m using UnityScript.