How do I get the "PlayerPawn" to keep moving?

How do I get the PlayerPawn to “keepmoving” after the keepmoving button is pressed?

Basically I am trying to move a playerpawn on a board like a board game. Each tile is detecting how many steps are left, and if the tile has an event attached to it or not.

The coding works with “LogicTile2” just fine, but when it gets to “LogicTile3”, and I hit a button to change the gamestate to “Moving” again, for some reason the pawn only moves 1 frame then stops.

See below for my event script:

I thought it may be that the collision with LogicTile3 is being set off again, thereby stopping the playerpawn, so I tried deleting logictile3 in it’s own action, and the same results - the playerpawn still only moves one frame when the button is pressed.

Thank you in advance for any help.

Okay, I figured it out - change the force from instant to permanent. But it now poses a smaller problem. The first move is very fast, then the subsequent moves are the desired speed. Any ideas?

You’ve fixed a symptom, but not the problem.

When GameState is “Moving” and there are step remaining, the force is applied. And when you apply a permanent force repeatedly, it compounds. When you apply an instant force, it applies it just for the game frame.

So, change the apply force back to instant, because it’s not the issue.


The issue is PawnPosition doesn’t change when moving again.:

Event 1 sets PawnPosition to 3 - but it’s not changed anywhere else.

Events 2 & 3 change GameState to “Peek or End” or “BargeOrMove”.

Event 4 changes GameState to “Moving” when the button is clicked.

Because PawnPosition hasn’t changed in event 4, events 2 & 3 will again be triggered (and change GameState).

1 Like

Ah, I see! Thank you for the detailed response and now it works perfectly. I had the pawn position change on every collision with the LogicTiles, but now when the “keepmoving” button is hit, I have it as 3.5 or 4.5, depending where it is, and it works great.

I understand why it sped up with the permanent force too now, thank you again.

I don’t know what the board looks like but the linked object tools behavior might also help.

https://wiki.gdevelop.io/gdevelop5/extensions/link-tools/

1 Like

There are many different boards, and they are pretty similar to the classic Monopoly or snakes and ladders (in terms of layout).

Your suggestion may be exactly what I need, I’ll have a look into it in the near future.

1 Like