# Turn-based Movement

Status
Not open for further replies.

#### Shyster

Level 9
Hello, I'm working on a Heroes of Might and Magic project right now (awesome game by the way), and I'm currently in a bind mentally for how to create movement for heroes on the world map and creatures on the battle screen.

So first, it's a turn based game of course. Your hero has a movement speed (how -far- they can move), and your hero's army creatures have their own speed values, too. This speed controls when they move in combat -and- how far they can move.

The problem is I can't think of a good way to replicate this system in a real time game. You can also move in any direction (unlike Heroes III, where it's generally 8 directions, and then combat is a hexboard) and you can end your turn at anywhere in between your starting location and your maximum distance.

I really have no idea how to start tracking this kind of thing or how to detect their movement in order to decrease it.

I will +rep anyone who's willing to contribute to my brainstorming, thanks for reading

~Clov

#### Lord_JiangWei

Level 5
Maybe make all units movement speed and 0 and then they have an ability that increases their movement speed for x amount of seconds, in which there "turn" would be over. For when they move perhaps mana could be a factor in that i.e. unit uses above mentioned spell for movement which drains all their mana and that unit will replenish it with mana replenish rate. The faster the rate the faster they can have their "turn" again.

#### Shyster

Level 9
Hey thanks a lot for the input, that has helped me greatly.

+rep Ty

#### rulerofiron99

Level 25
For a true "turn" effect, you'll probably want to count how many spaces a unit moves before disabling its movement.

For the battle itself, there's a little trick you can do to make units only move to the "grid" points - capture its X position, divide by 128, convert to integer, convert back to real, multiply by 128.

#### Lord_JiangWei

Level 5
Or maybe use blink ability and no movement

#### Aeroblyctos

Level 37
Or simply use pause / unpause. I would probably use that mechanism.

#### Shyster

Level 9
For a true "turn" effect, you'll probably want to count how many spaces a unit moves before disabling its movement.

For the battle itself, there's a little trick you can do to make units only move to the "grid" points - capture its X position, divide by 128, convert to integer, convert back to real, multiply by 128.

Edit: Oops forgot to include this one derp

The only thing I'd say about this is that if I use grid tracking then it might limit how well they can move (I'm wanting to take advantage of the freedom to move outside the chess board style, but still keeping the speed values from the chess board style game)

Or maybe use blink ability and no movement

This seems like it'd be the easiest way, the only problem I forsee is that it'd only be good for flying units (Angels and dragons for instance) because they can ignore obstacles like other enemies, but land units such as a crusader need to be blocked physically by them.

I don't know if I could make them attack at the same time as blinking, either. Because in Heroes III you can move next to an enemy but that doesn't force you to attack him, you could just be blocking his movement or protecting one other. Maybe two blinks, an attack where he picks all units in 100 range and another where it's strictly for movement? That doesn't solve the first issue though..

Or simply use pause / unpause. I would probably use that mechanism.

Could you throw a few more details at me for some inspiration on this one?

--

Thanks all you guys for helping, I really appreciate it! Will try and rep everyone (if it lets me).

#### rulerofiron99

Level 25
<start of turn>
unpause all units

<unit ordered to move>
looping trigger to check distance travelled
if distance >= custom movement variable, pause unit & change vertex colouring to 50,50,50

#### Shyster

Level 9
<start of turn>
unpause all units

<unit ordered to move>
looping trigger to check distance travelled
if distance >= custom movement variable, pause unit & change vertex colouring to 50,50,50

I will mess around with this and see if I can get it to work. Thanks

Status
Not open for further replies.

Replies
3
Views
582
Replies
5
Views
1K
Replies
8
Views
1K
Replies
2
Views
943
Replies
0
Views
486