From aec51331506c98eaa3f897f20811c1f14bb81afb Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 17 Sep 2025 15:59:14 +0200 Subject: [PATCH] Broke Activ Items --- enemies/ghost animation/Ghost 1.png | Bin 0 -> 1657 bytes enemies/ghost animation/Ghost 1.png.import | 40 +++++++++++++++++++++ enemies/ghost animation/Ghost 2.png | Bin 0 -> 1713 bytes enemies/ghost animation/Ghost 2.png.import | 40 +++++++++++++++++++++ enemies/ghost animation/Ghost 3.png | Bin 0 -> 1767 bytes enemies/ghost animation/Ghost 3.png.import | 40 +++++++++++++++++++++ enemies/ghost animation/Ghost 4.png | Bin 0 -> 1797 bytes enemies/ghost animation/Ghost 4.png.import | 40 +++++++++++++++++++++ enemies/ghost animation/Ghost 5.png | Bin 0 -> 1691 bytes enemies/ghost animation/Ghost 5.png.import | 40 +++++++++++++++++++++ enemies/ghost.tscn | 4 +-- item_ui/item_ui.gd | 9 +++++ item_ui/item_ui.gd.uid | 1 + item_ui/item_ui.tscn | 7 ++-- items/active_item.gd | 7 ++++ items/item_spawn.tscn | 6 ++-- items/updash.tscn | 3 +- main.tscn | 4 ++- player/player.gd | 15 +++++--- player/player.tscn | 3 ++ project.godot | 5 +++ 21 files changed, 249 insertions(+), 15 deletions(-) create mode 100644 enemies/ghost animation/Ghost 1.png create mode 100644 enemies/ghost animation/Ghost 1.png.import create mode 100644 enemies/ghost animation/Ghost 2.png create mode 100644 enemies/ghost animation/Ghost 2.png.import create mode 100644 enemies/ghost animation/Ghost 3.png create mode 100644 enemies/ghost animation/Ghost 3.png.import create mode 100644 enemies/ghost animation/Ghost 4.png create mode 100644 enemies/ghost animation/Ghost 4.png.import create mode 100644 enemies/ghost animation/Ghost 5.png create mode 100644 enemies/ghost animation/Ghost 5.png.import create mode 100644 item_ui/item_ui.gd create mode 100644 item_ui/item_ui.gd.uid diff --git a/enemies/ghost animation/Ghost 1.png b/enemies/ghost animation/Ghost 1.png new file mode 100644 index 0000000000000000000000000000000000000000..7360438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<4tGftqBOB(dhIAVnau6V z6smRG?Y-Hz{$Io;N^&m$hV0{7ALkyW_mSnNaV!i<(JW#Z5ScYnw9kuxp13eu=sBV5dg@@{dFX)zBVkSL)k) z{Pk1I(TJ-PVVa*|!i8D)rDi`UIFv*fuTRfxGzLCC%F%s9*4Z4<)qzT)1q)~_noOa| zC2+`{y$DafARPf!o>%WDG=US zoRY4xHmOwEB7p^T7NMI4lMz5mh0*T7IQ;&+Dg)`NxvERHFm!-dCvYO}Ev^UXkk;5{6hn`}{A{83n!&E);hmUv#Q?czAhF6au*6 zJ%7a*+Boc=6;f*G5&#sn3SGj%@v#b{UwbIm8eq^jtbd5XpUPlSz&Ff%>!=+$W$|!J Og1pXQJ?h;evwjE9Z)lYO literal 0 HcmV?d00001 diff --git a/enemies/ghost animation/Ghost 4.png.import b/enemies/ghost animation/Ghost 4.png.import new file mode 100644 index 0000000..1ac4e37 --- /dev/null +++ b/enemies/ghost animation/Ghost 4.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cmg8yws3gwx6u" +path="res://.godot/imported/Ghost 4.png-45ba6df3ef207a5eff72f5f0036139d6.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://enemies/ghost animation/Ghost 4.png" +dest_files=["res://.godot/imported/Ghost 4.png-45ba6df3ef207a5eff72f5f0036139d6.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/enemies/ghost animation/Ghost 5.png b/enemies/ghost animation/Ghost 5.png new file mode 100644 index 0000000000000000000000000000000000000000..850769f9814ab5383dcc8af72f95b43b969d3911 GIT binary patch literal 1691 zcmY*adsLFy7C+yon8PHNp`$jXmZsF?qZGZ;;A3nlSlX4;lF4ZBQQ;#~M=K@lal0)| z%V%~)O)JwvEk>P0;=Ac+&ZyK{i6%E8O*AzSNDCiuakW-=-9LV3@88*b{nkF`?6uF; z10jJXXlpb8z=RYO5T>`RRTvxT*G}TGzw`!54GZ)KjRW7m*OP$QL!`L<`@wd-Zw#O- zCxGEK!qyWEznb3!deonaC+Dnk# z$!f!qU;fC4omlYjqne%MYNH6_t~O)~xuVF%aWg*RbV83+yzJfRr_CJJ*PBj4Nst+l<~J=>8anK<=ygIN%i;8=96fWkW7 z*ETuf?rc`npvNhn3CIZr^Bl8Ag3_ze zd%KUBOVjjf*zi?#N^kdDtQ0R3tFil6`A_;dR{Ek88Ke;5>iTi#=jFh`y)&tVu<8aaFAr z-(q;hzUUVt^}#Ep639!*&wMs4lssKg5Amu-1v>SRAX(Cpa(A1JU#+T8$cWsLgGI!* z|5|Q)167V0k5|e3+z!C1T{`#kA2V^jA2ItIlV5M5z2XTj^-#KNz`J98XZvd4O>%Y7Cofb7~H%Cqu0>(i1I#Kf~2^4q@+f=)WVQ%x3_OL6Kzw;GY7=-&#QK`&QK42N-u9Fr8SyBP}Ao*L=T zDn6dENs2>(t9M$LFs{>YOyyjw^_S0Zr>FRO8Lu2t;w=J_a9LSdb(k#W{DhY7o!zCI z!P=s^5$p{M;zh10wG4}FDNLA+VAZwhV)S)7XKXA+c-2@WcQ{s?g!(-}C;x!B-<%AY z^OT;*Qncek(6sd=d@1aX|6bEIvfd}2pyn>f#SuoBTGi`i z4jt#aBdl!kJ@|QKSd{o4{I(^%zG?{rFryik+OGJP4t1^64)y%3nNH55LddnEzTUX# zR+F6Q<$p4$cV`_?PV}NN(kF$XNtj#xi?b>eU8ykJe#WbYN-R7a@#_2T^v)IX2r zK3Fla*KkVULji@?c;?91s|MqWm=JHe%1t=T2%My6s|FehmLEoP`FU+;?gEP&G2_S3 z2cB{6t;HuF&2WB64<))L@Ze+K49<3)% z_YA}lXM!N#E%it40V$PoAv*4cpsV@inRDur=~``gU;K|a5ML47 z_sk>?DHf&AIX?ABYB^fGcn3Tn*d*|q(Jyi-*tmI-z&ixpY^|itya$Gi=hLUtK*ZL~ z3H(Hf0ju-A!r-KWN!-+&)L&TO)!pSL{5>vlkCsQ&ai3y=ec{NdD)qD4 z%jDBl1p{KL@V*xgak4k<-w*=PEc4W3CCOVh`LWtzVyahEXdkPvFx;8 zZr&6B9|lz|jcn*?ED*3IKbFF?azr-YcHR`xG9+uHLk#}D7OjI3RS=flH7;4wEtRQ0 z4Fp4HZ}9A$^I%r|12e>ajAl7r*plMlLy+96@)A8t;R!Ug#D`xBMIV^C7;b#Cn=nXp znb?Z?$1Z2h_?nBsGjkoqjw2md+o(W`q0|aEQ;BmMl=(q4Z(%6iJ-sdJOYZvnpp}On2{2#QPlzuhv(0-=B~r6OAo(J=l>hkwua7u((h7;Qyz9>9#8cD0wC=T K325}EUHC5o8yva- literal 0 HcmV?d00001 diff --git a/enemies/ghost animation/Ghost 5.png.import b/enemies/ghost animation/Ghost 5.png.import new file mode 100644 index 0000000..c47e6e7 --- /dev/null +++ b/enemies/ghost animation/Ghost 5.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bs3lt13umfxu8" +path="res://.godot/imported/Ghost 5.png-08f0125e59cfd0173a5d36d75efeae60.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://enemies/ghost animation/Ghost 5.png" +dest_files=["res://.godot/imported/Ghost 5.png-08f0125e59cfd0173a5d36d75efeae60.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/enemies/ghost.tscn b/enemies/ghost.tscn index f5938fb..be29f28 100644 --- a/enemies/ghost.tscn +++ b/enemies/ghost.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://12jns4dppxxj" path="res://enemies/ghost.gd" id="1_6attn"] [ext_resource type="PackedScene" uid="uid://mtfsdd4cdf3a" path="res://utils/enemy_hurtbox.tscn" id="2_34o1m"] -[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_obmiq"] +[ext_resource type="Texture2D" uid="uid://d3b5hmhjw2jyc" path="res://enemies/ghost animation/Ghost 1.png" id="3_34o1m"] [ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_obmiq"] [sub_resource type="CircleShape2D" id="CircleShape2D_6attn"] @@ -22,7 +22,7 @@ scale = Vector2(6, 6) shape = SubResource("CircleShape2D_6attn") [node name="Sprite2D" type="Sprite2D" parent="."] -texture = ExtResource("2_obmiq") +texture = ExtResource("3_34o1m") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] scale = Vector2(6, 6) diff --git a/item_ui/item_ui.gd b/item_ui/item_ui.gd new file mode 100644 index 0000000..8ad93f1 --- /dev/null +++ b/item_ui/item_ui.gd @@ -0,0 +1,9 @@ +extends MarginContainer + +@export var player : Player; + +func _on_player_active_item_changed(newitem: ActiveItem) -> void: + %ItemTexture.texture = newitem.sprite + +func _process(_delta: float) -> void: + player diff --git a/item_ui/item_ui.gd.uid b/item_ui/item_ui.gd.uid new file mode 100644 index 0000000..06d07e6 --- /dev/null +++ b/item_ui/item_ui.gd.uid @@ -0,0 +1 @@ +uid://eusti457vwq1 diff --git a/item_ui/item_ui.tscn b/item_ui/item_ui.tscn index 1f2de90..5676bf2 100644 --- a/item_ui/item_ui.tscn +++ b/item_ui/item_ui.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://73g8y37skebh"] -[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_lfuq2"] +[ext_resource type="Script" uid="uid://eusti457vwq1" path="res://item_ui/item_ui.gd" id="1_lfuq2"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8oq0s"] draw_center = false @@ -26,12 +26,13 @@ theme_override_constants/margin_left = 25 theme_override_constants/margin_top = 25 theme_override_constants/margin_right = 25 theme_override_constants/margin_bottom = 25 +script = ExtResource("1_lfuq2") [node name="PanelContainer" type="PanelContainer" parent="."] layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_8oq0s") -[node name="TextureRect" type="TextureRect" parent="PanelContainer"] +[node name="ItemTexture" type="TextureRect" parent="PanelContainer"] +unique_name_in_owner = true layout_mode = 2 -texture = ExtResource("1_lfuq2") expand_mode = 1 diff --git a/items/active_item.gd b/items/active_item.gd index 2d7d09b..d110c4b 100644 --- a/items/active_item.gd +++ b/items/active_item.gd @@ -1,7 +1,14 @@ class_name ActiveItem extends Item +@export var sprite : Texture2D + func collect() -> bool: if (player.active_item == null): player.active_item = self return true return false + +func activate(): + assert(false) + + diff --git a/items/item_spawn.tscn b/items/item_spawn.tscn index 3956358..1433d89 100644 --- a/items/item_spawn.tscn +++ b/items/item_spawn.tscn @@ -1,14 +1,14 @@ -[gd_scene load_steps=4 format=3 uid="uid://xj0of571aur1"] +[gd_scene load_steps=5 format=3 uid="uid://xj0of571aur1"] [ext_resource type="Script" uid="uid://b8em61mqgdi58" path="res://items/item_spawn.gd" id="1_ms6tn"] [ext_resource type="PackedScene" uid="uid://b00185vygcka1" path="res://items/heal_item.tscn" id="2_w6i8k"] [ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_5pwuf"] +[ext_resource type="PackedScene" uid="uid://ewe36lqcjojk" path="res://items/updash.tscn" id="3_8hnnb"] [node name="ItemSpawn" type="Node2D"] script = ExtResource("1_ms6tn") common_items = Array[PackedScene]([ExtResource("2_w6i8k")]) -rare_items = Array[PackedScene]([ExtResource("2_w6i8k")]) -unique_items = Array[PackedScene]([ExtResource("2_w6i8k")]) +rare_items = Array[PackedScene]([ExtResource("3_8hnnb")]) metadata/_custom_type_script = "uid://b8em61mqgdi58" [node name="EarthAligner" parent="." instance=ExtResource("3_5pwuf")] diff --git a/items/updash.tscn b/items/updash.tscn index 799aa98..dd04581 100644 --- a/items/updash.tscn +++ b/items/updash.tscn @@ -1,12 +1,13 @@ [gd_scene load_steps=4 format=3 uid="uid://ewe36lqcjojk"] -[ext_resource type="Script" uid="uid://bbwsc2a2hd0ow" path="res://items/updash.gd" id="1_ghbl6"] +[ext_resource type="Script" path="res://items/updash.gd" id="1_ghbl6"] [ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_ptc3l"] [sub_resource type="CircleShape2D" id="CircleShape2D_ghbl6"] [node name="Updash" type="Area2D"] script = ExtResource("1_ghbl6") +sprite = ExtResource("1_ptc3l") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] scale = Vector2(3, 3) diff --git a/main.tscn b/main.tscn index a818ccf..c3311cf 100644 --- a/main.tscn +++ b/main.tscn @@ -43,7 +43,8 @@ autostart = true offset_right = 128.0 offset_bottom = 128.0 -[node name="ItemUI" parent="CanvasLayer" instance=ExtResource("6_4c57u")] +[node name="ItemUI" parent="CanvasLayer" node_paths=PackedStringArray("player") instance=ExtResource("6_4c57u")] +player = NodePath("../../Player") [node name="DeathScreen" parent="CanvasLayer" instance=ExtResource("7_5vw27")] visible = false @@ -58,6 +59,7 @@ position = Vector2(0, -3000) [node name="HealthUp" parent="." instance=ExtResource("9_4c57u")] position = Vector2(0, -3100) +[connection signal="active_item_changed" from="Player" to="CanvasLayer/ItemUI" method="_on_player_active_item_changed"] [connection signal="health_changed" from="Player" to="CanvasLayer/Healthbar" method="_on_player_health_changed"] [connection signal="max_hp_changed" from="Player" to="CanvasLayer/Healthbar" method="_on_player_max_hp_changed"] [connection signal="player_died" from="Player" to="CanvasLayer/DeathScreen" method="_on_player_player_died"] diff --git a/player/player.gd b/player/player.gd index ca76900..0027380 100644 --- a/player/player.gd +++ b/player/player.gd @@ -1,9 +1,10 @@ -extends CharacterBody2D +class_name Player extends CharacterBody2D # Child Nodes @onready var camera : Camera2D = $Camera2D; @onready var anim_sprite : AnimatedSprite2D = $AnimatedSprite2D; @onready var earth_aligner : Node2D = $EarthAligner; @onready var sword : Area2D = $Sword; +@onready var active_item_cooldown : Timer = $ActiveItemCooldown # allow taking away player control var handle_input : bool = true @@ -47,8 +48,12 @@ var atk_cooldown = 0.5 var atk_timer = 0 # Active Item -var active_item = null -var item_cooldown = 0 +signal active_item_changed(newitem : Item) +var active_item : ActiveItem = null: + set(new_active_item): + active_item = new_active_item + active_item_changed.emit(active_item) + func _ready() -> void: max_hp_changed.emit(max_hp) @@ -75,8 +80,8 @@ func manage_attack(delta : float): atk_timer = atk_cooldown func manage_active(delta : float): - item_cooldown = max(item_cooldown - delta, 0) - if(active_item != null and Input.is_action_just_pressed("item") and item_cooldown <= 0): + # item_cooldown = max(item_cooldown - delta, 0) + if(active_item != null and Input.is_action_just_pressed("item") and active_item_cooldown.is_stopped()): active_item.activate() func manage_movement_options() -> void: diff --git a/player/player.tscn b/player/player.tscn index 12a3644..a28016f 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -58,3 +58,6 @@ frame_progress = 0.433977 [node name="EarthAligner" parent="." instance=ExtResource("3_i3pqv")] [node name="Sword" parent="." instance=ExtResource("4_yw30f")] + +[node name="ActiveItemCooldown" type="Timer" parent="."] +one_shot = true diff --git a/project.godot b/project.godot index 5b573d4..182a0cf 100644 --- a/project.godot +++ b/project.godot @@ -26,11 +26,13 @@ window/size/mode=3 move_right={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) ] } move_left={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) ] } jump={ @@ -41,16 +43,19 @@ jump={ attack={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) +, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(356, 29),"global_position":Vector2(365, 77),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) ] } drop={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) ] } item={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null) +, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(297, 25),"global_position":Vector2(306, 73),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) ] }