- Home /
Fill bounded grid blocks
Basically I am working on 2d game. In that I need to move my player through keyboard controls.
Game is developed in grid so there are 30 cols and 20 rows exist. So there are 600 blocks exist in game play. I give them unique index. So top left block has id (0,0), next to that has id (0,1) and last bottom right block has id (19,20). This way I divided full grid blocks
I am attaching image to give you more understanding about my problem.
In above image, I have given two examples about what I want. From A to D, I want to move in first example. If Path-1 movement goes then I want to cover area that I have captured and represented in shaded area.
I want to get index of this shaded area blocks. I can't able to apply calculation for this. Because path moved by player is completely dynamic. Second example of game this in Path-2.
Please friends I want some suggestion from your side because from last 2 days I was spending time for this calculation. If you have any doubts then please ask me any time I am available always.
Your answer
![](https://koobas.hobune.stream/wayback/20220612051759im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Grid Letter Box is not expanding, 0 Answers
Minecraft like building? 2 Answers
How can i keep global scale of object while instantiate it 1 Answer
Grid Shape Detection 3 Answers
Improving Grid Algorithm 1 Answer