blob: 5d1b0132a1e028eed25d58f2bf6aa40e88208d91 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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))
$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
|