Roughly reorganized UI into canvas layers in the game scene for Jennie.
This commit is contained in:
parent
f8fdeff2d6
commit
7939e77dff
11 changed files with 187 additions and 31 deletions
42
scenes/elevator_panel.gd
Normal file
42
scenes/elevator_panel.gd
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
extends Control
|
||||
|
||||
# I HAVE NO IDEA WHAT I'M DOIN!!!
|
||||
# Original version
|
||||
var current_floor := 10
|
||||
var saved_count := 0
|
||||
|
||||
var doors_closing := false
|
||||
|
||||
|
||||
func _ready():
|
||||
$PanelMargin/PanelColumn/CloseButton.pressed.connect(_on_close_pressed)
|
||||
# 10 floors is probably a lot but will make testing easier.
|
||||
#$StatsMargin/StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey and event.pressed and event.keycode == KEY_SPACE:
|
||||
_on_close_pressed()
|
||||
|
||||
func _on_close_pressed():
|
||||
# don't let 'em spam the button
|
||||
if doors_closing:
|
||||
return
|
||||
var screen = $ElevatorPanel/PanelMargin/PanelColumn/Screen
|
||||
var success = screen.attempt_hack()
|
||||
if success:
|
||||
doors_closing = true
|
||||
saved_count += 1
|
||||
current_floor -= 1
|
||||
$StatsMargin/StatsColumn/SavedLabel.text = "SAVED: " + str(saved_count)
|
||||
$StatsMargin/StatsColumn/FloorLabel.text = "FLOOR: " + str(current_floor)
|
||||
if current_floor <= 1:
|
||||
screen.show_win()
|
||||
else:
|
||||
screen.show_countdown()
|
||||
var tween = create_tween()
|
||||
tween.tween_callback(func():
|
||||
screen.reset_hack()
|
||||
doors_closing = false
|
||||
).set_delay(2.0)
|
||||
else:
|
||||
print("MISSED! AI is faster now!")
|
||||
68
scenes/elevator_panel.tscn
Normal file
68
scenes/elevator_panel.tscn
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
[gd_scene format=3 uid="uid://nca1hcujxru0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://k1n4iyxp4iww" path="res://scenes/elevator_panel.gd" id="1_1gr6t"]
|
||||
[ext_resource type="Script" uid="uid://kltqwef8yx3r" path="res://scenes/screen.gd" id="1_3gei6"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2snw"]
|
||||
bg_color = Color(0.039215688, 0.16470589, 0.039215688, 1)
|
||||
corner_radius_top_left = 4
|
||||
corner_radius_top_right = 4
|
||||
corner_radius_bottom_right = 4
|
||||
corner_radius_bottom_left = 4
|
||||
|
||||
[node name="ElevatorPanel" type="PanelContainer" unique_id=574176994]
|
||||
custom_minimum_size = Vector2(250, 0)
|
||||
anchors_preset = 11
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -8.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_1gr6t")
|
||||
|
||||
[node name="PanelMargin" type="MarginContainer" parent="." unique_id=1575963889]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 15
|
||||
theme_override_constants/margin_top = 15
|
||||
theme_override_constants/margin_right = 15
|
||||
theme_override_constants/margin_bottom = 15
|
||||
|
||||
[node name="PanelColumn" type="VBoxContainer" parent="PanelMargin" unique_id=434338875]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Screen" type="Panel" parent="PanelMargin/PanelColumn" unique_id=1395085208]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_n2snw")
|
||||
script = ExtResource("1_3gei6")
|
||||
|
||||
[node name="TargetZone" type="ColorRect" parent="PanelMargin/PanelColumn/Screen" unique_id=1482369006]
|
||||
custom_minimum_size = Vector2(40, 160)
|
||||
layout_mode = 0
|
||||
offset_left = 88.0
|
||||
offset_top = 18.0
|
||||
offset_right = 128.0
|
||||
offset_bottom = 178.0
|
||||
color = Color(0.101960786, 0.3529412, 0.101960786, 1)
|
||||
|
||||
[node name="SweepLine" type="ColorRect" parent="PanelMargin/PanelColumn/Screen" unique_id=6530953]
|
||||
custom_minimum_size = Vector2(4, 160)
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="AIFace" type="Label" parent="PanelMargin/PanelColumn/Screen" unique_id=975263237]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
theme_override_colors/font_color = Color(0.2, 1, 0.2, 1)
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = ">:)"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="PanelMargin/PanelColumn" unique_id=554485629]
|
||||
custom_minimum_size = Vector2(0, 60)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "CLOSE"
|
||||
14
scenes/game.tscn
Normal file
14
scenes/game.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene format=3 uid="uid://b4llhxe3hjbgv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bnv1xxgceqbrc" path="res://scenes/world.tscn" id="1_uwrxv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbvi51vvpt7mu" path="res://scenes/hud.tscn" id="2_yqjtg"]
|
||||
|
||||
[node name="Game" type="Node3D" unique_id=1456297160]
|
||||
|
||||
[node name="World" parent="." unique_id=831374579 instance=ExtResource("1_uwrxv")]
|
||||
|
||||
[node name="CanvasHud" type="CanvasLayer" parent="." unique_id=369977201]
|
||||
|
||||
[node name="HUD" parent="CanvasHud" unique_id=769131693 instance=ExtResource("2_yqjtg")]
|
||||
|
||||
[node name="CanvasPanel" type="CanvasLayer" parent="." unique_id=667193210]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
extends Control
|
||||
extends MarginContainer
|
||||
|
||||
# I HAVE NO IDEA WHAT I'M DOIN!!!
|
||||
var current_floor := 10
|
||||
|
|
@ -8,9 +8,9 @@ var doors_closing := false
|
|||
|
||||
|
||||
func _ready():
|
||||
$ElevatorPanel/PanelMargin/PanelColumn/CloseButton.pressed.connect(_on_close_pressed)
|
||||
#$ElevatorPanel/PanelMargin/PanelColumn/CloseButton.pressed.connect(_on_close_pressed)
|
||||
# 10 floors is probably a lot but will make testing easier.
|
||||
$StatsMargin/StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey and event.pressed and event.keycode == KEY_SPACE:
|
||||
1
scenes/hud.gd.uid
Normal file
1
scenes/hud.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://fpaw3u5yjtbk
|
||||
28
scenes/hud.tscn
Normal file
28
scenes/hud.tscn
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
[gd_scene format=3 uid="uid://cbvi51vvpt7mu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://fpaw3u5yjtbk" path="res://scenes/hud.gd" id="1_64ctp"]
|
||||
|
||||
[node name="HUD" type="MarginContainer" unique_id=769131693]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
script = ExtResource("1_64ctp")
|
||||
|
||||
[node name="StatsColumn" type="VBoxContainer" parent="." unique_id=1476756270]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PeopleLabel" type="Label" parent="StatsColumn" unique_id=1174457387]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "PEOPLE: 0"
|
||||
|
||||
[node name="SavedLabel" type="Label" parent="StatsColumn" unique_id=969002022]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "SAVED: 0"
|
||||
|
||||
[node name="FloorLabel" type="Label" parent="StatsColumn" unique_id=67147411]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "FLOOR: 0"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene format=3 uid="uid://d4j36ro8y55ep"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://kltqwef8yx3r" path="res://screen.gd" id="1_37p78"]
|
||||
[ext_resource type="Script" uid="uid://k1n4iyxp4iww" path="res://hud.gd" id="1_64ctp"]
|
||||
[ext_resource type="Script" uid="uid://kltqwef8yx3r" path="res://scenes/screen.gd" id="1_37p78"]
|
||||
[ext_resource type="Script" uid="uid://k1n4iyxp4iww" path="res://scenes/elevator_panel.gd" id="1_64ctp"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2snw"]
|
||||
bg_color = Color(0.039215688, 0.16470589, 0.039215688, 1)
|
||||
|
|
@ -10,41 +10,35 @@ corner_radius_top_right = 4
|
|||
corner_radius_bottom_right = 4
|
||||
corner_radius_bottom_left = 4
|
||||
|
||||
[node name="HUD" type="Control" unique_id=1519812318]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_64ctp")
|
||||
|
||||
[node name="StatsMargin" type="MarginContainer" parent="." unique_id=428486326]
|
||||
layout_mode = 0
|
||||
[node name="StatsMargin" type="MarginContainer" unique_id=428486326]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
|
||||
[node name="StatsColumn" type="VBoxContainer" parent="StatsMargin" unique_id=365054136]
|
||||
[node name="StatsColumn" type="VBoxContainer" parent="." unique_id=365054136]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PeopleLabel" type="Label" parent="StatsMargin/StatsColumn" unique_id=203661849]
|
||||
[node name="PeopleLabel" type="Label" parent="StatsColumn" unique_id=203661849]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "PEOPLE: 0"
|
||||
|
||||
[node name="SavedLabel" type="Label" parent="StatsMargin/StatsColumn" unique_id=830917509]
|
||||
[node name="SavedLabel" type="Label" parent="StatsColumn" unique_id=830917509]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "SAVED: 0"
|
||||
|
||||
[node name="FloorLabel" type="Label" parent="StatsMargin/StatsColumn" unique_id=320822205]
|
||||
[node name="FloorLabel" type="Label" parent="StatsColumn" unique_id=320822205]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "FLOOR: 0"
|
||||
|
||||
[node name="ElevatorPanel" type="PanelContainer" parent="." unique_id=528786554]
|
||||
[node name="HUD" type="Control" parent="." unique_id=1519812318]
|
||||
layout_mode = 2
|
||||
script = ExtResource("1_64ctp")
|
||||
|
||||
[node name="ElevatorPanel" type="PanelContainer" parent="HUD" unique_id=528786554]
|
||||
custom_minimum_size = Vector2(250, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 11
|
||||
|
|
@ -55,23 +49,23 @@ offset_left = -8.0
|
|||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PanelMargin" type="MarginContainer" parent="ElevatorPanel" unique_id=277992523]
|
||||
[node name="PanelMargin" type="MarginContainer" parent="HUD/ElevatorPanel" unique_id=277992523]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 15
|
||||
theme_override_constants/margin_top = 15
|
||||
theme_override_constants/margin_right = 15
|
||||
theme_override_constants/margin_bottom = 15
|
||||
|
||||
[node name="PanelColumn" type="VBoxContainer" parent="ElevatorPanel/PanelMargin" unique_id=617812367]
|
||||
[node name="PanelColumn" type="VBoxContainer" parent="HUD/ElevatorPanel/PanelMargin" unique_id=617812367]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Screen" type="Panel" parent="ElevatorPanel/PanelMargin/PanelColumn" unique_id=1525784323]
|
||||
[node name="Screen" type="Panel" parent="HUD/ElevatorPanel/PanelMargin/PanelColumn" unique_id=1525784323]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_n2snw")
|
||||
script = ExtResource("1_37p78")
|
||||
|
||||
[node name="TargetZone" type="ColorRect" parent="ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1945539908]
|
||||
[node name="TargetZone" type="ColorRect" parent="HUD/ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1945539908]
|
||||
custom_minimum_size = Vector2(40, 160)
|
||||
layout_mode = 0
|
||||
offset_left = 88.0
|
||||
|
|
@ -80,14 +74,14 @@ offset_right = 128.0
|
|||
offset_bottom = 178.0
|
||||
color = Color(0.101960786, 0.3529412, 0.101960786, 1)
|
||||
|
||||
[node name="SweepLine" type="ColorRect" parent="ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1798423613]
|
||||
[node name="SweepLine" type="ColorRect" parent="HUD/ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1798423613]
|
||||
custom_minimum_size = Vector2(4, 160)
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="AIFace" type="Label" parent="ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1410806030]
|
||||
[node name="AIFace" type="Label" parent="HUD/ElevatorPanel/PanelMargin/PanelColumn/Screen" unique_id=1410806030]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
|
|
@ -95,7 +89,7 @@ theme_override_colors/font_color = Color(0.2, 1, 0.2, 1)
|
|||
theme_override_font_sizes/font_size = 32
|
||||
text = ">:)"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="ElevatorPanel/PanelMargin/PanelColumn" unique_id=427545014]
|
||||
[node name="CloseButton" type="Button" parent="HUD/ElevatorPanel/PanelMargin/PanelColumn" unique_id=427545014]
|
||||
custom_minimum_size = Vector2(0, 60)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 28
|
||||
|
|
@ -1,4 +1,13 @@
|
|||
extends Area3D
|
||||
extends CharacterBody3D
|
||||
|
||||
var speed: int = 100
|
||||
var speed: int = 10
|
||||
var clumsiness: int = 0
|
||||
|
||||
|
||||
func start(xform):
|
||||
transform = xform
|
||||
velocity = (-xform.basis.z * speed).rotated(Vector3.UP, randf_range(-PI/4, PI/4))
|
||||
|
||||
func _physics_process(delta):
|
||||
velocity.z -= 10 * delta
|
||||
move_and_slide()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue