Crouching!
#2 in the player movement chronicles!
Surprisingly, I also managed to create a whole new 5 animations! slide, crouch idle, crouch walk, and the sledge versions (not slide cause ya can’t sprint with sledge). I implemented all but the slide, which’ll take a long time, so I’m going to keep it off a bit. This was really straight forward to add, and for the first time in a long time, i had like only 1 problem
. I really just had a piece of code that asks, “did ya click the crouch button?” and if so, it toggles crouch. IF (and only if!) the crouch is on (or “true”) the idle and walk animations are switched to their respective crouch variants, and the normal player hitbox is replaced by a shorter-er-est one.
To bar the player from un-crouching in the midst of a tunnel, I added 2 new raycasts to the front and back of the players head facing up, these casts detect if there is a block above the player, and if either one of them detects anything, the player is unable to un-crouch until they are unshielded. Another quick thing I had to fix a bit was the raycasts detecting the player, which broke EVERYTHING
so I just turned good ’ol collision mask/layer 20 into the super-cool (ALL-NEW
!!) “player raycast collision!!!” which just only lets them interact with the floor and boxes, so yippee
NEXT STEPeths!:
-slide ):
-enemy lunge
-other player attacks (only hard attack right now which is bad)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.