-
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.
- Loading branch information
Showing
16 changed files
with
420 additions
and
97 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://bjxu5n6jwtw21" | ||
path="res://.godot/imported/logo.png-e2220799298e3631eb0e245316e0501a.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/logo.png" | ||
dest_files=["res://.godot/imported/logo.png-e2220799298e3631eb0e245316e0501a.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 |
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,107 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://cq6ckyed0ps4t"] | ||
|
||
[ext_resource type="Theme" uid="uid://dsugnc7jkb7q5" path="res://themes/main.tres" id="1_njgw4"] | ||
[ext_resource type="Script" path="res://scripts/Level.gd" id="2_rrx3j"] | ||
|
||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ge2tl"] | ||
bg_color = Color(0.0745098, 0.0745098, 0.0745098, 0.921569) | ||
|
||
[node name="Level" 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 | ||
theme = ExtResource("1_njgw4") | ||
script = ExtResource("2_rrx3j") | ||
|
||
[node name="Control" type="Control" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_left = 20.0 | ||
offset_top = 20.0 | ||
offset_right = -20.0 | ||
offset_bottom = -20.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
mouse_filter = 2 | ||
|
||
[node name="Time" type="Label" parent="Control"] | ||
layout_mode = 1 | ||
anchors_preset = 1 | ||
anchor_left = 1.0 | ||
anchor_right = 1.0 | ||
offset_left = -90.0 | ||
offset_bottom = 38.0 | ||
grow_horizontal = 0 | ||
theme_override_font_sizes/font_size = 30 | ||
text = "00:01" | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"] | ||
layout_mode = 1 | ||
anchors_preset = 9 | ||
anchor_bottom = 1.0 | ||
offset_right = 167.0 | ||
grow_vertical = 2 | ||
|
||
[node name="Label" type="Label" parent="Control/VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 30 | ||
text = "Objectives" | ||
|
||
[node name="HSeparator" type="HSeparator" parent="Control/VBoxContainer"] | ||
layout_mode = 2 | ||
|
||
[node name="Spacer" type="Control" parent="Control/VBoxContainer"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
|
||
[node name="GameOver" type="Panel" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme_override_styles/panel = SubResource("StyleBoxFlat_ge2tl") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="GameOver"] | ||
layout_mode = 1 | ||
anchors_preset = 13 | ||
anchor_left = 0.5 | ||
anchor_right = 0.5 | ||
anchor_bottom = 1.0 | ||
offset_left = -173.5 | ||
offset_right = 173.5 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
alignment = 1 | ||
|
||
[node name="Label" type="Label" parent="GameOver/VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 60 | ||
text = "GAME OVER" | ||
horizontal_alignment = 1 | ||
vertical_alignment = 1 | ||
|
||
[node name="Control" type="Control" parent="GameOver/VBoxContainer"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
mouse_filter = 2 | ||
|
||
[node name="HBoxContainer" type="HBoxContainer" parent="GameOver/VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_constants/separation = 20 | ||
alignment = 1 | ||
|
||
[node name="Button" type="Button" parent="GameOver/VBoxContainer/HBoxContainer"] | ||
layout_mode = 2 | ||
text = "main menu" | ||
|
||
[node name="Button2" type="Button" parent="GameOver/VBoxContainer/HBoxContainer"] | ||
layout_mode = 2 | ||
text = "restart level" |
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 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
Large diffs are not rendered by default.
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,65 @@ | ||
[gd_scene load_steps=5 format=3 uid="uid://6a8n0e0kkslr"] | ||
|
||
[ext_resource type="Theme" uid="uid://dsugnc7jkb7q5" path="res://themes/main.tres" id="1_05twq"] | ||
[ext_resource type="Script" path="res://scripts/MainMenu.gd" id="2_6abnn"] | ||
[ext_resource type="Texture2D" uid="uid://c2udkkfuwbis0" path="res://assets/warn.png" id="2_ca7mh"] | ||
[ext_resource type="PackedScene" uid="uid://bhjkcskfwdbug" path="res://scenes/Level1.tscn" id="3_nclby"] | ||
|
||
[node name="MainMenu" type="CenterContainer"] | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme = ExtResource("1_05twq") | ||
script = ExtResource("2_6abnn") | ||
start_level = ExtResource("3_nclby") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="."] | ||
layout_mode = 2 | ||
|
||
[node name="Control" type="Control" parent="VBoxContainer"] | ||
custom_minimum_size = Vector2(500, 100) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
|
||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Control"] | ||
layout_mode = 1 | ||
anchors_preset = 1 | ||
anchor_left = 1.0 | ||
anchor_right = 1.0 | ||
offset_left = -43.9999 | ||
offset_top = -85.0 | ||
offset_right = -11.9999 | ||
offset_bottom = -53.0 | ||
grow_horizontal = 0 | ||
rotation = 0.401426 | ||
scale = Vector2(4.5, 4.5) | ||
texture = ExtResource("2_ca7mh") | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer/Control"] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_right = 1.0 | ||
offset_bottom = 2.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme_override_font_sizes/font_size = 86 | ||
text = "LOCO LOGIC" | ||
horizontal_alignment = 1 | ||
vertical_alignment = 1 | ||
uppercase = true | ||
|
||
[node name="Control2" type="Control" parent="VBoxContainer"] | ||
custom_minimum_size = Vector2(0, 15) | ||
layout_mode = 2 | ||
|
||
[node name="Button" type="Button" parent="VBoxContainer"] | ||
custom_minimum_size = Vector2(75, 0) | ||
layout_mode = 2 | ||
size_flags_horizontal = 4 | ||
text = "Start" | ||
|
||
[connection signal="pressed" from="VBoxContainer/Button" to="." method="_on_start_button_pressed"] |
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,49 @@ | ||
extends Control | ||
|
||
@onready var _time_display: Label = $Control/Time | ||
@onready var _objective_container: Container = $Control/VBoxContainer | ||
@onready var _game_over: Control = $GameOver | ||
|
||
var _start_time_ms: int | ||
var _routes: Array[TrainRoute] | ||
var _route_labels: Array[Label] | ||
var _objective_counters: Array[int] | ||
|
||
func _ready() -> void: | ||
self._start_time_ms = Time.get_ticks_msec() | ||
self._game_over.set_visible(false) | ||
|
||
var tree := self.get_tree() | ||
self._routes.assign(tree.get_nodes_in_group("train_route")) | ||
|
||
var route_idx := 0 | ||
for route in self._routes: | ||
route.train_stopped.connect(self._on_train_stopped.bind(route_idx)) | ||
route.train_game_over.connect(self._on_train_game_over.bind(route_idx)) | ||
|
||
var label := Label.new() | ||
self._objective_container.add_child(label) | ||
self._route_labels.push_back(label) | ||
self._objective_counters.push_back(0) | ||
self._update_objective(route_idx) | ||
|
||
route_idx += 1 | ||
|
||
func _process(_delta: float) -> void: | ||
var offset_ms := Time.get_ticks_msec() - self._start_time_ms | ||
var secs := int(offset_ms / 1000.0) % 60 | ||
var minutes = int(offset_ms / 60_000.0) | ||
self._time_display.text = "%d:%02d" % [minutes, secs] | ||
|
||
func _on_train_game_over(_train: TrainEngine, _route_idx: int) -> void: | ||
self._game_over.set_visible(true) | ||
|
||
func _on_train_stopped(_train: TrainEngine, route_idx: int) -> void: | ||
self._objective_counters[route_idx] += 1 | ||
self._update_objective(route_idx) | ||
|
||
func _update_objective(route_idx: int) -> void: | ||
var route := self._routes[route_idx] | ||
var label := self._route_labels[route_idx] | ||
var counter := self._objective_counters[route_idx] | ||
label.text = "%s: %s/5" % [route.route_name, counter] |
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,6 @@ | ||
extends CenterContainer | ||
|
||
@export var start_level: PackedScene | ||
|
||
func _on_start_button_pressed() -> void: | ||
self.get_tree().change_scene_to_packed(self.start_level) |
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
Oops, something went wrong.