-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayload.gd
77 lines (47 loc) · 1.35 KB
/
payload.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
extends RigidBody2D
var health = 100
var next_waypoint_ref : WeakRef
func _ready():
$animated_sprite.play()
add_to_group("inferno_heart")
add_to_group("game_over")
add_to_group("abilities")
add_to_group("goal")
update_abilities()
func update_abilities():
if global.abilities["payload_speed"]["active"]:
$movement.max_speed = 400
func _integrate_forces(state):
$movement.do_movement(state)
func _process(delta):
# burning aura
if global.abilities["burning_aura"]["active"]:
for body in $burning_aura.get_overlapping_bodies():
if body.has_method("burn"):
body.burn(delta)
func goal():
$animation_player.play("fade_out")
$collision_shape_2d.disabled = true
$krakow.play()
yield(get_tree().create_timer(1.5), "timeout")
$fanfare.play()
func get_intended_direction():
var direction = Vector2()
if next_waypoint_ref and next_waypoint_ref.get_ref():
direction = next_waypoint_ref.get_ref().global_position - global_position
return direction
func _on_waypoint_aggro_aggro(entity):
next_waypoint_ref = weakref(entity)
func triggers_aggro():
return true
func hit_by_small_red_sword():
if global.abilities["payload_armor"]["active"]:
global.player_health -= 0.5
else:
global.player_health -= 1
$ouch.play()
$heart_ouch.play()
func on_screen():
return $visibility_notifier_2d.is_on_screen()
func game_over():
queue_free()