Compare commits
2 Commits
701b705db5
...
547e0f449e
Author | SHA1 | Date |
---|---|---|
Just Dzhi | 547e0f449e | |
Just Dzhi | e78fee0e21 |
|
@ -13,7 +13,8 @@ script = ExtResource( 2 )
|
||||||
[node name="Sprite" type="AnimatedSprite" parent="."]
|
[node name="Sprite" type="AnimatedSprite" parent="."]
|
||||||
position = Vector2( 3, 0 )
|
position = Vector2( 3, 0 )
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "rolling"
|
animation = "spawn"
|
||||||
|
frame = 6
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
[node name="EnemyCollider" type="Area2D" parent="."]
|
[node name="EnemyCollider" type="Area2D" parent="."]
|
||||||
|
@ -21,3 +22,11 @@ playing = true
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyCollider"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyCollider"]
|
||||||
position = Vector2( 3.5, 5 )
|
position = Vector2( 3.5, 5 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="Spawn_Animation_Start" type="Timer" parent="."]
|
||||||
|
wait_time = 0.5
|
||||||
|
one_shot = true
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="Sprite" to="." method="_on_sprite_animation_finished"]
|
||||||
|
[connection signal="timeout" from="Spawn_Animation_Start" to="." method="_on_Spawn_Animation_Start_timeout"]
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 919 B |
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/spawn.png-cd75f3f5bf1649bb857c394b2ea0cfad.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/models/enemies/trash_can/sprites/spawn.png"
|
||||||
|
dest_files=[ "res://.import/spawn.png-cd75f3f5bf1649bb857c394b2ea0cfad.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=false
|
||||||
|
svg/scale=1.0
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_resource type="SpriteFrames" load_steps=6 format=2]
|
[gd_resource type="SpriteFrames" load_steps=14 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/models/enemies/trash_can/sprites/rolling.png" type="Texture" id=1]
|
[ext_resource path="res://src/models/enemies/trash_can/sprites/rolling.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://src/models/enemies/trash_can/sprites/spawn.png" type="Texture" id=2]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=1]
|
[sub_resource type="AtlasTexture" id=1]
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 1 )
|
||||||
|
@ -18,10 +19,43 @@ region = Rect2( 44, 0, 22, 24 )
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 66, 0, 22, 24 )
|
region = Rect2( 66, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=5]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 0, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 22, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=7]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 44, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=8]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 66, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=9]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 88, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=10]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 110, 0, 22, 24 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=11]
|
||||||
|
atlas = ExtResource( 2 )
|
||||||
|
region = Rect2( 132, 0, 22, 24 )
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
|
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "rolling",
|
"name": "rolling",
|
||||||
"speed": 16.0
|
"speed": 16.0
|
||||||
|
}, {
|
||||||
|
"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "spawn",
|
||||||
|
"speed": 12.0
|
||||||
} ]
|
} ]
|
||||||
|
|
|
@ -24,7 +24,7 @@ func _ready():
|
||||||
movement_start = "top"
|
movement_start = "top"
|
||||||
randomize()
|
randomize()
|
||||||
global_position.x = randi()%248 + 40 # 320 - 12 - 40
|
global_position.x = randi()%248 + 40 # 320 - 12 - 40
|
||||||
global_position.y = -20
|
global_position.y = 4
|
||||||
|
|
||||||
path_sprite.texture = load("res://src/models/enemies/trash_can/sprites/path/vertical.png")
|
path_sprite.texture = load("res://src/models/enemies/trash_can/sprites/path/vertical.png")
|
||||||
path_sprite.global_position.y = 21
|
path_sprite.global_position.y = 21
|
||||||
|
@ -35,7 +35,7 @@ func _ready():
|
||||||
movement_start = ["left", "right"][randi()%2]
|
movement_start = ["left", "right"][randi()%2]
|
||||||
randomize()
|
randomize()
|
||||||
global_position.y = randi()%60 + 20
|
global_position.y = randi()%60 + 20
|
||||||
global_position.x = 360 if movement_start == "right" else -20
|
global_position.x = 310 if movement_start == "right" else 10
|
||||||
|
|
||||||
path_sprite.texture = load("res://src/models/enemies/trash_can/sprites/path/horizontal.png")
|
path_sprite.texture = load("res://src/models/enemies/trash_can/sprites/path/horizontal.png")
|
||||||
path_sprite.global_position.y = self.global_position.y
|
path_sprite.global_position.y = self.global_position.y
|
||||||
|
@ -54,8 +54,8 @@ func drop_trash():
|
||||||
get_parent().call_deferred("add_child", trash_drop)
|
get_parent().call_deferred("add_child", trash_drop)
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if start_timer < 2:
|
if start_timer < 1:
|
||||||
path_sprite.modulate.a = (2 - start_timer) / 2
|
path_sprite.modulate.a = (1 - start_timer) / 2
|
||||||
start_timer += delta
|
start_timer += delta
|
||||||
return
|
return
|
||||||
drop_timer += delta
|
drop_timer += delta
|
||||||
|
@ -89,3 +89,10 @@ func _physics_process(delta):
|
||||||
drop_trash()
|
drop_trash()
|
||||||
|
|
||||||
velocity = move_and_slide(velocity)
|
velocity = move_and_slide(velocity)
|
||||||
|
|
||||||
|
func _on_sprite_animation_finished():
|
||||||
|
if $Sprite.animation == "spawn":
|
||||||
|
$Sprite.play("rolling")
|
||||||
|
|
||||||
|
func _on_Spawn_Animation_Start_timeout():
|
||||||
|
$Sprite.play("spawn")
|
||||||
|
|
Loading…
Reference in New Issue