Rewriting ships: Added some player interface and started rewriting star system
This commit is contained in:
parent
6957169ba5
commit
4172b336c1
20 changed files with 300 additions and 139 deletions
|
|
@ -1,13 +1,156 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dok3i8u5t1ka4"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dok3i8u5t1ka4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bjkshql8ut6hk" path="res://scenes/Ships/ship.tscn" id="1_6x7bu"]
|
||||
[ext_resource type="Script" path="res://scripts/Ship/player_ship.gd" id="2_oqdd7"]
|
||||
[ext_resource type="Script" path="res://scripts/Ship/player_input_controller.gd" id="3_0e84a"]
|
||||
[ext_resource type="PackedScene" uid="uid://ryy1tdrxmjav" path="res://scenes/Ships/Modules/Weapons/weapon.tscn" id="4_fy1be"]
|
||||
[ext_resource type="Script" path="res://scripts/Ship/player_camera.gd" id="5_rclap"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ry4sc"]
|
||||
resource_name = "money_counter"
|
||||
script/source = "extends Label
|
||||
|
||||
## Text with placeholder
|
||||
@onready var unformatted_text: String = text
|
||||
## Shortcut to get_parent().get_parent()
|
||||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text % ship.money
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_vko7a"]
|
||||
resource_name = "velocity_counter"
|
||||
script/source = "extends Label
|
||||
|
||||
## Text with placeholder
|
||||
@onready var unformatted_text: String = text
|
||||
## Shortcut to get_parent().get_parent()
|
||||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text % ship.hull.scalar_velocity
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_uoaip"]
|
||||
resource_name = "health_counter"
|
||||
script/source = "extends Label
|
||||
|
||||
## Text with placeholder
|
||||
@onready var unformatted_text: String = text
|
||||
## Shortcut to get_parent().get_parent()
|
||||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp])
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_q1sx2"]
|
||||
resource_name = "shield_counter"
|
||||
script/source = "extends Label
|
||||
|
||||
## Text with placeholder
|
||||
@onready var unformatted_text: String = text
|
||||
## Shortcut to get_parent().get_parent()
|
||||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text.format([ship.shield.capacity, ship.shield.max_capacity])
|
||||
"
|
||||
|
||||
[sub_resource type="Theme" id="Theme_d8vjy"]
|
||||
default_font_size = 48
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_6uw1d"]
|
||||
resource_name = "pause_controller"
|
||||
script/source = "extends Control
|
||||
|
||||
# TODO: implement save
|
||||
|
||||
## Resumes game
|
||||
func _on_resume_button_up():
|
||||
get_tree().current_scene.unpause()
|
||||
|
||||
## Saves profile and exits game
|
||||
func _on_exit_button_up():
|
||||
get_tree().current_scene.unpause()
|
||||
get_tree().change_scene_to_file(\"res://scenes/MainMenu.tscn\")
|
||||
#Game.profile_save(get_tree().current_scene)
|
||||
"
|
||||
|
||||
[node name="PlayerShip" instance=ExtResource("1_6x7bu")]
|
||||
script = ExtResource("2_oqdd7")
|
||||
|
||||
[node name="InputController" type="Node2D" parent="." index="0"]
|
||||
script = ExtResource("3_0e84a")
|
||||
|
||||
[node name="Weapon" parent="Weapons" index="0" instance=ExtResource("4_fy1be")]
|
||||
action_id = "primary"
|
||||
|
||||
[node name="ColorableGUI" type="CanvasLayer" parent="." index="5"]
|
||||
|
||||
[node name="Money" type="Label" parent="ColorableGUI" index="0"]
|
||||
offset_left = 7.0
|
||||
offset_top = 611.0
|
||||
offset_right = 92.0
|
||||
offset_bottom = 634.0
|
||||
text = "Money: %d"
|
||||
script = SubResource("GDScript_ry4sc")
|
||||
|
||||
[node name="Velocity" type="Label" parent="ColorableGUI" index="1"]
|
||||
offset_left = 7.0
|
||||
offset_top = 688.0
|
||||
offset_right = 137.0
|
||||
offset_bottom = 711.0
|
||||
text = "Velocity: %d px/s"
|
||||
script = SubResource("GDScript_vko7a")
|
||||
|
||||
[node name="Health" type="Label" parent="ColorableGUI" index="2"]
|
||||
offset_left = 7.0
|
||||
offset_top = 663.0
|
||||
offset_right = 168.0
|
||||
offset_bottom = 686.0
|
||||
text = "Health: {0} / {1} units"
|
||||
script = SubResource("GDScript_uoaip")
|
||||
|
||||
[node name="Shield" type="Label" parent="ColorableGUI" index="3"]
|
||||
offset_left = 8.0
|
||||
offset_top = 638.0
|
||||
offset_right = 164.0
|
||||
offset_bottom = 661.0
|
||||
text = "Shield: {0} / {1} units"
|
||||
script = SubResource("GDScript_q1sx2")
|
||||
|
||||
[node name="PauseController" type="Control" parent="ColorableGUI" index="4"]
|
||||
process_mode = 2
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme = SubResource("Theme_d8vjy")
|
||||
script = SubResource("GDScript_6uw1d")
|
||||
|
||||
[node name="Resume" type="Button" parent="ColorableGUI/PauseController" index="0"]
|
||||
layout_mode = 0
|
||||
offset_left = 444.0
|
||||
offset_top = 254.0
|
||||
offset_right = 779.0
|
||||
offset_bottom = 329.0
|
||||
text = "Resume game"
|
||||
|
||||
[node name="Exit" type="Button" parent="ColorableGUI/PauseController" index="1"]
|
||||
layout_mode = 0
|
||||
offset_left = 449.0
|
||||
offset_top = 357.0
|
||||
offset_right = 763.0
|
||||
offset_bottom = 432.0
|
||||
text = "Save and exit"
|
||||
|
||||
[node name="NonColorableGUI" type="CanvasLayer" parent="." index="6"]
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="." index="7"]
|
||||
zoom = Vector2(0.5, 0.5)
|
||||
script = ExtResource("5_rclap")
|
||||
|
||||
[connection signal="button_up" from="ColorableGUI/PauseController/Resume" to="ColorableGUI/PauseController" method="_on_resume_button_up"]
|
||||
[connection signal="button_up" from="ColorableGUI/PauseController/Exit" to="ColorableGUI/PauseController" method="_on_exit_button_up"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue