My journey becoming a Unity game developer: Player movement setup for Galaxy Invaders game-pt.3

Player moving with boundaries included.
Finding the boundaries for the Player to be restricted to.
Using pseudo code to figure out the Player’s boundary on the Y-axis.
2 Y-axis codes that won’t work.
Player movements snap back to zero on the Y-axis when finished moving.
Player able to move along the X-axis, but restricted moving up to zero on the Y-axis.
Player moving along the X-axis, but restricted on the Y.
Player restricted from moving beyond zero up and -3.8f down on the Y-axis.
Player moving with limitations on the Y-axis.
Player able to move off one side of the screen and reappear on the other side of the screen.
Player moving off one side of the screen and reappearing on the other side of the screen.
Placed all the code in Update() into a new method named PlayerMovement().
Refactored the Player’s X-axis movement code using Mathf.Clamp() method.
Player’s movement working on the X-axis using the Mathf.Clamp() method.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store