Neiva programming blog 3
|
I’ve been programming the main player character. That includes movement, jumping, groundchecking, health, sticking to platforms and physics… At the beginning I create one whole Unity script that handled all that, till reacently when we had to change from Unity’s 2D physics to 3D physics. I split up the script to mulitple scripts/components that handled specific tasks.
The picture above is before separated components. The picture under is after, with separated components.
This approach has led to more reusable code because you got all things separated. For example, the Groundchecker-script handles ground checking for different slopes and such and can be used for other parts of the game, like AI enemies and more. |

