-
Notifications
You must be signed in to change notification settings - Fork 2
/
Bat.tscn
149 lines (114 loc) · 4.16 KB
/
Bat.tscn
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
[gd_scene load_steps=19 format=2]
[ext_resource path="res://Sprites/Enemies/Bat.png" type="Texture" id=1]
[ext_resource path="res://Sprites/Misc/SmallShadow.png" type="Texture" id=2]
[ext_resource path="res://SoftCollision.tscn" type="PackedScene" id=3]
[ext_resource path="res://Bat.gd" type="Script" id=4]
[ext_resource path="res://Hurtbox.tscn" type="PackedScene" id=5]
[ext_resource path="res://PlayerDetectionZone.tscn" type="PackedScene" id=6]
[ext_resource path="res://Hitbox.tscn" type="PackedScene" id=7]
[ext_resource path="res://Stats.tscn" type="PackedScene" id=8]
[ext_resource path="res://Shader.tres" type="Shader" id=9]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 9 )
shader_param/active = false
[sub_resource type="CircleShape2D" id=2]
radius = 6.0
[sub_resource type="Animation" id=3]
length = 0.5
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 4 ]
}
[sub_resource type="CircleShape2D" id=4]
radius = 4.0
[sub_resource type="CapsuleShape2D" id=5]
radius = 6.0
height = 6.0
[sub_resource type="CircleShape2D" id=6]
radius = 80.0
[sub_resource type="GDScript" id=7]
script/source = "extends Node2D
onready var start_position = global_position
onready var target_position = global_position setget ,get_target_position
func get_target_position():
return target_position
func update_target_position():
var target_vector = Vector2(rand_range(-32, 32), rand_range(-32, 32))
target_position = start_position + target_vector
func _on_StateTimer_timeout():
update_target_position()
"
[sub_resource type="CircleShape2D" id=8]
radius = 4.0
[sub_resource type="Animation" id=9]
resource_name = "Hit"
length = 0.3
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:material:shader_param/active")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ true, false, true, false ]
}
[node name="Bat" type="KinematicBody2D"]
collision_layer = 16
collision_mask = 2
script = ExtResource( 4 )
[node name="Stats" parent="." instance=ExtResource( 8 )]
max_health = 3
[node name="Sprite" type="Sprite" parent="."]
material = SubResource( 1 )
texture = ExtResource( 1 )
offset = Vector2( 0, -12 )
hframes = 5
[node name="ShadowSprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Fly"
anims/Fly = SubResource( 3 )
[node name="SoftCollision" parent="." instance=ExtResource( 3 )]
[node name="CollisionShape2D" parent="SoftCollision" index="0"]
shape = SubResource( 4 )
[node name="Hurtbox" parent="." instance=ExtResource( 5 )]
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2( 0, -13 )
shape = SubResource( 5 )
[node name="PlayerDetectionZone" parent="." instance=ExtResource( 6 )]
position = Vector2( 0, -13 )
[node name="CollisionShape2D" parent="PlayerDetectionZone" index="0"]
shape = SubResource( 6 )
[node name="StateTimer" type="Timer" parent="."]
one_shot = true
autostart = true
[node name="WanderController" type="Node2D" parent="."]
script = SubResource( 7 )
[node name="Hitbox" parent="." instance=ExtResource( 7 )]
collision_mask = 4
[node name="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2( 0, -16 )
shape = SubResource( 8 )
[node name="HitAnimationPlayer" type="AnimationPlayer" parent="."]
anims/Hit = SubResource( 9 )
[connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="timeout" from="StateTimer" to="WanderController" method="_on_StateTimer_timeout"]
[editable path="SoftCollision"]
[editable path="Hurtbox"]
[editable path="PlayerDetectionZone"]
[editable path="Hitbox"]