Sacrificial Platforms

The Problem: How to create a universal movement system that can be applied to any character? (2D Platformer, Movement, Jump, Platformer, 2D)

To create this game I wanted to make the movement and the touch mechanic feel smooth. After playtesting the game, I got feedback that I had to change my layout, instead of tapping on the right and left of the screen to move the selected player around and double tapping to make the player/vessel jump, I had to add a button based layout. I created a logic that toggles two booleans that indicate if the button is being pressed or not. And since the jump happens when the button is pressed once then the function sets the animator and adds the force upward.

In the update function, I added this two if statements they will basically move the selected player or vessel. Depending on the selected player or vessel's velocity it will add force. Lastly, the selected player or vessel will check if his movement is left or right changing its animator state (sprite, so that he faces the right direction).

Player & Vessel Selection

The Problem: How to create a selection system based on mouse collision? (Selection system, Mouse collision, Player selection)

To solve this problem I had to use the Input.touches array. Whenever the touchCount was 1, I would Raycast the tap to check if it collides with any of the colliders (player, or the other vessels). If it collided with one of the colliders then it makes the variable whatSelected equal to the GameObject of the vessel or player. And as you can see in the movement script it will check what GameObject is selected.