diff options
author | Malfurious <m@lfurio.us> | 2022-07-22 05:26:34 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2022-07-22 05:26:34 -0400 |
commit | 44e739bb05542d1249ccf8388bd15b3f0b052e0c (patch) | |
tree | 42a67300e8e2ebcbd9868e6af1f7e992b285c3c6 /assets/view_model/ViewModel.gd | |
parent | 4a9ff23bb13bfe5c182222fdb4314afc4f5c1fa8 (diff) | |
parent | ea3ecd73dab3e0e06bb145b38e8258b9dd02abcb (diff) | |
download | project-s-44e739bb05542d1249ccf8388bd15b3f0b052e0c.tar.gz project-s-44e739bb05542d1249ccf8388bd15b3f0b052e0c.zip |
Merge branch 'weapon-behavior'
Implements the basics for the Goo Gun primary fire
* weapon-behavior:
Despawn bullets on collision with another physics body
Tweak Goo Gun bullet physics to better mimic reference weapon
Implement Goo Gun primary fire
Add bullet / ink pellet object for Goo Gun
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 |