- Home /
Best practice when creating character / player control scripts?
I have a 2D top down game. My main character has an animator with 2D sprite sheet animations. I want to control the following things:
Player movement
Player attacks
Player blocking
Control player animations
Player damage / health
I tried making separate scripts for separate mechanics. But when doing this, I got a little confused as to what script should control what when one mechanics uses another or has to block another mechanic.
Ex. When attacking the player should move forward to the direction they're attacking, using the shield and player input movement should be disabled.
How do I manage all of this, do I move the player with the attack script or the movement script?
Are there any known practices for this, maybe some guides or tutorials?
Answer by SirCrazyNugget · Jun 15, 2021 at 03:48 PM
The Tanks tutorial and Dragon Crashers projects from Unity will get you going in the right direction.
Answer by liquidsolder · Jun 16, 2021 at 01:15 AM
check out Barden channel on YT has a great tutorial on state machine for a platformer that could be used for what your doing with a few modifications.