Skip to content

Commit

Permalink
change level OK
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsOuvrard committed Nov 24, 2024
1 parent 213ea48 commit 1102054
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
5 changes: 1 addition & 4 deletions Scenes/gameplay.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://cl2bfax75pt7d"]
[gd_scene load_steps=5 format=3 uid="uid://cl2bfax75pt7d"]

[ext_resource type="PackedScene" uid="uid://c43q6ncwe5wl0" path="res://Scenes/hud.tscn" id="1_4fvy5"]
[ext_resource type="Script" path="res://Scripts/gameplay.gd" id="1_wtfop"]
[ext_resource type="AudioStream" uid="uid://bxx6my6krp8pu" path="res://Assets/Sounds/MusicOld/AudioMain.mp3" id="3_0lt7v"]
[ext_resource type="PackedScene" uid="uid://f7hotqo1373f" path="res://Scenes/greed.tscn" id="3_bncwm"]
[ext_resource type="PackedScene" uid="uid://smk6r6ygbleh" path="res://Scenes/ConfigPanel.tscn" id="4_rxlm5"]

[node name="Gameplay" type="Node2D"]
Expand All @@ -21,8 +20,6 @@ grow_horizontal = 2
grow_vertical = 2
color = Color(0.117227, 3.39021e-06, 0.0957673, 1)

[node name="Greed" parent="." instance=ExtResource("3_bncwm")]

[node name="GamePlayAudio" type="AudioStreamPlayer2D" parent="."]
process_mode = 3
stream = ExtResource("3_0lt7v")
Expand Down
2 changes: 2 additions & 0 deletions Scripts/Autoload/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ func drop_random_item(position: Vector2, parent: Node2D, unlocked_weapons: Dicti
item.type = items_dropabale.pick_random()

parent.add_child(item)

var level_selected := 0
10 changes: 10 additions & 0 deletions Scripts/gameplay.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
extends Node2D

const levels = [
preload("res://Scenes/greed.tscn"),
preload("res://Scenes/Betreyal.tscn"),
preload("res://Scenes/Wrath.tscn")
]

func _ready() -> void:
var actual_level = levels[Global.level_selected].instantiate()
add_child(actual_level)

func _process(delta: float) -> void:
if Input.is_action_just_pressed("open_config"):
$CanvasPanel/ConfigPanel.show()
Expand Down
9 changes: 5 additions & 4 deletions Scripts/level_selector.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func _ready() -> void:
timer.start()

func _process(delta: float) -> void:
if Input.is_action_pressed('move_right'):
if Input.is_action_just_pressed('move_right'):
change_selected_level(1)
if Input.is_action_pressed('move_left'):
if Input.is_action_just_pressed('move_left'):
change_selected_level(-1)

if Input.is_action_pressed("shoot"):

if Input.is_action_just_pressed("shoot"):
Global.level_selected = selected
get_tree().change_scene_to_file("res://Scenes/gameplay.tscn")
2 changes: 1 addition & 1 deletion Tres/player.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="SpriteFrames" load_steps=32 format=3 uid="uid://ckdgo5jwfioc5"]
[gd_resource type="SpriteFrames" load_steps=32 format=3 uid="uid://bh0tmettehkq5"]

[ext_resource type="Texture2D" uid="uid://rhxx7fe8qg4m" path="res://Assets/Characters/AngelSprite.png" id="1_t2y18"]

Expand Down
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ open_config={
"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":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

Expand Down

0 comments on commit 1102054

Please sign in to comment.