fix hearts & more sounds

main
Just Dzhi 2023-10-02 18:55:26 +04:00
parent bbe9a17cfa
commit 10e5ee3ef6
8 changed files with 42 additions and 16 deletions

View File

@ -1,8 +1,10 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://src/models/enemies/bat/sprites/bat_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/bat/sprites/bat_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/bat/bat.gd" type="Script" id=2] [ext_resource path="res://src/models/enemies/bat/bat.gd" type="Script" id=2]
[ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=3] [ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=3]
[ext_resource path="res://res/sounds/bat/damaged.ogg" type="AudioStream" id=4]
[ext_resource path="res://res/sounds/bat/screem.wav" type="AudioStream" id=5]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 3 ) extents = Vector2( 4, 3 )
@ -20,7 +22,6 @@ script = ExtResource( 2 )
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 3
playing = true playing = true
centered = false centered = false
@ -38,3 +39,9 @@ shape = SubResource( 2 )
position = Vector2( 11, 21 ) position = Vector2( 11, 21 )
z_index = -1 z_index = -1
texture = ExtResource( 3 ) texture = ExtResource( 3 )
[node name="AudioDamage" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
[node name="AudioScreem" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )

View File

@ -57,3 +57,4 @@ func _shoot():
get_parent().add_child(sonic_wave) get_parent().add_child(sonic_wave)
sonic_wave.global_position.x = self.global_position.x + 8 sonic_wave.global_position.x = self.global_position.x + 8
sonic_wave.global_position.y = self.global_position.y + 8 sonic_wave.global_position.y = self.global_position.y + 8
$AudioScreem.play()

View File

@ -1,8 +1,11 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://src/models/enemies/ghost/sprites/ghost_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/ghost/sprites/ghost_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/ghost/ghost.gd" type="Script" id=2] [ext_resource path="res://src/models/enemies/ghost/ghost.gd" type="Script" id=2]
[ext_resource path="res://src/models/enemies/ghost/sprites/aiming/aiming_spriteframes.tres" type="SpriteFrames" id=3] [ext_resource path="res://src/models/enemies/ghost/sprites/aiming/aiming_spriteframes.tres" type="SpriteFrames" id=3]
[ext_resource path="res://res/sounds/ghost/damaged.wav" type="AudioStream" id=4]
[ext_resource path="res://res/sounds/ghost/dash_charge.wav" type="AudioStream" id=5]
[ext_resource path="res://res/sounds/ghost/dash.wav" type="AudioStream" id=6]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 9 ) extents = Vector2( 7, 9 )
@ -25,6 +28,7 @@ flip_h = true
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 1
playing = true playing = true
centered = false centered = false
@ -33,3 +37,12 @@ centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 8.5, 13.5 ) position = Vector2( 8.5, 13.5 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="AudioDamage" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
[node name="AudioDashCharge" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
[node name="AudioDash" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )

View File

@ -34,8 +34,8 @@ func _physics_process(delta):
global_position = global_position.move_toward(dash_target, 10) global_position = global_position.move_toward(dash_target, 10)
if global_position == dash_target: if global_position == dash_target:
dashing = false dashing = false
$AudioDash.play()
afterdash = true afterdash = true
if afterdash: if afterdash:
afterdash_timer += delta afterdash_timer += delta
if afterdash_timer >= 1: if afterdash_timer >= 1:

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://src/models/enemies/rat/sprites/rat_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/rat/sprites/rat_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/rat/rat.gd" type="Script" id=2] [ext_resource path="res://src/models/enemies/rat/rat.gd" type="Script" id=2]
[ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=3] [ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=3]
[ext_resource path="res://res/sounds/rat/damaged.wav" type="AudioStream" id=4]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 3.5 ) extents = Vector2( 8, 3.5 )
@ -29,3 +30,6 @@ shape = SubResource( 1 )
position = Vector2( 11, 9 ) position = Vector2( 11, 9 )
z_index = -1 z_index = -1
texture = ExtResource( 3 ) texture = ExtResource( 3 )
[node name="AudioDamage" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )

View File

@ -27,14 +27,14 @@ extents = Vector2( 140, 10.125 )
atlas = ExtResource( 6 ) atlas = ExtResource( 6 )
region = Rect2( 155, 0, 31, 11 ) region = Rect2( 155, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 6 )
region = Rect2( 124, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=9] [sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 6 ) atlas = ExtResource( 6 )
region = Rect2( 93, 0, 31, 11 ) region = Rect2( 93, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 6 )
region = Rect2( 124, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=10] [sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 6 ) atlas = ExtResource( 6 )
region = Rect2( 62, 0, 31, 11 ) region = Rect2( 62, 0, 31, 11 )
@ -49,10 +49,10 @@ region = Rect2( 0, 0, 31, 11 )
[sub_resource type="SpriteFrames" id=4] [sub_resource type="SpriteFrames" id=4]
animations = [ { animations = [ {
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], "frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": true, "loop": false,
"name": "default", "name": "idle",
"speed": 5.0 "speed": 0.0
} ] } ]
[sub_resource type="Animation" id=5] [sub_resource type="Animation" id=5]
@ -209,7 +209,7 @@ margin_bottom = 40.0
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"]
position = Vector2( 52, 156 ) position = Vector2( 52, 156 )
frames = SubResource( 4 ) frames = SubResource( 4 )
frame = 5 animation = "idle"
centered = false centered = false
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
@ -252,6 +252,7 @@ margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="Cards" type="Control" parent="UIWrapper/UI"] [node name="Cards" type="Control" parent="UIWrapper/UI"]
visible = false
margin_right = 320.0 margin_right = 320.0
margin_bottom = 120.0 margin_bottom = 120.0

View File

@ -13,7 +13,7 @@ var mob_threshold = [5, 7, 10, 7]
func _ready(): func _ready():
Global.playing = true Global.playing = true
Global.play_time = 55 Global.play_time = .0
Global.health = 5 Global.health = 5
Global.add_health(0) Global.add_health(0)
@ -33,7 +33,6 @@ func _physics_process(delta):
randomize() randomize()
card_placeholder.get_node("Card").frame = cards.pop_at(randi()%cards.size()) card_placeholder.get_node("Card").frame = cards.pop_at(randi()%cards.size())
$UIWrapper/UI/Cards.visible = true $UIWrapper/UI/Cards.visible = true
#TODO Pause
$UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300 $UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300

View File

@ -19,6 +19,7 @@ var frozen = false
func deal_damage(amount): func deal_damage(amount):
hp -= amount hp -= amount
$AudioDamage.play()
if hp <= 0: if hp <= 0:
death() death()