-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix files names and scenes redirections
- Loading branch information
1 parent
39f5e38
commit 2b8d601
Showing
7 changed files
with
175 additions
and
175 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://i3ykfveqetl4"] | ||
|
||
[ext_resource type="Script" path="res://Scripts/level_selector.gd" id="1_4p460"] | ||
[ext_resource type="Texture2D" uid="uid://cqi8u3nvojiy4" path="res://Assets/LevelSelector/SelectorBackground.png" id="2_5sv25"] | ||
[ext_resource type="Texture2D" uid="uid://cpt418es6sb5l" path="res://Assets/LevelSelector/SelectorPortraits.png" id="3_ll71g"] | ||
[ext_resource type="Texture2D" uid="uid://bhoho7e10rr2a" path="res://Assets/LevelSelector/SelectorPortraitsSelected.png" id="4_3rinr"] | ||
[ext_resource type="Texture2D" uid="uid://g4pqx40sl7c2" path="res://Assets/LevelSelector/SelectorLetters.png" id="5_t80g8"] | ||
|
||
[node name="LevelSelector" type="CanvasLayer"] | ||
scale = Vector2(8, 8) | ||
transform = Transform2D(8, 0, 0, 8, 0, 0) | ||
script = ExtResource("1_4p460") | ||
|
||
[node name="BackControl" type="Control" parent="."] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_right = -1680.0 | ||
offset_bottom = -945.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="SelectorBackground" type="Sprite2D" parent="BackControl"] | ||
position = Vector2(120, 67) | ||
texture = ExtResource("2_5sv25") | ||
|
||
[node name="Portraits" type="Sprite2D" parent="."] | ||
position = Vector2(120, 60) | ||
texture = ExtResource("3_ll71g") | ||
|
||
[node name="PortraitsSelected" type="Sprite2D" parent="."] | ||
position = Vector2(120, 60) | ||
texture = ExtResource("4_3rinr") | ||
hframes = 3 | ||
frame = 1 | ||
|
||
[node name="Level" type="Sprite2D" parent="."] | ||
position = Vector2(120, 100.25) | ||
texture = ExtResource("5_t80g8") | ||
vframes = 2 | ||
frame = 1 | ||
|
||
[node name="Timer" type="Timer" parent="."] | ||
one_shot = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,50 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://i3ykfveqetl4"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://cqi8u3nvojiy4" path="res://Assets/LevelSelector/SelectorBackground.png" id="1_rhggr"] | ||
[ext_resource type="Script" path="res://Scripts/main_menu.gd" id="1_tl73e"] | ||
[ext_resource type="Texture2D" uid="uid://cpt418es6sb5l" path="res://Assets/LevelSelector/SelectorPortraits.png" id="3_8aw0s"] | ||
[ext_resource type="Texture2D" uid="uid://bhoho7e10rr2a" path="res://Assets/LevelSelector/SelectorPortraitsSelected.png" id="4_crv7d"] | ||
[ext_resource type="Texture2D" uid="uid://g4pqx40sl7c2" path="res://Assets/LevelSelector/SelectorLetters.png" id="5_eb2uc"] | ||
[ext_resource type="Script" path="res://Scripts/main_menu.gd" id="1_ywcby"] | ||
[ext_resource type="Texture2D" uid="uid://dp0uwqsv72oo7" path="res://Assets/MainMenu/MainMenu.png" id="2_fe0g3"] | ||
[ext_resource type="AudioStream" uid="uid://bxx6my6krp8pu" path="res://Assets/Sounds/Music/AudioMain.mp3" id="3_02vt3"] | ||
[ext_resource type="Texture2D" uid="uid://c7kt4n44dxfnf" path="res://Assets/MainMenu/Buttons.png" id="4_1gwcj"] | ||
[ext_resource type="PackedScene" uid="uid://smk6r6ygbleh" path="res://Scenes/ConfigPanel.tscn" id="5_fquun"] | ||
|
||
[node name="MainMenu" type="CanvasLayer"] | ||
scale = Vector2(8, 8) | ||
transform = Transform2D(8, 0, 0, 8, 0, 0) | ||
script = ExtResource("1_tl73e") | ||
script = ExtResource("1_ywcby") | ||
|
||
[node name="BackControl" type="Control" parent="."] | ||
[node name="Control" type="Control" parent="."] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_right = -1680.0 | ||
offset_bottom = -945.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="SelectorBackground" type="Sprite2D" parent="BackControl"] | ||
position = Vector2(120, 67) | ||
texture = ExtResource("1_rhggr") | ||
|
||
[node name="Portraits" type="Sprite2D" parent="."] | ||
position = Vector2(120, 60) | ||
texture = ExtResource("3_8aw0s") | ||
|
||
[node name="PortraitsSelected" type="Sprite2D" parent="."] | ||
position = Vector2(120, 60) | ||
texture = ExtResource("4_crv7d") | ||
hframes = 3 | ||
frame = 1 | ||
|
||
[node name="Level" type="Sprite2D" parent="."] | ||
position = Vector2(120, 100.25) | ||
texture = ExtResource("5_eb2uc") | ||
vframes = 2 | ||
frame = 1 | ||
[node name="MainMenu" type="Sprite2D" parent="Control"] | ||
position = Vector2(959.5, 539.5) | ||
scale = Vector2(7.50391, 7.52083) | ||
texture = ExtResource("2_fe0g3") | ||
|
||
[node name="Timer" type="Timer" parent="."] | ||
one_shot = true | ||
|
||
[node name="AudioTitle" type="AudioStreamPlayer2D" parent="."] | ||
stream = ExtResource("3_02vt3") | ||
volume_db = 2.0 | ||
autoplay = true | ||
parameters/looping = true | ||
|
||
[node name="Buttons" type="Sprite2D" parent="."] | ||
position = Vector2(216, 420) | ||
scale = Vector2(7.72727, 7.72727) | ||
texture = ExtResource("4_1gwcj") | ||
centered = false | ||
hframes = 2 | ||
|
||
[node name="ButtonSelected" type="Sprite2D" parent="Buttons"] | ||
texture = ExtResource("4_1gwcj") | ||
centered = false | ||
hframes = 2 | ||
vframes = 5 | ||
|
||
[node name="ConfigPanel" parent="." node_paths=PackedStringArray("background_music") instance=ExtResource("5_fquun")] | ||
visible = false | ||
background_music = NodePath("../AudioTitle") | ||
|
||
[connection signal="closed" from="ConfigPanel" to="." method="_on_config_panel_closed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
extends CanvasLayer | ||
|
||
@onready var portrait: Sprite2D = $PortraitsSelected | ||
@onready var letters: Sprite2D = $Letters | ||
@onready var timer: Timer = $Timer | ||
|
||
const SCREEN_X_SIZE = 240 | ||
const NUMBER_NIVELS = 3 | ||
|
||
var selected = 0: | ||
set(value): | ||
selected = value % NUMBER_NIVELS | ||
if selected < 0: | ||
selected = NUMBER_NIVELS - 1 | ||
|
||
func change_selected_level(value): | ||
if timer.is_stopped(): | ||
timer.start() | ||
selected = selected + value | ||
portrait.frame = selected | ||
|
||
var image_size_x = portrait.texture.get_size().x / NUMBER_NIVELS | ||
portrait.position.x = (SCREEN_X_SIZE / 2) - image_size_x + (image_size_x * selected) | ||
|
||
func _ready() -> void: | ||
timer.wait_time = 0.1 | ||
timer.start() | ||
|
||
func _process(delta: float) -> void: | ||
if Input.is_action_pressed('move_right'): | ||
change_selected_level(1) | ||
if Input.is_action_pressed('move_left'): | ||
change_selected_level(-1) | ||
|
||
if Input.is_action_pressed("shoot"): | ||
get_tree().change_scene_to_file("res://Scenes/gameplay.tscn") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,65 @@ | ||
## Buttons and actions of the main screen | ||
## | ||
## Author: Sol Rojo[br]Date: 17-10-2024 | ||
## | ||
|
||
extends CanvasLayer | ||
|
||
@onready var portrait: Sprite2D = $PortraitsSelected | ||
@onready var letters: Sprite2D = $Letters | ||
@onready var background_music: AudioStreamPlayer2D = $AudioTitle | ||
@onready var button_selected_sprite: Sprite2D = $Buttons/ButtonSelected | ||
@onready var buttons_sprite: Sprite2D = $Buttons | ||
@onready var timer: Timer = $Timer | ||
|
||
const SCREEN_X_SIZE = 240 | ||
const NUMBER_NIVELS = 3 | ||
const NUMBER_BUTTONS = 5 | ||
|
||
var buttons_callbacks = [ | ||
func (): get_tree().change_scene_to_file("res://Scenes/gameplay.tscn"), | ||
func (): get_tree().change_scene_to_file("res://Scenes/main_menu.tscn"), | ||
func (): config_panel_open(), | ||
func (): get_tree().quit(), | ||
func (): return # TODO remove the 5th button on the picture | ||
] | ||
var PART_HEIGHT := 0 | ||
var pos_y_original := 0 | ||
var button_selected := 0 | ||
|
||
var selected = 0: | ||
set(value): | ||
selected = value % NUMBER_NIVELS | ||
if selected < 0: | ||
selected = NUMBER_NIVELS - 1 | ||
func _ready() -> void: | ||
background_music.play() | ||
PART_HEIGHT = buttons_sprite.texture.get_height() / NUMBER_BUTTONS | ||
pos_y_original = button_selected_sprite.position.y | ||
|
||
func change_selected_level(value): | ||
if timer.is_stopped(): | ||
timer.start() | ||
selected = selected + value | ||
portrait.frame = selected | ||
func change_selected(direction: int) -> void: | ||
button_selected = (button_selected + direction) % NUMBER_BUTTONS | ||
if button_selected < 0: # Godot doesn't have a modulo that works with negative numbers | ||
button_selected += NUMBER_BUTTONS | ||
button_selected_sprite.frame = button_selected * 2 + 1 | ||
button_selected_sprite.position.y = pos_y_original + button_selected * PART_HEIGHT | ||
|
||
var image_size_x = portrait.texture.get_size().x / NUMBER_NIVELS | ||
portrait.position.x = (SCREEN_X_SIZE / 2) - image_size_x + (image_size_x * selected) | ||
func config_panel_open(): | ||
get_tree().paused = true | ||
$ConfigPanel.show() | ||
|
||
func _ready() -> void: | ||
timer.wait_time = 0.1 | ||
timer.start() | ||
|
||
func _process(delta: float) -> void: | ||
if Input.is_action_pressed('move_right'): | ||
change_selected_level(1) | ||
if Input.is_action_pressed('move_left'): | ||
change_selected_level(-1) | ||
|
||
if Input.is_action_pressed("shoot"): | ||
get_tree().change_scene_to_file("res://Scenes/gameplay.tscn") | ||
|
||
func _process(_delta: float) -> void: | ||
if Input.is_action_just_pressed("ui_down"): | ||
change_selected(1) | ||
elif Input.is_action_just_pressed("ui_up"): | ||
change_selected(-1) | ||
elif Input.is_action_just_pressed("interact"): | ||
buttons_callbacks[button_selected].call() | ||
|
||
func _input(event: InputEvent) -> void: | ||
if event is InputEventMouseMotion: | ||
if buttons_sprite.get_rect().has_point(buttons_sprite.to_local(event.position)): | ||
var local_pos = buttons_sprite.to_local(event.position) | ||
var part = int(local_pos.y / PART_HEIGHT) | ||
button_selected = part | ||
button_selected_sprite.position.y = pos_y_original + part * PART_HEIGHT | ||
# 2 frames per height, +1 because right frame is the selected one | ||
button_selected_sprite.frame = part * 2 + 1 | ||
elif event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed: | ||
buttons_callbacks[button_selected].call() | ||
|
||
func _on_config_panel_closed() -> void: | ||
$ConfigPanel.hide() | ||
get_tree().paused = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.