Devlog - Player Movement


Devlog – Player Movement

 

The focus of this Devlog is to talk about the player movement. In a match-3 game, there is limited player movement which involves clicking on a tile or position and dragging that tile in a direction to indicate the direction that you would like to swap it. The game does the rest of the job of matching tiles and collapsing the columns.  In this version of the game, I achieved this by the measuring two positions in the game, the position where the mouse is pressed down and the position of where the mouse is let up. It then does a trigonometric calculation to work out what they angle of the drag was. Depending on the angle, it will swap the selected tile with the one up, down, left or right of it (Figure 1). 

Figure 1. Tiles being swapped.

 

Feedback

Feedback received at this moment in the game’s development indicated that there was a need for there to be some sort of animation for the tiles swapping with each other rather than them appearing at each other’s positions (Figure 1). This was achieved by adding a “lerp” function into the program which will move the selected game object x distance of y amount of time until it reaches it destination (Figure 2).  

Figure 2. Tiles being swapped with animation.

 

There was also a bug in the game where if you clicked on a tile, e.g. you did not make an effort to move left or right, it would count it as a right move. This occurred in the game because the angle calculated from clicking in the same position was 0 (directly right) and an angle from 45 to -45 is counted as a right move. To overcome this problem, a distance requirement was added in order for a move to be recognized. So that if the distance between the two mouse points (down and up) are greater than 0, it counts as a move.

 

 

Files

Build 28.4.21 v1.zip 4.4 MB
Apr 28, 2021
Build29.4.21 v1.zip 4.4 MB
Apr 29, 2021
Build3.5.21 v1.zip 4.4 MB
May 03, 2021
Build 4.5.21.zip 4.4 MB
May 04, 2021
Build 6.5.21 v1.zip 4.4 MB
May 05, 2021
Build 6.5.21 v2.zip 4.5 MB
May 05, 2021

Leave a comment

Log in with itch.io to leave a comment.