summaryrefslogtreecommitdiffstats
path: root/assets/characters/base_character
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-09-12 01:57:57 -0400
committerMalfurious <m@lfurio.us>2022-09-12 01:57:57 -0400
commitf44398ea774c171d9aa0f274f603101c7a1186b9 (patch)
tree4d585c65bda38f643d4a4924ea6757c478509936 /assets/characters/base_character
parent85cf10772c6bc1390e9dfb07dddd6e204b856340 (diff)
downloadproject-s-f44398ea774c171d9aa0f274f603101c7a1186b9.tar.gz
project-s-f44398ea774c171d9aa0f274f603101c7a1186b9.zip
Allow dynamic character material
This will enable selection between the friendly (default) and enemy material to apply to any given player model for prototyping purposes. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'assets/characters/base_character')
-rw-r--r--assets/characters/base_character/BaseCharacter.gd7
1 files changed, 7 insertions, 0 deletions
diff --git a/assets/characters/base_character/BaseCharacter.gd b/assets/characters/base_character/BaseCharacter.gd
index bcc0f26..5d1b013 100644
--- a/assets/characters/base_character/BaseCharacter.gd
+++ b/assets/characters/base_character/BaseCharacter.gd
@@ -1,10 +1,17 @@
extends KinematicBody
+export var material : Material = null
export var is_firing = false
export var look_angle = 0
export var weapon_pitch = 0
export var weapon_pitch_bias = deg2rad(20)
+func _ready():
+ look_angle = rotation.y
+ if material != null:
+ $Body.set("material/0", material)
+ $GooGun.projectile_material = material
+
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))