summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/characters/base_character/BaseCharacter.gd7
-rw-r--r--assets/weapons/goo_gun/Bullet.gd6
-rw-r--r--assets/weapons/goo_gun/GooGun.gd2
3 files changed, 15 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))
diff --git a/assets/weapons/goo_gun/Bullet.gd b/assets/weapons/goo_gun/Bullet.gd
index 1a4c01a..2edba6b 100644
--- a/assets/weapons/goo_gun/Bullet.gd
+++ b/assets/weapons/goo_gun/Bullet.gd
@@ -1,4 +1,10 @@
extends RigidBody
+export var material : Material = null
+
+func _ready():
+ if material != null:
+ $MeshInstance.set("material/0", material)
+
func _on_Bullet_body_entered(_body):
queue_free()
diff --git a/assets/weapons/goo_gun/GooGun.gd b/assets/weapons/goo_gun/GooGun.gd
index 6a6758d..6cb87fc 100644
--- a/assets/weapons/goo_gun/GooGun.gd
+++ b/assets/weapons/goo_gun/GooGun.gd
@@ -2,6 +2,7 @@ extends Spatial
export var is_firing = false
export var fire_rate = 0.075
+export var projectile_material : Material = null
export var projectile_spread = 0 #TODO
export var projectile_scalar = 40
export var look_angle = 0
@@ -22,6 +23,7 @@ func _physics_process(delta):
func do_fire_projectile():
var bullet = Bullet.instance()
+ bullet.material = projectile_material
$Nozzle.add_child(bullet)
bullet.set_as_toplevel(true)
var shoot_direction = Vector3.FORWARD.rotated(Vector3.LEFT, weapon_pitch)