Beginner Question - Script - left click to move. right click to attack


Absolute beginner here.

I have an assignment to make a single screen 2D game.

My game has a lumberjack walking around a fixed screen with bad guys spawning.

I have idle, walk and attack sprite animations.

Need a player controller script (prefer a tutorial).

Psuedo Code:

Lumberjack starts at idle animation.

On left mouse click lumberjack switches to walk animation, turns in clicked direction and moves to the clicked position.

On right mouse click lumberjack switches to attack animation(cycles once) and turns in the clicked direction.

If lumberjack has attacked in range of enemy produce blood particle effect from enemy and enemy dies.

Can anyone direct me to a resource that could teach me to write this script ?

Thanks in advance.


That’s quite a lot. It’s like a whole project being asked. My suggestion is for you to run thru unity tutorials first.

Check these tutorials specifically for 2d platform.

Thanks for the advice @Kilsnus.
I’ve been doing a few tutorials. Most of them have a level of assumed knowledge beyond mine.
The resources you linked look good. Thanks heaps.