Adds enemies
This commit is contained in:
parent
cf8ba8bacb
commit
76e5b1927f
324 changed files with 28447 additions and 106 deletions
|
|
@ -12,7 +12,9 @@ static var Instance: Player;
|
|||
|
||||
@onready var animationtree: AnimationTree = $CollisionShape3D/Camera3D/Weapon/AnimationPlayer/AnimationTree
|
||||
@onready var collisionShape: CollisionShape3D = $CollisionShape3D
|
||||
@onready var health: Health = $Health
|
||||
|
||||
const CROUCHED_SPEED: float = 2.5
|
||||
const SPEED: float = 5.0
|
||||
const SPRINT_SPEED: float = 10.0
|
||||
const FALLOFF_SPEED: float = 0.5
|
||||
|
|
@ -54,6 +56,8 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
if PlayerState == PlayerStates.SPRINTING:
|
||||
speed = SPRINT_SPEED
|
||||
if PlayerState == PlayerStates.CROUCHING:
|
||||
speed = CROUCHED_SPEED
|
||||
|
||||
if direction:
|
||||
velocity.x = direction.x * speed
|
||||
|
|
@ -67,13 +71,16 @@ func _physics_process(delta: float) -> void:
|
|||
if self.PlayerState == PlayerStates.SPRINTING:
|
||||
input_dir.y *= 2
|
||||
|
||||
var blendProperty = 'parameters/Movement/blend_position'
|
||||
var blendProperty = 'parameters/Movement/0/blend_position'
|
||||
if PlayerState == PlayerStates.CROUCHING:
|
||||
blendProperty = 'parameters/Crouched Movement/blend_position'
|
||||
|
||||
lastDirection.x = move_toward(lastDirection.x, input_dir.x, 0.05);
|
||||
lastDirection.y = move_toward(lastDirection.y, input_dir.y, 0.05);
|
||||
animationtree.set(blendProperty, lastDirection);
|
||||
var yLeft = clamp(lastDirection.y - 1, 0, 1);
|
||||
animationtree.set('parameters/Movement/blend_position', yLeft)
|
||||
var yRemainder = Vector2(lastDirection.x, clamp(lastDirection.y, 0, 1));
|
||||
animationtree.set(blendProperty, yRemainder);
|
||||
|
||||
func handleCrouching():
|
||||
if Input.is_action_just_pressed('player_crouching'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue