Compare commits
2 Commits
ef3e8e7938
...
e769494c00
Author | SHA1 | Date |
---|---|---|
Luna Brovchuk | e769494c00 | |
Luna Brovchuk | c140049cf7 |
|
@ -20,7 +20,7 @@ script = ExtResource( 2 )
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 3
|
frame = 1
|
||||||
playing = true
|
playing = true
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
[gd_resource type="SpriteFrames" load_steps=10 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/models/enemies/trash_can/sprites/path/horizontal_animation.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 0, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=3]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 11, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=4]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 22, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=5]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 33, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 44, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=7]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 55, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=8]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 66, 280, 11 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=9]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 77, 280, 11 )
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 7.0
|
||||||
|
} ]
|
|
@ -0,0 +1,41 @@
|
||||||
|
[gd_resource type="SpriteFrames" load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/models/enemies/trash_can/sprites/path/vertical_animation.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=1]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 0, 0, 11, 80 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 11, 0, 11, 80 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=3]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 22, 0, 11, 80 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=4]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 33, 0, 11, 80 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=5]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 44, 0, 11, 80 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
|
flags = 4
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 55, 0, 11, 80 )
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 4.0
|
||||||
|
} ]
|
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/horizontal_animation.png-677158bb797119f6efe195b3f0db9b77.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/models/enemies/trash_can/sprites/path/horizontal_animation.png"
|
||||||
|
dest_files=[ "res://.import/horizontal_animation.png-677158bb797119f6efe195b3f0db9b77.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
|
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/vertical_animation.png-beaba353508fb9af321ce76c797ad7f8.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/models/enemies/trash_can/sprites/path/vertical_animation.png"
|
||||||
|
dest_files=[ "res://.import/vertical_animation.png-beaba353508fb9af321ce76c797ad7f8.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
|
|
@ -10,43 +10,52 @@ var drop_timer = .0
|
||||||
var last_x
|
var last_x
|
||||||
var last_y
|
var last_y
|
||||||
|
|
||||||
|
var horizontal_path = load("res://src/models/enemies/trash_can/sprites/path/HorizontalTrashPath.tres")
|
||||||
|
var vertical_path = load("res://src/models/enemies/trash_can/sprites/path/VerticalTrashPath.tres")
|
||||||
var drop_preload = preload("res://src/models/enemies/trash_can/drop/TrashDrop.tscn")
|
var drop_preload = preload("res://src/models/enemies/trash_can/drop/TrashDrop.tscn")
|
||||||
var path_sprite = Sprite.new()
|
var path_sprite = AnimatedSprite.new()
|
||||||
|
|
||||||
var horizontal_speed = 160
|
var horizontal_speed = 160
|
||||||
var vertical_speed = 60
|
var vertical_speed = 60
|
||||||
|
|
||||||
|
func delete_path_sprite():
|
||||||
|
path_sprite.call_deferred("free")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
path_sprite.name = "trash_path"
|
path_sprite.name = "TrashPath"
|
||||||
|
path_sprite.centered = false
|
||||||
randomize()
|
randomize()
|
||||||
movement_type = ["horizontal", "vertical"][randi()%2]
|
movement_type = ["horizontal", "vertical"][randi()%2]
|
||||||
if movement_type == "vertical":
|
if movement_type == "vertical":
|
||||||
|
path_sprite.frames = vertical_path
|
||||||
|
path_sprite.flip_v = true
|
||||||
movement_start = "top"
|
movement_start = "top"
|
||||||
randomize()
|
randomize()
|
||||||
global_position.x = randi()%248 + 40 # 320 - 12 - 40
|
global_position.x = randi()%218 + 90 # 320 - 12 - 40
|
||||||
global_position.y = 4
|
global_position.y = 4
|
||||||
|
|
||||||
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
|
||||||
path_sprite.global_position.x = self.global_position.x
|
path_sprite.global_position.x = self.global_position.x
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
path_sprite.frames = horizontal_path
|
||||||
randomize()
|
randomize()
|
||||||
movement_start = ["left", "right"][randi()%2]
|
movement_start = ["left", "right"][randi()%2]
|
||||||
randomize()
|
randomize()
|
||||||
global_position.y = randi()%60 + 20
|
global_position.y = randi()%50 + 25
|
||||||
global_position.x = 310 if movement_start == "right" else 10
|
global_position.x = 310 if movement_start == "right" else 10
|
||||||
|
|
||||||
path_sprite.texture = load("res://src/models/enemies/trash_can/sprites/path/horizontal.png")
|
if movement_start == "left": path_sprite.flip_h = true
|
||||||
path_sprite.global_position.y = self.global_position.y
|
path_sprite.global_position.y = self.global_position.y
|
||||||
path_sprite.global_position.x = 26
|
path_sprite.global_position.x = 26
|
||||||
|
|
||||||
last_x = self.global_position.x
|
last_x = self.global_position.x
|
||||||
last_y = self.global_position.y
|
last_y = self.global_position.y
|
||||||
|
|
||||||
path_sprite.centered = false
|
|
||||||
path_sprite.modulate.a = 0.5
|
|
||||||
get_parent().call_deferred("add_child", path_sprite)
|
get_parent().call_deferred("add_child", path_sprite)
|
||||||
|
path_sprite.connect("animation_finished", self, "delete_path_sprite")
|
||||||
|
path_sprite.frame = 0
|
||||||
|
path_sprite.play("default")
|
||||||
|
|
||||||
func drop_trash():
|
func drop_trash():
|
||||||
var trash_drop = drop_preload.instance()
|
var trash_drop = drop_preload.instance()
|
||||||
|
@ -54,18 +63,14 @@ 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 < 1:
|
|
||||||
path_sprite.modulate.a = (1 - start_timer) / 2
|
|
||||||
start_timer += delta
|
|
||||||
return
|
|
||||||
drop_timer += delta
|
drop_timer += delta
|
||||||
|
start_timer += delta
|
||||||
|
|
||||||
velocity = Vector2.ZERO
|
velocity = Vector2.ZERO
|
||||||
if movement_type == "horizontal":
|
if movement_type == "horizontal":
|
||||||
if movement_start == "left":
|
if movement_start == "left":
|
||||||
velocity.x += horizontal_speed
|
velocity.x += horizontal_speed
|
||||||
if self.global_position.x > 360:
|
if self.global_position.x > 360:
|
||||||
path_sprite.call_deferred("free")
|
|
||||||
self.call_deferred("free")
|
self.call_deferred("free")
|
||||||
if self.global_position.x > last_x + 7:
|
if self.global_position.x > last_x + 7:
|
||||||
last_x = self.global_position.x
|
last_x = self.global_position.x
|
||||||
|
@ -73,7 +78,6 @@ func _physics_process(delta):
|
||||||
else:
|
else:
|
||||||
velocity.x -= horizontal_speed
|
velocity.x -= horizontal_speed
|
||||||
if self.global_position.x < 0:
|
if self.global_position.x < 0:
|
||||||
path_sprite.call_deferred("free")
|
|
||||||
self.call_deferred("free")
|
self.call_deferred("free")
|
||||||
if self.global_position.x < last_x - 7:
|
if self.global_position.x < last_x - 7:
|
||||||
last_x = self.global_position.x
|
last_x = self.global_position.x
|
||||||
|
@ -82,12 +86,12 @@ func _physics_process(delta):
|
||||||
else:
|
else:
|
||||||
velocity.y += vertical_speed
|
velocity.y += vertical_speed
|
||||||
if self.global_position.y > 160:
|
if self.global_position.y > 160:
|
||||||
path_sprite.call_deferred("free")
|
|
||||||
self.call_deferred("free")
|
self.call_deferred("free")
|
||||||
if self.global_position.y > last_y + 7:
|
if self.global_position.y > last_y + 7:
|
||||||
last_y = self.global_position.y
|
last_y = self.global_position.y
|
||||||
drop_trash()
|
drop_trash()
|
||||||
|
|
||||||
|
if start_timer >= 1.25:
|
||||||
velocity = move_and_slide(velocity)
|
velocity = move_and_slide(velocity)
|
||||||
|
|
||||||
func _on_sprite_animation_finished():
|
func _on_sprite_animation_finished():
|
||||||
|
@ -96,3 +100,4 @@ func _on_sprite_animation_finished():
|
||||||
|
|
||||||
func _on_Spawn_Animation_Start_timeout():
|
func _on_Spawn_Animation_Start_timeout():
|
||||||
$Sprite.play("spawn")
|
$Sprite.play("spawn")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=19 format=2]
|
[gd_scene load_steps=22 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
|
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
|
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
|
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
|
||||||
[ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13]
|
[ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13]
|
||||||
[ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14]
|
[ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14]
|
||||||
|
[ext_resource path="res://src/scenes/game/sprites/gameover.png" type="Texture" id=15]
|
||||||
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
|
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
@ -30,6 +31,37 @@ animations = [ {
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=5]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Sprite:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=6]
|
||||||
|
resource_name = "gameover"
|
||||||
|
length = 3.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Sprite:modulate")
|
||||||
|
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, 1.5, 3 ),
|
||||||
|
"transitions": PoolRealArray( 3.24901, 29.8571, 2, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0, 0, 0, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Game" type="Node"]
|
[node name="Game" type="Node"]
|
||||||
script = ExtResource( 11 )
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
@ -171,3 +203,16 @@ margin_bottom = 3.0
|
||||||
[node name="Right" type="Control" parent="UIWrapper/UI"]
|
[node name="Right" type="Control" parent="UIWrapper/UI"]
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="Gameover" type="Control" parent="UIWrapper"]
|
||||||
|
margin_right = 320.0
|
||||||
|
margin_bottom = 180.0
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="UIWrapper/Gameover"]
|
||||||
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
texture = ExtResource( 15 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/Gameover"]
|
||||||
|
anims/RESET = SubResource( 5 )
|
||||||
|
anims/gameover = SubResource( 6 )
|
||||||
|
|
|
@ -13,8 +13,8 @@ var mob_threshold = [5, 7, 10, 7]
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
Global.playing = true
|
Global.playing = true
|
||||||
Global.play_time = 70
|
Global.play_time = 120
|
||||||
Global.health = 3
|
Global.health = 1
|
||||||
Global.add_health(0)
|
Global.add_health(0)
|
||||||
|
|
||||||
func pause():
|
func pause():
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/gameover.png-46b9ccb4c7936f430dcf3c2c305dfc1e.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/scenes/game/sprites/gameover.png"
|
||||||
|
dest_files=[ "res://.import/gameover.png-46b9ccb4c7936f430dcf3c2c305dfc1e.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
|
|
@ -18,4 +18,8 @@ func add_health(amount):
|
||||||
health = clamp(health + amount, 0, 3)
|
health = clamp(health + amount, 0, 3)
|
||||||
get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health
|
get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health
|
||||||
if health == 0:
|
if health == 0:
|
||||||
return_to_menu() # TODO endgame
|
playing = false
|
||||||
|
var animplayer = get_tree().get_root().get_node("Game/UIWrapper/Gameover/AnimationPlayer")
|
||||||
|
animplayer.play("gameover")
|
||||||
|
yield(animplayer, "animation_finished")
|
||||||
|
return_to_menu()
|
||||||
|
|
Loading…
Reference in New Issue