Ok so bear with me as this is my first post on this forum and any help would be appreciated. I have searched through this forum, stack exchange, youtube, etc… and cant seem to find a solution or explanation for my problem. Also pleas note there are a few questions in here. so here it is…
I am using 2D isometric Z as Y tilemap. setting up the sprites and painting the tiles all works fine. however I am having some issues with the movement. I have gotten the player movement to work just fine using Rigidbody.Moveposition. For my side to side movement I am doing Vector3(-0.5f, 0.25f) “left” and Vector3(0.5f, -0.25f) for “right”. As well as Vector3(0.5f, 0.25f) and Vector3(-0.5f, -0.25f) for “up” and “down”. so using these values my player will move exactly one tile in whatever direction I press, which is great. However I want to implement a system so my player can only move say 3 tiles in one turn.
Question 1 - How can I limit my players movement to only 3 tiles in one turn if my tile distance is different depending on which direction they are going? For example I move 0.5 on the X and 0.25 on Y.
Question 2 - Is there a way I can set up my movement so I can move 1 to the left on x to move to next tile or 1 on y to move up 1 tile (as opposed to different decimals like 0.5 and 0.25). Or is this just not possible on isometric tilemaps?
Question 3 - How do I highlight my possible movement for the turn? Like so that 3 tiles in every direction are flashing or a different color or whatever. I know I’ll need to do some pathfinding to go around obstacles and stuff and to eliminate not walkable areas. But just for the start I would like to get it working without considering unwalkable areas as I can just cross that bridge when I come to it.
The above scenario is using the WASD system to move the player. I have also been messing around using the mouseclick to move the player. The problem I have been running into with this system is the difference in the screentoworldpoint and worldtocell. for example I have a couple lines here.
Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
when I use debug.log to print out my coordinates on a click it gives me something like (-1.5, -0.9, -10.0)
then when I use…
Vector3Int coordinate = grid.WorldToCell(mouseWorldPos);
I get a printout of (1, 4, -10) for a click on the same cell as the screentoworldpoint example.
I then try to feed in my Worldtocell vector 3 as a move coordinate like…
transform.position = new Vector3(coordinate.x, coordinate.y);
it just moves me to (1,4,-10) but on the screentoworldpoint system NOT the grid cell system. so its nowheres near where I clicked.
So Question 4 = when I give my player coordinates, how do I make sure it moves to those coordinates on the grid cell system and not the screen to world point system?
Any and all help is greatly appreciated (and please keep in mind this is my first post)
Thanks