diff --git a/Characters/test_player/test_player.gd b/Characters/test_player/test_player.gd index 99c53cf..71943c1 100644 --- a/Characters/test_player/test_player.gd +++ b/Characters/test_player/test_player.gd @@ -227,9 +227,6 @@ func _physics_process(delta): # $Networking.flipped_h = player_sprite.flip_h # $Networking.sync_frame_coords = player_sprite.get_frame_coords() - - - func move_player(c_velocity: Vector2): # rpc(&'update_movement', velocity) var collided = move_and_collide(c_velocity) @@ -240,3 +237,6 @@ func move_player(c_velocity: Vector2): # var normal = collision.get_normal() # collider.apply_central_impulse(-collision.get_normal() * push_power) player_hit.is_player_hit = false + +func set_context_label(text: String): + $CanvasLayer/ContextLabel.set_text(text) diff --git a/Characters/test_player/test_player.tscn b/Characters/test_player/test_player.tscn index 946b8f4..f3d9bfe 100644 --- a/Characters/test_player/test_player.tscn +++ b/Characters/test_player/test_player.tscn @@ -1,13 +1,14 @@ -[gd_scene load_steps=22 format=3 uid="uid://c1gncjamuavvs"] +[gd_scene load_steps=23 format=3 uid="uid://c1gncjamuavvs"] [ext_resource type="Script" path="res://Characters/test_player/test_player.gd" id="1_6aci1"] [ext_resource type="Texture2D" uid="uid://cs5o8bykug82q" path="res://Characters/test_player/WARRIOR SKELETON SS 2.png" id="1_8pmbp"] -[ext_resource type="PackedScene" uid="uid://0ou4asf4vsc1" path="res://UI/Inventory/Inventory.tscn" id="3_fol83"] +[ext_resource type="PackedScene" uid="uid://drr0ptd6k6uch" path="res://UI/Inventory/UserInventory.tscn" id="3_nvr35"] +[ext_resource type="FontFile" uid="uid://dj4pldmxeqmtt" path="res://UI/PressStart2P-Regular.ttf" id="4_i8vjo"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3qub5"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_g1om0"] size = Vector2(22, 20) -[sub_resource type="Animation" id="Animation_v17mb"] +[sub_resource type="Animation" id="Animation_5n6gk"] resource_name = "attack" length = 0.65 tracks/0/type = "value" @@ -23,7 +24,7 @@ tracks/0/keys = { "values": [Vector2i(0, 5), Vector2i(1, 5), Vector2i(2, 5), Vector2i(3, 5)] } -[sub_resource type="Animation" id="Animation_dhyjd"] +[sub_resource type="Animation" id="Animation_u6kdu"] resource_name = "damage" step = 0.01 tracks/0/type = "value" @@ -39,7 +40,7 @@ tracks/0/keys = { "values": [Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1)] } -[sub_resource type="Animation" id="Animation_jals6"] +[sub_resource type="Animation" id="Animation_ybwuj"] resource_name = "die" tracks/0/type = "value" tracks/0/imported = false @@ -54,7 +55,7 @@ tracks/0/keys = { "values": [Vector2i(0, 4), Vector2i(1, 4), Vector2i(2, 4), Vector2i(3, 4), Vector2i(4, 4)] } -[sub_resource type="Animation" id="Animation_mhxr4"] +[sub_resource type="Animation" id="Animation_h5uv5"] resource_name = "idle" length = 2.0 loop_mode = 1 @@ -71,7 +72,7 @@ tracks/0/keys = { "values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0)] } -[sub_resource type="Animation" id="Animation_5kwsw"] +[sub_resource type="Animation" id="Animation_cev5d"] resource_name = "walk" loop_mode = 1 step = 0.01 @@ -88,62 +89,62 @@ tracks/0/keys = { "values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)] } -[sub_resource type="AnimationLibrary" id="AnimationLibrary_mfcw3"] +[sub_resource type="AnimationLibrary" id="AnimationLibrary_5qwfv"] _data = { -"attack": SubResource("Animation_v17mb"), -"damage": SubResource("Animation_dhyjd"), -"die": SubResource("Animation_jals6"), -"idle": SubResource("Animation_mhxr4"), -"walk": SubResource("Animation_5kwsw") +"attack": SubResource("Animation_5n6gk"), +"damage": SubResource("Animation_u6kdu"), +"die": SubResource("Animation_ybwuj"), +"idle": SubResource("Animation_h5uv5"), +"walk": SubResource("Animation_cev5d") } -[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_lqar1"] +[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_2a8v8"] -[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_vr7py"] +[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_5013i"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d7310"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_24wrp"] animation = &"attack" -[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_83svy"] +[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_2lwq2"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ixc0x"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_mfi5b"] animation = &"damage" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_wmn47"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yud6d"] animation = &"die" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_poall"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0n1hp"] animation = &"idle" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cxexk"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_qrdax"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6a4lj"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6pfdq"] animation = &"walk" -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_4pmjh"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_78n1d"] graph_offset = Vector2(-769.911, -161.25) -nodes/AttackOneShot/node = SubResource("AnimationNodeOneShot_lqar1") +nodes/AttackOneShot/node = SubResource("AnimationNodeOneShot_2a8v8") nodes/AttackOneShot/position = Vector2(-320, 60) -nodes/DieOneShot/node = SubResource("AnimationNodeOneShot_vr7py") +nodes/DieOneShot/node = SubResource("AnimationNodeOneShot_5013i") nodes/DieOneShot/position = Vector2(-120, 180) -nodes/attack_anim/node = SubResource("AnimationNodeAnimation_d7310") +nodes/attack_anim/node = SubResource("AnimationNodeAnimation_24wrp") nodes/attack_anim/position = Vector2(-560, 200) -nodes/damageOneShot/node = SubResource("AnimationNodeOneShot_83svy") +nodes/damageOneShot/node = SubResource("AnimationNodeOneShot_2lwq2") nodes/damageOneShot/position = Vector2(100, 320) -nodes/damage_anim/node = SubResource("AnimationNodeAnimation_ixc0x") +nodes/damage_anim/node = SubResource("AnimationNodeAnimation_mfi5b") nodes/damage_anim/position = Vector2(-200, 460) -nodes/die_anim/node = SubResource("AnimationNodeAnimation_wmn47") +nodes/die_anim/node = SubResource("AnimationNodeAnimation_yud6d") nodes/die_anim/position = Vector2(-440, 340) -nodes/idle_anim/node = SubResource("AnimationNodeAnimation_poall") +nodes/idle_anim/node = SubResource("AnimationNodeAnimation_0n1hp") nodes/idle_anim/position = Vector2(-940, 60) nodes/output/position = Vector2(400, 340) -nodes/walkIdleBlend/node = SubResource("AnimationNodeBlend2_cxexk") +nodes/walkIdleBlend/node = SubResource("AnimationNodeBlend2_qrdax") nodes/walkIdleBlend/position = Vector2(-660, -40) -nodes/walk_anim/node = SubResource("AnimationNodeAnimation_6a4lj") +nodes/walk_anim/node = SubResource("AnimationNodeAnimation_6pfdq") nodes/walk_anim/position = Vector2(-920, -80) node_connections = [&"output", 0, &"damageOneShot", &"AttackOneShot", 0, &"walkIdleBlend", &"AttackOneShot", 1, &"attack_anim", &"DieOneShot", 0, &"AttackOneShot", &"DieOneShot", 1, &"die_anim", &"damageOneShot", 0, &"DieOneShot", &"damageOneShot", 1, &"damage_anim", &"walkIdleBlend", 0, &"walk_anim", &"walkIdleBlend", 1, &"idle_anim"] -[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_n4dy6"] +[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_hr3p8"] properties/0/path = NodePath(".:position") properties/0/spawn = true properties/0/sync = true @@ -162,23 +163,23 @@ motion_mode = 1 script = ExtResource("1_6aci1") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(1, 2) -shape = SubResource("RectangleShape2D_3qub5") +shape = SubResource("RectangleShape2D_g1om0") [node name="Sprite2D" type="Sprite2D" parent="."] z_index = 1 +position = Vector2(-1, -2) texture = ExtResource("1_8pmbp") hframes = 6 vframes = 6 -frame = 4 +frame = 1 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { -"": SubResource("AnimationLibrary_mfcw3") +"": SubResource("AnimationLibrary_5qwfv") } [node name="AnimationTree" type="AnimationTree" parent="."] -tree_root = SubResource("AnimationNodeBlendTree_4pmjh") +tree_root = SubResource("AnimationNodeBlendTree_78n1d") anim_player = NodePath("../AnimationPlayer") active = true parameters/AttackOneShot/active = false @@ -191,13 +192,21 @@ parameters/walkIdleBlend/blend_amount = 1.0 [node name="player_cam" type="Camera2D" parent="."] modulate = Color(0, 0, 0, 1) +zoom = Vector2(2, 2) [node name="InvulnerableTimer" type="Timer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."] -[node name="Inventory" parent="CanvasLayer" instance=ExtResource("3_fol83")] -mouse_filter = 2 +[node name="UserInventory" parent="CanvasLayer" instance=ExtResource("3_nvr35")] + +[node name="ContextLabel" type="Label" parent="CanvasLayer"] +offset_left = 463.0 +offset_top = 281.0 +offset_right = 703.0 +offset_bottom = 304.0 +size_flags_horizontal = 4 +theme_override_fonts/font = ExtResource("4_i8vjo") [node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."] -replication_config = SubResource("SceneReplicationConfig_n4dy6") +replication_config = SubResource("SceneReplicationConfig_hr3p8") diff --git a/Game Manager/game_manager.gd b/Game Manager/game_manager.gd index b7f059f..f1a6bca 100644 --- a/Game Manager/game_manager.gd +++ b/Game Manager/game_manager.gd @@ -47,7 +47,7 @@ func add_player(peer_id): func show_notification(my_message: String): notifications.show_new_notification(my_message) -func _on_host_button_pressed(): # When hosting a new game +func _on_host_server_pressed(): main_menu.hide() start_game_menu.show() enet_peer.create_server(PORT) @@ -56,26 +56,20 @@ func _on_host_button_pressed(): # When hosting a new game add_player(multiplayer.get_unique_id()) - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass - - -func _on_join_button_pressed(): +func _on_join_server_modal_pressed(): main_menu.hide() enet_peer.create_client("localhost", PORT) multiplayer.multiplayer_peer = enet_peer - func _on_start_game_button_pressed(): start_game_menu.hide() -func _on_play_single_player_button_pressed(): +func _on_play_single_player_pressed(): var player = Player.instantiate() player.name = str(1) add_child(player) player.set_position(spawn_location) main_menu.hide() - notifications.hide() + #notifications.hide() + diff --git a/Game Manager/game_manager.tscn b/Game Manager/game_manager.tscn index fad6954..25756e3 100644 --- a/Game Manager/game_manager.tscn +++ b/Game Manager/game_manager.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=3 uid="uid://dlgcmxvgh6f3k"] +[gd_scene load_steps=4 format=3 uid="uid://dlgcmxvgh6f3k"] [ext_resource type="Script" path="res://Game Manager/game_manager.gd" id="1_bkvdw"] +[ext_resource type="Theme" uid="uid://6c4dxc8quyaj" path="res://UI/default_theme.tres" id="2_jufk4"] +[ext_resource type="FontFile" uid="uid://dj4pldmxeqmtt" path="res://UI/PressStart2P-Regular.ttf" id="3_2dowj"] [node name="game_manager" type="Node"] script = ExtResource("1_bkvdw") @@ -32,8 +34,101 @@ layout_mode = 2 layout_mode = 2 text = "Start Game" +[node name="MainMenu" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("2_jufk4") + +[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/MainMenu"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MainMenu/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme_override_constants/separation = 50 + +[node name="HostServer" type="Button" parent="CanvasLayer/MainMenu/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Host Server" + +[node name="JoinServerModal" type="Button" parent="CanvasLayer/MainMenu/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Join Server" + +[node name="PlaySinglePlayer" type="Button" parent="CanvasLayer/MainMenu/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Play Single Player Game" + +[node name="Label" type="Label" parent="CanvasLayer/MainMenu"] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -210.0 +offset_top = 8.0 +offset_right = 210.0 +offset_bottom = 46.0 +grow_horizontal = 2 +theme_override_fonts/font = ExtResource("3_2dowj") +theme_override_font_sizes/font_size = 35 +text = "Tower Sprint" + +[node name="JoinServerDetails" type="PanelContainer" parent="CanvasLayer/MainMenu"] +visible = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -125.0 +offset_top = -155.0 +offset_right = 125.0 +offset_bottom = 155.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HBoxContainer" type="VBoxContainer" parent="CanvasLayer/MainMenu/JoinServerDetails"] +layout_direction = 2 +layout_mode = 2 +theme_override_constants/separation = 50 + +[node name="Label" type="Label" parent="CanvasLayer/MainMenu/JoinServerDetails/HBoxContainer"] +layout_mode = 2 +text = "Server IP" + +[node name="ServerAddress" type="LineEdit" parent="CanvasLayer/MainMenu/JoinServerDetails/HBoxContainer"] +custom_minimum_size = Vector2(250, 0) +layout_mode = 2 +placeholder_text = "192.168.1.1" + +[node name="Label2" type="Label" parent="CanvasLayer/MainMenu/JoinServerDetails/HBoxContainer"] +layout_mode = 2 +text = "Server Port" + +[node name="ServerPort" type="LineEdit" parent="CanvasLayer/MainMenu/JoinServerDetails/HBoxContainer"] +layout_mode = 2 +placeholder_text = "8080" + +[node name="JoinServer" type="Button" parent="CanvasLayer/MainMenu/JoinServerDetails/HBoxContainer"] +layout_mode = 2 +text = "Join Server" + [node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."] _spawnable_scenes = PackedStringArray("res://Characters/test_player/test_player.tscn", "res://PhysicsObjects/HandStatue/HandStatue.tscn") spawn_path = NodePath("..") [connection signal="pressed" from="CanvasLayer/StartGameMenu/PanelContainer/MarginContainer/StartGameButton" to="." method="_on_start_game_button_pressed"] +[connection signal="pressed" from="CanvasLayer/MainMenu/MarginContainer/VBoxContainer/HostServer" to="." method="_on_host_server_pressed"] +[connection signal="pressed" from="CanvasLayer/MainMenu/MarginContainer/VBoxContainer/JoinServerModal" to="." method="_on_join_server_modal_pressed"] +[connection signal="pressed" from="CanvasLayer/MainMenu/MarginContainer/VBoxContainer/PlaySinglePlayer" to="." method="_on_play_single_player_pressed"] diff --git a/PickupableObjects/Bomb/bomb.gd b/PickupableObjects/Bomb/bomb.gd new file mode 100644 index 0000000..ffb6a7f --- /dev/null +++ b/PickupableObjects/Bomb/bomb.gd @@ -0,0 +1,35 @@ +extends PU_Item + +@onready var is_reachable := false +@onready var current_player:CharacterBody2D = null + +@onready var item_info = { + "item_name": item_name, + "item_description": item_description, + "item_type": item_type, + "item_clip_size": item_clip_size, + "item_ammo": item_ammo, + "item_cooldown": item_cooldown, + "item_texture": item_texture, +} + +func _input(event): + if Input.is_action_pressed("interact") and is_reachable and current_player: +# if item_type == 0: # 0 is weapon +# print("Weapon!") + var result = current_player.add_inventory_item(item_info) + if result: + queue_free() + +func _on_bomb_pu_area_body_entered(body): + if body.is_in_group("player"): + current_player = body + is_reachable = true + current_player.set_context_label("Pickup " + item_info.item_name + "?") + + +func _on_bomb_pu_area_body_exited(body): + if body.is_in_group("player"): + current_player.set_context_label("") + current_player = null + is_reachable = false diff --git a/PickupableObjects/Bomb/bomb.tscn b/PickupableObjects/Bomb/bomb.tscn new file mode 100644 index 0000000..8b3c360 --- /dev/null +++ b/PickupableObjects/Bomb/bomb.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://dp6umanf58x5t"] + +[ext_resource type="Script" path="res://PickupableObjects/Bomb/bomb.gd" id="1_0j4vj"] +[ext_resource type="Texture2D" uid="uid://dmqfqmr16bdqk" path="res://PickupableObjects/Bomb/bomb_icon.png" id="2_c4hvj"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1taf2"] +size = Vector2(20, 34) + +[node name="bomb" type="Node"] +script = ExtResource("1_0j4vj") + +[node name="BombPUArea" type="Area2D" parent="."] + +[node name="bombImage" type="Sprite2D" parent="BombPUArea"] +texture = ExtResource("2_c4hvj") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="BombPUArea"] +position = Vector2(0, 7) +shape = SubResource("RectangleShape2D_1taf2") + +[connection signal="body_entered" from="BombPUArea" to="." method="_on_bomb_pu_area_body_entered"] +[connection signal="body_exited" from="BombPUArea" to="." method="_on_bomb_pu_area_body_exited"] diff --git a/PickupableObjects/PUItemsClass.gd b/PickupableObjects/PUItemsClass.gd new file mode 100644 index 0000000..65bad3b --- /dev/null +++ b/PickupableObjects/PUItemsClass.gd @@ -0,0 +1,13 @@ +extends Node + +class_name PU_Item + +enum ItemType {WEAPON, ITEM, OTHER, ELSE} + +@export var item_name:String = "" +@export_multiline var item_description:String = "" +@export var item_type = ItemType +@export var item_clip_size:int = 0 +@export var item_ammo:int = 0 +@export var item_cooldown:float = 1.0 +@export var item_texture:Texture2D diff --git a/TileSets/circle_progress.png b/TileSets/circle_progress.png new file mode 100644 index 0000000..9375df7 Binary files /dev/null and b/TileSets/circle_progress.png differ diff --git a/TileSets/circle_progress.png.import b/TileSets/circle_progress.png.import new file mode 100644 index 0000000..a2fb9af --- /dev/null +++ b/TileSets/circle_progress.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://beexa5jwvsktf" +path="res://.godot/imported/circle_progress.png-a46750da6187158946f8c020f536a794.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://TileSets/circle_progress.png" +dest_files=["res://.godot/imported/circle_progress.png-a46750da6187158946f8c020f536a794.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/UI/Inventory/InventoryImages/glue.png b/UI/Inventory/InventoryImages/glue.png new file mode 100644 index 0000000..801502f Binary files /dev/null and b/UI/Inventory/InventoryImages/glue.png differ diff --git a/UI/Inventory/InventoryImages/glue.png.import b/UI/Inventory/InventoryImages/glue.png.import new file mode 100644 index 0000000..a9e3328 --- /dev/null +++ b/UI/Inventory/InventoryImages/glue.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bh75ysml2x47r" +path="res://.godot/imported/glue.png-0d3ace9f3bb8dc6e35f66151fbdec38a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Inventory/InventoryImages/glue.png" +dest_files=["res://.godot/imported/glue.png-0d3ace9f3bb8dc6e35f66151fbdec38a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/UI/Inventory/InventorySlot.gd b/UI/Inventory/InventorySlot.gd new file mode 100644 index 0000000..82c874d --- /dev/null +++ b/UI/Inventory/InventorySlot.gd @@ -0,0 +1,48 @@ +extends Control + + +@onready var slot_label := $SlotLabel +@onready var ammo_label := $AmmoLabel +@onready var image_slot := $ItemImage +@onready var reload_bar := $ReloadBar +@onready var item_selecter := $ItemSelector + +func slot_selected(): + item_selecter.set_visible(true) + +func slot_deselected(): + item_selecter.set_visible(false) + +func reload_item(cooldown: float): + reload_bar.set_visible(true) + reload_bar.set_max(cooldown) + reload_bar.set_step(0.1) + var tween = get_tree().create_tween() + tween.tween_method(reload_bar.set_value, 0.0, cooldown, cooldown) + await tween.finished + reload_bar.set_visible(false) + +func clear_slot(): + image_slot.set_texture(null) + +func setup_slot(item_details: Dictionary): + clear_slot() + var picNode = TextureRect.new() + image_slot.add_child(picNode) + picNode.set_mouse_filter(2) + picNode.set_name("inv_texture") + picNode.set_texture(item_details.item_texture) + picNode.set_stretch_mode(TextureRect.STRETCH_KEEP) + picNode.size = Vector2(16, 16) + picNode.position = Vector2(-8, -8) + picNode.set_anchors_preset(Control.PRESET_BOTTOM_WIDE) + if item_details.item_type == 0: # is weapon + set_ammo_label(str(item_details.item_ammo)) + +func set_slot_label(slot_index: String): + slot_label.set_text(slot_index) + + +func set_ammo_label(ammo_value: String): + ammo_label.set_visible(true) + ammo_label.set_text(ammo_value) diff --git a/UI/Inventory/InventorySlot.tscn b/UI/Inventory/InventorySlot.tscn new file mode 100644 index 0000000..831c4ac --- /dev/null +++ b/UI/Inventory/InventorySlot.tscn @@ -0,0 +1,96 @@ +[gd_scene load_steps=7 format=3 uid="uid://defhc376y3h1d"] + +[ext_resource type="Script" path="res://UI/Inventory/InventorySlot.gd" id="1_pltri"] +[ext_resource type="FontFile" uid="uid://dj4pldmxeqmtt" path="res://UI/PressStart2P-Regular.ttf" id="1_wew62"] +[ext_resource type="Texture2D" uid="uid://cgtkkroa583fo" path="res://TileSets/Stuff.png" id="2_mxhl7"] +[ext_resource type="Texture2D" uid="uid://4txm3cwkoncp" path="res://UI/Inventory/circle_progress.png" id="3_5flhr"] + +[sub_resource type="Animation" id="Animation_wthnv"] +resource_name = "blink" +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:self_modulate") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5, 1), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_b5fyj"] +_data = { +"blink": SubResource("Animation_wthnv") +} + +[node name="InventorySlot" type="Control"] +layout_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_pltri") + +[node name="AmmoLabel" type="Label" parent="."] +visible = false +layout_mode = 0 +offset_left = 12.0 +offset_top = -26.0 +offset_right = 28.0 +offset_bottom = -7.0 +theme_override_fonts/font = ExtResource("1_wew62") +theme_override_font_sizes/font_size = 0 +text = "1" + +[node name="ToolbarSlot" type="Sprite2D" parent="."] +scale = Vector2(4, 4) +texture = ExtResource("2_mxhl7") +region_enabled = true +region_rect = Rect2(80, 144, 16, 16) + +[node name="ItemSelector" type="Sprite2D" parent="."] +visible = false +modulate = Color(0.054902, 0.290196, 0.258824, 1) +self_modulate = Color(1, 1, 1, 0.822247) +scale = Vector2(4, 4) +texture = ExtResource("2_mxhl7") +region_enabled = true +region_rect = Rect2(64, 144, 16, 16) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="ItemSelector"] +autoplay = "blink" +libraries = { +"": SubResource("AnimationLibrary_b5fyj") +} + +[node name="SlotLabel" type="Label" parent="."] +visible = false +layout_mode = 0 +offset_left = -51.0 +offset_top = -58.0 +offset_right = 61.0 +offset_bottom = -35.0 +theme_override_fonts/font = ExtResource("1_wew62") +theme_override_font_sizes/font_size = 0 +text = "ItemName" +vertical_alignment = 2 + +[node name="ReloadBar" type="TextureProgressBar" parent="."] +layout_mode = 0 +offset_left = -32.0 +offset_top = -32.0 +offset_right = 32.0 +offset_bottom = 32.0 +fill_mode = 4 +texture_under = ExtResource("3_5flhr") +texture_progress = ExtResource("3_5flhr") +tint_under = Color(1, 1, 1, 0) +tint_progress = Color(0.254902, 0.654902, 0.407843, 0.588235) + +[node name="ItemImage" type="Sprite2D" parent="."] diff --git a/UI/Inventory/UserInventory.gd b/UI/Inventory/UserInventory.gd new file mode 100644 index 0000000..ffb3485 --- /dev/null +++ b/UI/Inventory/UserInventory.gd @@ -0,0 +1,19 @@ +extends Control + + +@export var items:Array = [] +@export var current_slot:int = 0 +@export var active_item:Dictionary = {} + + +func _process(_delta): + if current_slot == 0: + return + if Input.is_action_just_pressed("drop_item"): + if items[current_slot]: + print("ITEM IN SLOT: ", items[current_slot]) + + + + + diff --git a/UI/Inventory/UserInventory.tscn b/UI/Inventory/UserInventory.tscn new file mode 100644 index 0000000..5f043d7 --- /dev/null +++ b/UI/Inventory/UserInventory.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=3 format=3 uid="uid://drr0ptd6k6uch"] + +[ext_resource type="Script" path="res://UI/Inventory/UserInventory.gd" id="1_4kopu"] +[ext_resource type="PackedScene" uid="uid://defhc376y3h1d" path="res://UI/Inventory/InventorySlot.tscn" id="1_a71mm"] + +[node name="UserInventory" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_4kopu") + +[node name="Panel" type="Panel" parent="."] +custom_minimum_size = Vector2(430, 75) +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -20.0 +offset_top = -40.0 +offset_right = 20.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="HBoxContainer" type="HBoxContainer" parent="Panel"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 70 + +[node name="InventorySlot1" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 + +[node name="InventorySlot2" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="InventorySlot3" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="InventorySlot4" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="InventorySlot5" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="InventorySlot6" parent="Panel/HBoxContainer" instance=ExtResource("1_a71mm")] +layout_mode = 2 +size_flags_vertical = 4 diff --git a/UI/Inventory/circle_progress.png b/UI/Inventory/circle_progress.png new file mode 100644 index 0000000..55d87d0 Binary files /dev/null and b/UI/Inventory/circle_progress.png differ diff --git a/UI/Inventory/circle_progress.png.import b/UI/Inventory/circle_progress.png.import new file mode 100644 index 0000000..a978267 --- /dev/null +++ b/UI/Inventory/circle_progress.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://4txm3cwkoncp" +path="res://.godot/imported/circle_progress.png-d5c531fd8f1ad6ba679f56898ed82f77.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Inventory/circle_progress.png" +dest_files=["res://.godot/imported/circle_progress.png-d5c531fd8f1ad6ba679f56898ed82f77.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/UI/MainMenu/MainMenu.tscn b/UI/MainMenu/MainMenu.tscn deleted file mode 100644 index c916578..0000000 --- a/UI/MainMenu/MainMenu.tscn +++ /dev/null @@ -1,9 +0,0 @@ -[gd_scene format=3 uid="uid://bk6yvc16x1n2k"] - -[node name="MainMenu" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 diff --git a/UI/PressStart2P-Regular.ttf b/UI/PressStart2P-Regular.ttf new file mode 100644 index 0000000..2442aff Binary files /dev/null and b/UI/PressStart2P-Regular.ttf differ diff --git a/UI/PressStart2P-Regular.ttf.import b/UI/PressStart2P-Regular.ttf.import new file mode 100644 index 0000000..0b544a4 --- /dev/null +++ b/UI/PressStart2P-Regular.ttf.import @@ -0,0 +1,33 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://dj4pldmxeqmtt" +path="res://.godot/imported/PressStart2P-Regular.ttf-b544637742bbc31771794f033e160209.fontdata" + +[deps] + +source_file="res://UI/PressStart2P-Regular.ttf" +dest_files=["res://.godot/imported/PressStart2P-Regular.ttf-b544637742bbc31771794f033e160209.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/default_theme.tres b/UI/default_theme.tres new file mode 100644 index 0000000..c675724 --- /dev/null +++ b/UI/default_theme.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://6c4dxc8quyaj"] + +[ext_resource type="FontFile" uid="uid://dj4pldmxeqmtt" path="res://UI/PressStart2P-Regular.ttf" id="1_yf020"] + +[resource] +default_font = ExtResource("1_yf020") diff --git a/project.godot b/project.godot index 0a57a5e..605ef3d 100644 --- a/project.godot +++ b/project.godot @@ -18,7 +18,6 @@ config/icon="res://icon.svg" [display] window/stretch/mode="viewport" -window/stretch/scale=2.0 [input] @@ -29,7 +28,7 @@ reset_pos={ } print_pos={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":0,"echo":false,"script":null) +"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":4194440,"key_label":0,"unicode":50,"echo":false,"script":null) ] } speed_up={ @@ -72,6 +71,21 @@ test_force={ "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":4194441,"key_label":0,"unicode":51,"echo":false,"script":null) ] } +cycle_up={ +"deadzone": 0.5, +"events": [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":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"pressed":false,"double_click":false,"script":null) +] +} +cycle_down={ +"deadzone": 0.5, +"events": [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":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"pressed":false,"double_click":false,"script":null) +] +} +drop_item={ +"deadzone": 0.5, +"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":81,"key_label":0,"unicode":113,"echo":false,"script":null) +] +} [physics]