aboutsummaryrefslogtreecommitdiff
path: root/riot/angrydev.gd
diff options
context:
space:
mode:
Diffstat (limited to 'riot/angrydev.gd')
-rw-r--r--riot/angrydev.gd16
1 files changed, 14 insertions, 2 deletions
diff --git a/riot/angrydev.gd b/riot/angrydev.gd
index 5e79141..580de32 100644
--- a/riot/angrydev.gd
+++ b/riot/angrydev.gd
@@ -1,4 +1,4 @@
-extends Node2D
+extends Ticked
class_name AngryDev
var min_pitchfork_rotation : float = -15.0
@@ -8,12 +8,22 @@ var target: Manager = null
var total_tick = 0.0
export var speed : float = 100.0
onready var pitchfork : Sprite = $pitchfork
+onready var body : Sprite = $body
+export (Texture) var laser_pitchfork_texture: Texture = null
+var laser = false
+func _ready():
+ if SaveState.has_upgrade("sunglasses"):
+ laser = true
+ pitchfork.texture = laser_pitchfork_texture
func interpolate(a, b, progress):
return a + (b-a) * progress
func _process(delta : float) -> void:
+ if laser:
+ pitchfork.rotation = get_angle_to(target.position) + PI / 2
+ return
total_tick += delta
var normalized_progress = (sin(total_tick * rotation_speed) + 1.0) / 2.0
var rot = interpolate(min_pitchfork_rotation, max_pitchfork_rotation, normalized_progress)
@@ -21,7 +31,9 @@ func _process(delta : float) -> void:
func _physics_process(delta: float) -> void:
- var normalized_move = (target.position - position).normalized()
+ if laser:
+ return
+ var normalized_move = (target.position - body.position).normalized()
position += normalized_move * delta * speed