From 96303b643422d51174fb9c916e553425aa83bfdb Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sun, 15 Jan 2023 14:33:01 -0500 Subject: [PATCH 1/3] FUN --- Bladder.gd | 2 +- Levels/level.tscn | 2 -- Player/player.gd | 19 ++----------------- Player/player.tscn | 33 +++++++++++++++++++++------------ hud.tscn | 5 ++--- 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/Bladder.gd b/Bladder.gd index 07e0adb..f03d60b 100644 --- a/Bladder.gd +++ b/Bladder.gd @@ -9,5 +9,5 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - material.set("fill",clamp(fill, 0.0, 1.0)) + pass diff --git a/Levels/level.tscn b/Levels/level.tscn index 7ffe2dd..174a9e8 100644 --- a/Levels/level.tscn +++ b/Levels/level.tscn @@ -140,6 +140,4 @@ position = Vector2(2367, 1350) [node name="shoes" parent="." instance=ExtResource("8_qnb3g")] 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="picked" from="shoes" to="." method="_on_shoes_picked"] diff --git a/Player/player.gd b/Player/player.gd index e8a8899..db77f63 100644 --- a/Player/player.gd +++ b/Player/player.gd @@ -47,6 +47,7 @@ func take_damage(damage): if sprite.animation != "damage": HP = HP - damage; sprite.play("damage"); + $Bladder.material.set("fill",clamp((100.0 - HP) / 100.0, 0.0, 1.0)); if HP <= 0: kill(); @@ -59,7 +60,7 @@ func pickup(item): return; func kill(): - get_tree().reload_current_scene(); + get_tree().change_scene_to_file("res://game_over.tscn"); func get_input_vector(): var input_vector = Vector2.ZERO; @@ -79,22 +80,6 @@ func apply_friction(input_vector,delta): func call_set_player(): 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(): if sprite.animation == "damage": animation_count+=1; diff --git a/Player/player.tscn b/Player/player.tscn index 6f51fb4..339240d 100644 --- a/Player/player.tscn +++ b/Player/player.tscn @@ -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="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"] animations = [{ "frames": [{ "duration": 1.0, "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, "name": &"default", @@ -28,6 +21,10 @@ animations = [{ [sub_resource type="RectangleShape2D" id="RectangleShape2D_ng5bv"] 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"] collision_layer = 3 collision_mask = 3 @@ -51,4 +48,16 @@ points = PackedVector2Array(0, 0, 2000, 0) width = 5.0 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"] diff --git a/hud.tscn b/hud.tscn index 1520406..ebc65ed 100644 --- a/hud.tscn +++ b/hud.tscn @@ -23,11 +23,10 @@ script = ExtResource("1_jkk58") [node name="Bladder" type="Sprite2D" parent="."] material = SubResource("ShaderMaterial_0gcor") -scale = Vector2(4, 4) +scale = Vector2(2, 2) texture = ExtResource("2_fa8jy") script = ExtResource("3_tb31y") [node name="BladderHollow" type="Sprite2D" parent="."] -position = Vector2(-2, 0) -scale = Vector2(4, 4) +scale = Vector2(2, 2) texture = ExtResource("4_lbxgy") From c52e4a21852cb0acd560b8776d470c5bc1630508 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sun, 15 Jan 2023 14:39:48 -0500 Subject: [PATCH 2/3] ! --- Images/eniv.png | Bin 0 -> 1363 bytes Images/eniv.png.import | 34 ++++++++++++++++++++++++++++++++++ Player/player.gd | 3 ++- start.tscn | 16 ++++++---------- 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 Images/eniv.png create mode 100644 Images/eniv.png.import diff --git a/Images/eniv.png b/Images/eniv.png new file mode 100644 index 0000000000000000000000000000000000000000..010e4b452ebbf995e53bbce2f9e7c23c08d68f4e GIT binary patch literal 1363 zcmZ8fe>l?#7=JhWWi_{)?O`!fu9lD!ck-kA68TZd`B7Rq6UxXD&q>6-q0zz?GC9V{ zba+CYk+Pbkx+5{yR8B?L;kinob&5Ir=l;0Q^S+B_X5x$9y%?5OS&Enu#)AJ>sAx1}Ni%$9@Ivtx zZSUX5>h3exNU|^`?ymROs9mAvXkzUw>4I;HdXusavU-#9#L%xgwW-xp;8yk%qK%wjCAtIlT8!KQU2PHF(62<~(mdi!{J2R5EOpc!UzBn|^t zNKs#Y9^=^Mpa*h%ZD|Isp2j7BpMPv6Ta}NsR_mAUz$hAX1BsknG)W-x;LXKEh@I7} zm1Mg?i{Dxm{?dhmZEej1ozyv;GJV^O-8f)28-9gT;AhtX*{0fU2rY=8l z&mZ5*gPdugc!2j2u9>p?HEHM~L8|`5Gczb3#-xLGL7N)a_zk7x{dv#5khz$e6t~~l z9wOw!d_nH+Zk5smKD7~V>E-8L6nMLFt&a1&VxdMkkg_w%^MjME0y~GW@R0(EN7T(G z9*B|4!XfMCt_=31KGN)0qAI8jlOdf(P+mTMBYIEO&m|LNgihL?rEYLNJmEt@w$ttr zw%0wmYX+>mY-<}p>~1{WAQ#(=BjWZBjF^&jy-E~90ox`Vht)(DxPZLmLPtIsY66OhiE3qi^#f&e%am`w||xZn7vePh=-cVolFq7pGJXQR8F!$(mp2XX_z8E8Th+I7~_u*CxmbAk;+@-VAiqw7697l5EbEt{haaLag!ReWPjtMt$ zX`PbH>T^C}IYV4&K4cyAV!=^TA9TWsPCXdpc}?V1%p4DPFDiW-c+i+rjsw$g28Fe4 z@fJ>u@v#LwHx=bx8+BC<*e*KK0PR^P(^xHE6JVn|zzRKt0+5f*%dDxIT>lXRKyTJA zGjLyGsX!NH>Wr+VNI)^rW(-bziwQj#e6WTJ&rj$^|3L{5X#o3eK4Q2!%QE^8o3nb% zN0fzQXPMPKvzd1$mxy%yo-bZ9$_^}B45CAQ5AE6ox;!M^&N5U%#X9lz^7m}= H;AZ^`;hi{f literal 0 HcmV?d00001 diff --git a/Images/eniv.png.import b/Images/eniv.png.import new file mode 100644 index 0000000..8df0934 --- /dev/null +++ b/Images/eniv.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://drkbrxdk6s40s" +path="res://.godot/imported/eniv.png-b581d2ab312dd8182bad8b245285147a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Images/eniv.png" +dest_files=["res://.godot/imported/eniv.png-b581d2ab312dd8182bad8b245285147a.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Player/player.gd b/Player/player.gd index db77f63..b9af161 100644 --- a/Player/player.gd +++ b/Player/player.gd @@ -7,6 +7,7 @@ extends CharacterBody2D @onready var raycast = $RayCast2D; @onready var sprite = $AnimatedSprite2D; +@onready var bladderUI = $Bladder; var animation_count = 0; @@ -47,7 +48,7 @@ func take_damage(damage): if sprite.animation != "damage": HP = HP - damage; sprite.play("damage"); - $Bladder.material.set("fill",clamp((100.0 - HP) / 100.0, 0.0, 1.0)); + bladderUI.material.set("fill",clamp((100.0 - HP) / 100.0, 0.0, 1.0)); if HP <= 0: kill(); diff --git a/start.tscn b/start.tscn index 8bce005..aaa6709 100644 --- a/start.tscn +++ b/start.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://d25c4ey6gvduc"] +[gd_scene load_steps=4 format=3 uid="uid://d25c4ey6gvduc"] [ext_resource type="Texture2D" uid="uid://cg848qjc4fxi" path="res://Images/Main_menu.png" id="1_65g7h"] [ext_resource type="Script" path="res://start.gd" id="1_exncb"] +[ext_resource type="Texture2D" uid="uid://drkbrxdk6s40s" path="res://Images/eniv.png" id="3_5j2rv"] [node name="Start" type="Node2D"] script = ExtResource("1_exncb") @@ -23,14 +24,9 @@ theme_override_colors/font_hover_color = Color(0, 0, 0.65098, 1) text = "Start Game" flat = true -[node name="Label" type="Label" parent="."] -offset_left = 1318.0 -offset_top = 109.0 -offset_right = 1728.0 -offset_bottom = 310.0 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_font_sizes/font_size = 145 -text = "ENVIE -" +[node name="Eniv" type="Sprite2D" parent="."] +position = Vector2(1632, 266) +scale = Vector2(4, 4) +texture = ExtResource("3_5j2rv") [connection signal="pressed" from="Button" to="." method="_on_button_pressed"] From c014c42dbfae147db33edd9bdde633b5d0be6e01 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sun, 15 Jan 2023 14:44:32 -0500 Subject: [PATCH 3/3] a --- hud.tscn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hud.tscn b/hud.tscn index ebc65ed..bfd8566 100644 --- a/hud.tscn +++ b/hud.tscn @@ -19,6 +19,8 @@ offset_left = 198.0 offset_top = 205.0 offset_right = 198.0 offset_bottom = 205.0 +grow_horizontal = 2 +grow_vertical = 2 script = ExtResource("1_jkk58") [node name="Bladder" type="Sprite2D" parent="."]