- Home /
Character movement range in strategy game.
I have a turn based strategy game and I want to limit character movement to some degrees, like a character can only moves inside an allowed range, like in a circle shape. So how should I create said circle, with collider maybe? And if it is possible to recognize Input mouse position in the circle?
Sorry, the question seems too general to answer. Is it tile based? Is it 2D? How do you want to compute 'max distance'?
No, it is not tile based, since it is turn based, I will have to adjust gameObject's present position anytime it finishes its move. And from the position it currently is at the beginning of the turn I would have to check how far it can moves again. Does this explain a bit better? I'm using Nav$$anonymous$$esh to control the characters.
Answer by CodeMasterMike · Dec 19, 2012 at 09:04 AM
As Alec Thilenius said, a very general question indeed. There are many ways to do this ofcourse, but my sollution would be something like this:
First create a grid with squares/hexagons, which covers the map where the player can move.
And to limit the movement, you could create a circle to show where the user can move. And when the user clicks in this circle, raycast to see which square/hexagon in the grid the user has clicked on, and move the player to this position. Using a grid like this, makes it easier to implement a A* for pathfinding for example.
The player doesn't need to see that there is a grid, you just use it to determine where the player can and can't go.
I hope this gives you an idea or inspiration of how you can do it :-)
Good luck!
Exactly what I was thinking. Just use a pathfinding algorithm (Like A*) to deter$$anonymous$$e the actual walking distance. See if it is within an acceptable range.
Oh I see, Actually I'm still thinking about the game system and if it is possible for me to do it, I haven't got much experience about Unity yet. I will try to do it.
Answer by ifonlyme1000 · Sep 22, 2020 at 07:48 PM
https://www.udemy.com/course/turn-based-strategy-game-development/ Turn based game dev tutorial like heroes of might and magic
Your answer
Follow this Question
Related Questions
problem with 2d movement down slopes 0 Answers
Original Blender character faces ground when not walking 2 Answers
wanna know what make my char stop 0 Answers
Standard asset question 1 Answer