diff options
author | Malfurious <m@lfurio.us> | 2022-07-22 03:41:41 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2022-07-22 03:41:41 -0400 |
commit | 1f534358c264560662793ff72bfcc57d3d155b5b (patch) | |
tree | 31454d68d393d7e14898cb34f04541900857ffcd /assets/view_model/ViewModel.gd | |
parent | 3e8167c43cc312a814f6e899d08c18b7155d710a (diff) | |
download | project-s-1f534358c264560662793ff72bfcc57d3d155b5b.tar.gz project-s-1f534358c264560662793ff72bfcc57d3d155b5b.zip |
Implement Goo Gun primary fire
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'assets/view_model/ViewModel.gd')
-rw-r--r-- | assets/view_model/ViewModel.gd | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/assets/view_model/ViewModel.gd b/assets/view_model/ViewModel.gd index 7d5ce70..1c29a0e 100644 --- a/assets/view_model/ViewModel.gd +++ b/assets/view_model/ViewModel.gd @@ -46,10 +46,20 @@ func _physics_process(delta): # Move character. Param 4 (true) means stop on slopes velocity = character.move_and_slide_with_snap(velocity, snap, Vector3.UP, true) + # Update character look direction to face towards aiming if firing + if Input.is_action_pressed("fire"): + character.look_angle = spring_arm.rotation.y + character.weapon_pitch = -spring_arm.rotation.x # Update character look direction if moved - if move_direction.length() > 0.2: + elif move_direction.length() > 0.2: var look_direction = Vector2(-velocity.z, -velocity.x) - character.rotation.y = look_direction.angle() + character.look_angle = look_direction.angle() + character.weapon_pitch = 0 + else: + character.weapon_pitch = 0 + + # Handle extra player inputs + character.is_firing = Input.is_action_pressed("fire") func _unhandled_input(event): # Implement mouse aim direction |