summaryrefslogtreecommitdiffstats
path: root/assets/characters/base_character/BaseCharacter.gd
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-07-22 05:26:34 -0400
committerMalfurious <m@lfurio.us>2022-07-22 05:26:34 -0400
commit44e739bb05542d1249ccf8388bd15b3f0b052e0c (patch)
tree42a67300e8e2ebcbd9868e6af1f7e992b285c3c6 /assets/characters/base_character/BaseCharacter.gd
parent4a9ff23bb13bfe5c182222fdb4314afc4f5c1fa8 (diff)
parentea3ecd73dab3e0e06bb145b38e8258b9dd02abcb (diff)
downloadproject-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 '')
-rw-r--r--assets/characters/base_character/BaseCharacter.gd15
1 files changed, 15 insertions, 0 deletions
diff --git a/assets/characters/base_character/BaseCharacter.gd b/assets/characters/base_character/BaseCharacter.gd
new file mode 100644
index 0000000..bcc0f26
--- /dev/null
+++ b/assets/characters/base_character/BaseCharacter.gd
@@ -0,0 +1,15 @@
+extends KinematicBody
+
+export var is_firing = false
+export var look_angle = 0
+export var weapon_pitch = 0
+export var weapon_pitch_bias = deg2rad(20)
+
+func _process(_delta):
+ var effective_weapon_pitch = weapon_pitch - weapon_pitch_bias if is_firing else weapon_pitch
+ effective_weapon_pitch = clamp(effective_weapon_pitch, deg2rad(-90), deg2rad(90))
+ $GooGun.is_firing = is_firing
+ $GooGun.look_angle = look_angle
+ $GooGun.weapon_pitch = effective_weapon_pitch
+ $GooGun.rotation.x = effective_weapon_pitch
+ rotation.y = look_angle