Player Movement


 Basic movement:

Controls are: WASD for basic 8 way movement. Left click to attack enemies when in range. 

The movement uploaded is pretty much the final product. The speed is a good speed, the animations work in the moving and idle states, and it's easy to control. The plans for controls beyond these are: Shooting a projectile with right click, interacting with items with the E key, and opening menus with UI buttons. 

This scene in the game is the "forest" scene, with custom made tilemap and sprites by yours truly ;)



Testing/Feedback 

Movement: 

  • The movement is at a good speed. 
  • Movement works well and so does collision, love that it is animated!
  • Movement feels good, maybe a tinge fast? 
  • Feels good to control

I feel like since the player is a little kid it makes sense if he's running around the forest a bit quicker, I'm happy with the speed.

Attack: 

  • Adding an attack animation at some stage would make it clear that the click is being registered.  
  • The attack system worked, occasionally it would attack enemies above the player when looking left/right instead of up. 
  • An attack animation or something to indicate that it has occurred would be nice
  •  The range at which you can hit an enemy is a bit long feeling? Maybe it'll feel better with animation showing it.
  •  The colliders are a bit dodgy but i imagine having the enemies move will involve fixing that.
  • Overly large range on the unanimated attack

The plan for the weapon system is to deter you from using your sword since enemies can damage you back, instead get you to use your bow, but i'm considering also giving them little health bars and making weapons do different damage. 

I  think the attack range is reasonable since usually you wont notice if they are a bit extra far away since they will be moving towards you. The shadowman also has a hitbox that extends his body since his left/right movement is more hunched and he reaches out further. If I can change the collider size for different animations then I might look into that as well.

Visual issue: 

  • Another thing I noticed is that after making small movements and then stopping, it would seem like a ripple would go through the pixels on the screen.  Don’t know whether this is just on my end but it was a bit of a weird visual effect.

Multiple people pointed it out, I have since fixed the issue with the help of Ethan with a link to a Video. This issue was due to the damping on the cinemachine camera slowing down enough to pan across pixels and cause  ripple-like effect as the actual screen pixels changed colour.

Visuals in general: 

  • Has a nice art style going on
  • Blood would be cooler if it could pool on the ground

I made Lindsay late for his thing because I was fiddling with particle systems :)  I made the blood look way cooler with his help, made it look as if it were landing on the ground rather than just falling weirdly by having the y velocity change to 0 with time.


Plans checklist: 

  • An attack effect that plays every time you swipe your sword (because I don't know how to animate it well) [WIP]
  • Enemies will always be moving towards the player rather than just being a rigidbody floating in space [NOT STARTED]
  • Fix the screen tearing [DONE]
  • Health bars [DONE]
  • Bow and arrows implementation [NOT STARTED]


Implementation

The 8-way movement essentially just takes input from getkeydown(w, a, s, d) and assigns a -1 to 0 to 1 to the x-speed and y-speed variables. The rigidbody is given a force based on these, and the animator is updated based on them as well to make sure the different movement animations line up. 


The player has an invisible trigger collider object attatched to them that detects on every update() whether they are colliding with an enemy with onTriggerStay(). there is an if() statement inside which detects IF the collision is type enemy AND if input.getmousekeydown(0) is true.

The previous version of this code just instantiated the blood particle effect and destroyed the enemy game object. 

The next version passes a float 'damage' to the enemy object with a method to decrease their health. This allows for different weapons to do different damages, and for difficulties to be set (IN FUTURE IF WANTED). 

As well as this, I included a health bar script on a rectangle sprite that on Update() gets the health of the enemy and sets the rectangle's transform's X scale to a factor of the health. That way if the health goes down, the heath bar gets smaller. This was with the help of this Video

Note that this video says to create a public static variable, but when I did this , all instances of the enemy bat prefab would have the same global health value , and attacking one would decrease the bar for EVERYONE. I fixed this by setting a public GameObject at the start of the script and linking it to the parent object in the prefab, this allowed me to just grab the health float.



The background is a tilemap of tiles I drew myself, randomly picked from a pallete of 8 for the main 'middle' section, and then every edge has 2 variants that are randomly placed. The corners do not have proper sprites yet as there is going to be a big bush overlay on top of each corner to hide the enemy spawners in each corner. 

Files

Build3.zip 8.2 MB
Sep 09, 2021

Leave a comment

Log in with itch.io to leave a comment.