This commit is contained in:
MarcEricMartel 2023-01-15 14:33:01 -05:00
parent 8efed5d4d6
commit 96303b6434
5 changed files with 26 additions and 35 deletions

View File

@ -9,5 +9,5 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
material.set("fill",clamp(fill, 0.0, 1.0)) pass

View File

@ -140,6 +140,4 @@ position = Vector2(2367, 1350)
[node name="shoes" parent="." instance=ExtResource("8_qnb3g")] [node name="shoes" parent="." instance=ExtResource("8_qnb3g")]
position = Vector2(2595, 969) position = Vector2(2595, 969)
[connection signal="picked" from="pickable_t_shirt" to="." method="_on_pickable_t_shirt_picked"]
[connection signal="is_killed" from="Outside_Enemy" to="." method="_on_outside_enemy_is_killed"] [connection signal="is_killed" from="Outside_Enemy" to="." method="_on_outside_enemy_is_killed"]
[connection signal="picked" from="shoes" to="." method="_on_shoes_picked"]

View File

@ -47,6 +47,7 @@ func take_damage(damage):
if sprite.animation != "damage": if sprite.animation != "damage":
HP = HP - damage; HP = HP - damage;
sprite.play("damage"); sprite.play("damage");
$Bladder.material.set("fill",clamp((100.0 - HP) / 100.0, 0.0, 1.0));
if HP <= 0: if HP <= 0:
kill(); kill();
@ -59,7 +60,7 @@ func pickup(item):
return; return;
func kill(): func kill():
get_tree().reload_current_scene(); get_tree().change_scene_to_file("res://game_over.tscn");
func get_input_vector(): func get_input_vector():
var input_vector = Vector2.ZERO; var input_vector = Vector2.ZERO;
@ -79,22 +80,6 @@ func apply_friction(input_vector,delta):
func call_set_player(): func call_set_player():
get_tree().call_group("enemies", "set_player",self); get_tree().call_group("enemies", "set_player",self);
func _on_area_2d_area_entered(area):
$"../School_Snare".volume_db(-6);
$"../School_BDClave".volume_db(-6);
$"../School_Bass".volume_db(-6);
$"../School_Flute".volume_db(-6);
$"../School_Brass".volume_db(-6);
func _on_area_2d_area_exited(area):
$"../School_Snare".volume_db(-80);
$"../School_BDClave".volume_db(-80);
$"../School_Bass".volume_db(-80);
$"../School_Flute".volume_db(-80);
$"../School_Brass".volume_db(-80);
func _on_animated_sprite_2d_animation_finished(): func _on_animated_sprite_2d_animation_finished():
if sprite.animation == "damage": if sprite.animation == "damage":
animation_count+=1; animation_count+=1;

View File

@ -1,24 +1,17 @@
[gd_scene load_steps=5 format=3 uid="uid://xev8p1td1icx"] [gd_scene load_steps=10 format=3 uid="uid://xev8p1td1icx"]
[ext_resource type="Script" path="res://Player/player.gd" id="1_mbyc2"] [ext_resource type="Script" path="res://Player/player.gd" id="1_mbyc2"]
[ext_resource type="Texture2D" uid="uid://wkeakqjvu3gg" path="res://Sprites/placeholder_player.png" id="2_bqbmq"] [ext_resource type="Texture2D" uid="uid://wkeakqjvu3gg" path="res://Sprites/placeholder_player.png" id="2_bqbmq"]
[ext_resource type="Texture2D" uid="uid://d2nqjxofehkum" path="res://Images/BladderHollow.png" id="3_nm4h4"]
[ext_resource type="Shader" path="res://hud.gdshader" id="4_4u6cb"]
[ext_resource type="Texture2D" uid="uid://b25de1d0yyuji" path="res://Images/Bladder.png" id="5_pcbeg"]
[ext_resource type="Script" path="res://Bladder.gd" id="6_8x3rf"]
[sub_resource type="SpriteFrames" id="SpriteFrames_mqbrd"] [sub_resource type="SpriteFrames" id="SpriteFrames_mqbrd"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("2_bqbmq") "texture": ExtResource("2_bqbmq")
}, {
"duration": 1.0,
"texture": null
}],
"loop": true,
"name": &"damage",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_bqbmq")
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",
@ -28,6 +21,10 @@ animations = [{
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ng5bv"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ng5bv"]
size = Vector2(40, 64) size = Vector2(40, 64)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_g8k2d"]
shader = ExtResource("4_4u6cb")
shader_parameter/fill = 0.0
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_layer = 3 collision_layer = 3
collision_mask = 3 collision_mask = 3
@ -51,4 +48,16 @@ points = PackedVector2Array(0, 0, 2000, 0)
width = 5.0 width = 5.0
default_color = Color(1, 0, 0, 0.392157) default_color = Color(1, 0, 0, 0.392157)
[node name="Bladder" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_g8k2d")
position = Vector2(-847, -443)
scale = Vector2(2, 2)
texture = ExtResource("5_pcbeg")
script = ExtResource("6_8x3rf")
[node name="BladderHollow" type="Sprite2D" parent="."]
position = Vector2(-847, -443)
scale = Vector2(2, 2)
texture = ExtResource("3_nm4h4")
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"] [connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]

View File

@ -23,11 +23,10 @@ script = ExtResource("1_jkk58")
[node name="Bladder" type="Sprite2D" parent="."] [node name="Bladder" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_0gcor") material = SubResource("ShaderMaterial_0gcor")
scale = Vector2(4, 4) scale = Vector2(2, 2)
texture = ExtResource("2_fa8jy") texture = ExtResource("2_fa8jy")
script = ExtResource("3_tb31y") script = ExtResource("3_tb31y")
[node name="BladderHollow" type="Sprite2D" parent="."] [node name="BladderHollow" type="Sprite2D" parent="."]
position = Vector2(-2, 0) scale = Vector2(2, 2)
scale = Vector2(4, 4)
texture = ExtResource("4_lbxgy") texture = ExtResource("4_lbxgy")