summaryrefslogtreecommitdiffstats
path: root/assets/characters/base_character/BaseCharacter.gd
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-07-22 03:41:41 -0400
committerMalfurious <m@lfurio.us>2022-07-22 03:41:41 -0400
commit1f534358c264560662793ff72bfcc57d3d155b5b (patch)
tree31454d68d393d7e14898cb34f04541900857ffcd /assets/characters/base_character/BaseCharacter.gd
parent3e8167c43cc312a814f6e899d08c18b7155d710a (diff)
downloadproject-s-1f534358c264560662793ff72bfcc57d3d155b5b.tar.gz
project-s-1f534358c264560662793ff72bfcc57d3d155b5b.zip
Implement Goo Gun primary fire
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'assets/characters/base_character/BaseCharacter.gd')
-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