diff --git a/scenes/Game_Scene.tscn b/scenes/Game_Scene.tscn new file mode 100644 index 0000000..4b36b58 --- /dev/null +++ b/scenes/Game_Scene.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=4 format=3 uid="uid://bkgu1a3lnxnui"] + +[ext_resource type="Script" uid="uid://sjgbdq7xije" path="res://scenes/game_scene.gd" id="1_xv2b7"] +[ext_resource type="PackedScene" uid="uid://bojb35864qt8e" path="res://scenes/hero.tscn" id="1_xv4of"] +[ext_resource type="Script" uid="uid://coqdjfhn4plph" path="res://scripts/characters/player.gd" id="2_xv2b7"] + +[node name="GameScene" type="Node"] +script = ExtResource("1_xv2b7") + +[node name="Hero" parent="." instance=ExtResource("1_xv4of")] +script = ExtResource("2_xv2b7") diff --git a/scenes/game_scene.gd b/scenes/game_scene.gd new file mode 100644 index 0000000..ffa2f37 --- /dev/null +++ b/scenes/game_scene.gd @@ -0,0 +1,10 @@ +extends Node + +signal open_game + +func _ready() -> void: + print("Game scene ready") + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/scenes/game_scene.gd.uid b/scenes/game_scene.gd.uid new file mode 100644 index 0000000..08e5dbe --- /dev/null +++ b/scenes/game_scene.gd.uid @@ -0,0 +1 @@ +uid://sjgbdq7xije diff --git a/scenes/hero.tscn b/scenes/hero.tscn new file mode 100644 index 0000000..0315a38 --- /dev/null +++ b/scenes/hero.tscn @@ -0,0 +1,502 @@ +[gd_scene load_steps=73 format=3 uid="uid://bojb35864qt8e"] + +[ext_resource type="Texture2D" uid="uid://dcmhtymn7nmta" path="res://assets/Hero/IDLE/idle_down.png" id="1_n40cg"] +[ext_resource type="Texture2D" uid="uid://b2pfov82738xo" path="res://assets/Hero/IDLE/idle_left.png" id="2_txblw"] +[ext_resource type="Texture2D" uid="uid://d0d02ok6v7esf" path="res://assets/Hero/IDLE/idle_right.png" id="3_n5qna"] +[ext_resource type="Texture2D" uid="uid://dnhopng8ws1lo" path="res://assets/Hero/IDLE/idle_up.png" id="4_d6xj2"] +[ext_resource type="Texture2D" uid="uid://fcm6d22eb6dv" path="res://assets/Hero/RUN/run_down.png" id="5_sryfu"] +[ext_resource type="Texture2D" uid="uid://cim03822crp33" path="res://assets/Hero/RUN/run_left.png" id="6_6mqrs"] +[ext_resource type="Texture2D" uid="uid://b8ib42gdqbyko" path="res://assets/Hero/RUN/run_right.png" id="7_k8rms"] +[ext_resource type="Texture2D" uid="uid://bnl11lwoesv5q" path="res://assets/Hero/RUN/run_up.png" id="8_lunib"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_2grt1"] +atlas = ExtResource("1_n40cg") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wynkb"] +atlas = ExtResource("1_n40cg") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fuux7"] +atlas = ExtResource("1_n40cg") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8m75t"] +atlas = ExtResource("1_n40cg") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rvoeo"] +atlas = ExtResource("1_n40cg") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_syei6"] +atlas = ExtResource("1_n40cg") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_85qs6"] +atlas = ExtResource("1_n40cg") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wc88v"] +atlas = ExtResource("1_n40cg") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kt0c4"] +atlas = ExtResource("2_txblw") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rpah5"] +atlas = ExtResource("2_txblw") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4kg8r"] +atlas = ExtResource("2_txblw") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4ul70"] +atlas = ExtResource("2_txblw") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_61g13"] +atlas = ExtResource("2_txblw") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7l7r2"] +atlas = ExtResource("2_txblw") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nh6g3"] +atlas = ExtResource("2_txblw") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8v78m"] +atlas = ExtResource("2_txblw") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_48qaf"] +atlas = ExtResource("3_n5qna") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_delsk"] +atlas = ExtResource("3_n5qna") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_158md"] +atlas = ExtResource("3_n5qna") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j0f64"] +atlas = ExtResource("3_n5qna") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_akksl"] +atlas = ExtResource("3_n5qna") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u7rdq"] +atlas = ExtResource("3_n5qna") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pku1t"] +atlas = ExtResource("3_n5qna") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fd06a"] +atlas = ExtResource("3_n5qna") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dvtb3"] +atlas = ExtResource("4_d6xj2") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u7y3v"] +atlas = ExtResource("4_d6xj2") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u7ksq"] +atlas = ExtResource("4_d6xj2") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lyirt"] +atlas = ExtResource("4_d6xj2") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pasmt"] +atlas = ExtResource("4_d6xj2") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tsxnk"] +atlas = ExtResource("4_d6xj2") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6xrt3"] +atlas = ExtResource("4_d6xj2") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_54d4v"] +atlas = ExtResource("4_d6xj2") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_m72ym"] +atlas = ExtResource("5_sryfu") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5e70t"] +atlas = ExtResource("5_sryfu") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5dxqo"] +atlas = ExtResource("5_sryfu") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4v2qv"] +atlas = ExtResource("5_sryfu") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_05r1h"] +atlas = ExtResource("5_sryfu") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i8in1"] +atlas = ExtResource("5_sryfu") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hn7jl"] +atlas = ExtResource("5_sryfu") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jjdmo"] +atlas = ExtResource("5_sryfu") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ffar2"] +atlas = ExtResource("6_6mqrs") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_t0jj8"] +atlas = ExtResource("6_6mqrs") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bjjcb"] +atlas = ExtResource("6_6mqrs") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1ktsb"] +atlas = ExtResource("6_6mqrs") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5gu81"] +atlas = ExtResource("6_6mqrs") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ps45g"] +atlas = ExtResource("6_6mqrs") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fbll3"] +atlas = ExtResource("6_6mqrs") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_aw3ld"] +atlas = ExtResource("6_6mqrs") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pfjxo"] +atlas = ExtResource("7_k8rms") +region = Rect2(0, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lrikj"] +atlas = ExtResource("7_k8rms") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rx3em"] +atlas = ExtResource("7_k8rms") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_se6mv"] +atlas = ExtResource("7_k8rms") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qvhjw"] +atlas = ExtResource("7_k8rms") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_12dr8"] +atlas = ExtResource("7_k8rms") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ov74w"] +atlas = ExtResource("7_k8rms") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d0tjj"] +atlas = ExtResource("7_k8rms") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dh4be"] +atlas = ExtResource("8_lunib") +region = Rect2(96, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_a8lnc"] +atlas = ExtResource("8_lunib") +region = Rect2(192, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jniie"] +atlas = ExtResource("8_lunib") +region = Rect2(288, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d88lm"] +atlas = ExtResource("8_lunib") +region = Rect2(384, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mpkdo"] +atlas = ExtResource("8_lunib") +region = Rect2(480, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oayr2"] +atlas = ExtResource("8_lunib") +region = Rect2(576, 0, 96, 80) + +[sub_resource type="AtlasTexture" id="AtlasTexture_p0r7a"] +atlas = ExtResource("8_lunib") +region = Rect2(672, 0, 96, 80) + +[sub_resource type="SpriteFrames" id="SpriteFrames_6biqx"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_2grt1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wynkb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fuux7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8m75t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rvoeo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_syei6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_85qs6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wc88v") +}], +"loop": true, +"name": &"IdleDown", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_kt0c4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rpah5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4kg8r") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4ul70") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_61g13") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7l7r2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nh6g3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8v78m") +}], +"loop": true, +"name": &"IdleLeft", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_48qaf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_delsk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_158md") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j0f64") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_akksl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u7rdq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pku1t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fd06a") +}], +"loop": true, +"name": &"IdleRight", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_dvtb3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u7y3v") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u7ksq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lyirt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pasmt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tsxnk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6xrt3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_54d4v") +}], +"loop": true, +"name": &"IdleUp", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_m72ym") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5e70t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5dxqo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4v2qv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_05r1h") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i8in1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hn7jl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jjdmo") +}], +"loop": true, +"name": &"RunDown", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ffar2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_t0jj8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bjjcb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1ktsb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5gu81") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ps45g") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fbll3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_aw3ld") +}], +"loop": true, +"name": &"RunLeft", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_pfjxo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lrikj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rx3em") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_se6mv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qvhjw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_12dr8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ov74w") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d0tjj") +}], +"loop": true, +"name": &"RunRight", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_dh4be") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_a8lnc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jniie") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d88lm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mpkdo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oayr2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_p0r7a") +}], +"loop": true, +"name": &"RunUp", +"speed": 5.0 +}] + +[node name="Hero" type="CharacterBody2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +sprite_frames = SubResource("SpriteFrames_6biqx") +animation = &"RunUp" diff --git a/scripts/Main.gd b/scripts/Main.gd index ffa581c..6140840 100644 --- a/scripts/Main.gd +++ b/scripts/Main.gd @@ -12,10 +12,18 @@ func _on_any_key_pressed(): press_any_key_screen.queue_free() show_main_menu() +func show_game(): + print("Starting game scene") + clear_current_menu() + var game_scene = preload("res://scenes/Game_Scene.tscn").instantiate() + add_child(game_scene) + current_menu = game_scene + func show_main_menu(): clear_current_menu() var main_menu = preload("res://ui/MainMenu.tscn").instantiate() main_menu.open_settings.connect(_on_open_settings) + main_menu.open_game.connect(_on_open_game) add_child(main_menu) current_menu = main_menu @@ -31,6 +39,10 @@ func clear_current_menu(): current_menu.queue_free() current_menu = null +func _on_open_game(): + print("Starting new game") + show_game() + func _on_open_settings(): print("Opening settings menu") show_settings_menu() diff --git a/scripts/MainMenu.gd b/scripts/MainMenu.gd index 9666396..6cc658d 100644 --- a/scripts/MainMenu.gd +++ b/scripts/MainMenu.gd @@ -1,12 +1,14 @@ extends Control signal open_settings +signal open_game func _ready(): print("MainMenu ready") func _on_new_game_button_pressed(): print("New Game pressed") + open_game.emit() func _on_settings_button_pressed(): print("Settings pressed") diff --git a/scripts/characters/player.gd b/scripts/characters/player.gd new file mode 100644 index 0000000..f0e93bc --- /dev/null +++ b/scripts/characters/player.gd @@ -0,0 +1,37 @@ +extends CharacterBody2D + +const SPEED = 300.0 +const JUMP_VELOCITY = -400.0 +var last_direction = Vector2.DOWN + +func get_input(): + var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down") + velocity = input_direction * SPEED + return input_direction + +func _physics_process(delta: float) -> void: + print(get_input()) + move_and_slide() + +func _process(delta: float) -> void: + if not $AnimatedSprite2D: + return + + var input_direction = get_input() + var animation_name = "" + + if input_direction != Vector2.ZERO: + last_direction = input_direction + # Determine dominant direction and build animation name + if abs(input_direction.x) > abs(input_direction.y): + animation_name = "Run" + ("Right" if input_direction.x > 0 else "Left") + else: + animation_name = "Run" + ("Down" if input_direction.y > 0 else "Up") + else: + # Use last direction for idle + if abs(last_direction.x) > abs(last_direction.y): + animation_name = "Idle" + ("Right" if last_direction.x > 0 else "Left") + else: + animation_name = "Idle" + ("Down" if last_direction.y > 0 else "Up") + + $AnimatedSprite2D.play(animation_name) diff --git a/scripts/characters/player.gd.uid b/scripts/characters/player.gd.uid new file mode 100644 index 0000000..90d6253 --- /dev/null +++ b/scripts/characters/player.gd.uid @@ -0,0 +1 @@ +uid://coqdjfhn4plph