Skip to content

Commit afd9823

Browse files
committed
feat: add placeholder playing screen
1 parent e5ddba7 commit afd9823

File tree

6 files changed

+93
-3
lines changed

6 files changed

+93
-3
lines changed

LevelSelect.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ func _ready():
1212
button.text = level
1313
button.align = Button.ALIGN_LEFT
1414
button.connect("focus_entered", self, "_on_Button_focus_changed")
15+
button.connect("pressed", self, "_on_Button_pressed", [level])
1516
$LevelsBorder/Levels.add_child(button)
1617
if first:
1718
button.grab_focus()
1819
first = false
1920

2021
func _on_Button_focus_changed():
2122
$PreviewBorder/Preview/Info.text = levels[get_focus_owner().text]["about"]
23+
24+
func _on_Button_pressed(level):
25+
SceneSwitcher.change_scene("res://PlayingScreen.tscn", {"level": level})

MainMenu.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ func _ready():
44
$StartButton.grab_focus()
55

66
func _on_StartButton_pressed():
7-
get_tree().change_scene("res://LevelSelect.tscn")
7+
SceneSwitcher.change_scene("res://LevelSelect.tscn")

PlayingScreen.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends VBoxContainer
2+
3+
func _ready():
4+
$HUDBorder/HUD/Level.text = SceneSwitcher.get_param("level")
5+
6+
# Called every frame. 'delta' is the elapsed time since the previous frame.
7+
#func _process(delta):
8+
# pass

PlayingScreen.tscn

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[gd_scene load_steps=4 format=2]
2+
3+
[ext_resource path="res://theme.theme" type="Theme" id=1]
4+
[ext_resource path="res://BorderRect.gd" type="Script" id=2]
5+
[ext_resource path="res://PlayingScreen.gd" type="Script" id=3]
6+
7+
[node name="Viewport" type="MarginContainer"]
8+
anchor_right = 1.0
9+
anchor_bottom = 1.0
10+
custom_constants/margin_right = 30
11+
custom_constants/margin_top = 30
12+
custom_constants/margin_left = 30
13+
custom_constants/margin_bottom = 30
14+
__meta__ = {
15+
"_edit_use_anchors_": false
16+
}
17+
18+
[node name="PlayingScreen" type="VBoxContainer" parent="."]
19+
margin_left = 30.0
20+
margin_top = 30.0
21+
margin_right = 1890.0
22+
margin_bottom = 1050.0
23+
theme = ExtResource( 1 )
24+
script = ExtResource( 3 )
25+
26+
[node name="HUDBorder" type="MarginContainer" parent="PlayingScreen"]
27+
margin_right = 1860.0
28+
margin_bottom = 78.0
29+
script = ExtResource( 2 )
30+
31+
[node name="HUD" type="HBoxContainer" parent="PlayingScreen/HUDBorder"]
32+
margin_left = 20.0
33+
margin_top = 20.0
34+
margin_right = 1840.0
35+
margin_bottom = 58.0
36+
37+
[node name="Level" type="Label" parent="PlayingScreen/HUDBorder/HUD"]
38+
margin_right = 906.0
39+
margin_bottom = 38.0
40+
size_flags_horizontal = 3
41+
text = "LEVEL"
42+
43+
[node name="Score" type="Label" parent="PlayingScreen/HUDBorder/HUD"]
44+
margin_left = 914.0
45+
margin_right = 1820.0
46+
margin_bottom = 38.0
47+
size_flags_horizontal = 3
48+
text = "SCORE"
49+
align = 2
50+
51+
[node name="DisplayBorder" type="MarginContainer" parent="PlayingScreen"]
52+
margin_top = 86.0
53+
margin_right = 1860.0
54+
margin_bottom = 1020.0
55+
size_flags_vertical = 3
56+
script = ExtResource( 2 )
57+
58+
[node name="Display" type="Control" parent="PlayingScreen/DisplayBorder"]
59+
margin_left = 20.0
60+
margin_top = 20.0
61+
margin_right = 1840.0
62+
margin_bottom = 914.0

SceneSwitcher.gd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extends Node
2+
3+
var _params = null
4+
5+
func change_scene(next_scene, params=null):
6+
_params = params
7+
get_tree().change_scene(next_scene)
8+
9+
func get_param(name):
10+
if _params != null and _params.has(name):
11+
return _params[name]
12+
return null

project.godot

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ _global_script_class_icons={
1616
[application]
1717

1818
config/name="Human Computer Simulator"
19-
run/main_scene="res://LevelSelect.tscn"
19+
run/main_scene="res://MainMenu.tscn"
2020
run/low_processor_mode=true
2121
boot_splash/image="res://splash.png"
2222

23+
[autoload]
24+
25+
SceneSwitcher="*res://SceneSwitcher.gd"
26+
2327
[display]
2428

2529
window/size/width=1920
@@ -29,7 +33,7 @@ window/stretch/mode="2d"
2933

3034
[editor_plugins]
3135

32-
enabled=PoolStringArray( "BorderRect" )
36+
enabled=PoolStringArray( )
3337

3438
[gui]
3539

0 commit comments

Comments
 (0)