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
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource type="Script" path="res://scripts/menu/MainMenu.gd" id="1_2wax0"]
|
||||
[ext_resource type="Shader" uid="uid://f6lhks6rp5jw" path="res://shaders/testicles.tres" id="1_on8wy"]
|
||||
[ext_resource type="Gradient" uid="uid://c6bcjydbwm5id" path="res://scenes/SpaceGradient.tres" id="2_7racd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpggye27ln436" path="res://scenes/StarsController.tscn" id="4_g7254"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpggye27ln436" path="res://scenes/Star Systems/Required Scenes/StarsController.tscn" id="4_g7254"]
|
||||
[ext_resource type="Script" path="res://scripts/menu/MainMenuButton.gd" id="5_q6x10"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_rtgkw"]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=31 format=3 uid="uid://14k35mkjwi5i"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ccrs28h3b2tfy" path="res://scenes/MainShip.tscn" id="1_6fvpc"]
|
||||
[ext_resource type="Script" path="res://scripts/Space.gd" id="1_ppaw3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpggye27ln436" path="res://scenes/StarsController.tscn" id="3_jbyyq"]
|
||||
[ext_resource type="Script" path="res://scripts/Spaceold.gd" id="1_ppaw3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpggye27ln436" path="res://scenes/Star Systems/Required Scenes/StarsController.tscn" id="3_jbyyq"]
|
||||
[ext_resource type="Script" path="res://scripts/misc/ProjectilesContainer.gd" id="4_dtv2c"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbtrc26016xov" path="res://scenes/Base.tscn" id="5_bjt5p"]
|
||||
[ext_resource type="PackedScene" uid="uid://523dme3h6d6c" path="res://scenes/npcships/NPCShipDefault.tscn" id="6_67746"]
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dpggye27ln436"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/misc/StarsGeneration.gd" id="1_rcdwc"]
|
||||
[ext_resource type="Script" path="res://scripts/misc/stars_generator.gd" id="1_uxmpu"]
|
||||
[ext_resource type="PackedScene" uid="uid://kyuhwil8vq7n" path="res://scenes/Star.tscn" id="2_ypr5c"]
|
||||
|
||||
[node name="Stars" type="ParallaxBackground"]
|
||||
process_mode = 1
|
||||
layer = -5
|
||||
scroll_ignore_camera_zoom = true
|
||||
script = ExtResource("1_rcdwc")
|
||||
script = ExtResource("1_uxmpu")
|
||||
star = ExtResource("2_ypr5c")
|
||||
|
||||
[node name="CloseStars" type="ParallaxLayer" parent="."]
|
||||
29
scenes/Star Systems/star_system_template.tscn
Normal file
29
scenes/Star Systems/star_system_template.tscn
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bsnrcw64qr2hr"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/star_system.gd" id="1_xx8w2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpggye27ln436" path="res://scenes/Star Systems/Required Scenes/StarsController.tscn" id="2_iqrn0"]
|
||||
[ext_resource type="Script" path="res://scripts/misc/ProjectilesContainer.gd" id="3_h5cm3"]
|
||||
[ext_resource type="Material" uid="uid://bawhivm5cr2w" path="res://shaders/materials/nebula_shader.tres" id="4_o0ld7"]
|
||||
[ext_resource type="Script" path="res://scripts/nebula.gd" id="5_la84n"]
|
||||
|
||||
[node name="StarSystem" type="Node"]
|
||||
script = ExtResource("1_xx8w2")
|
||||
width = 1280
|
||||
height = 720
|
||||
|
||||
[node name="Stars" parent="." instance=ExtResource("2_iqrn0")]
|
||||
|
||||
[node name="ProjectileContainer" type="Node" parent="."]
|
||||
script = ExtResource("3_h5cm3")
|
||||
|
||||
[node name="Background" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Nebula" type="ColorRect" parent="Background"]
|
||||
material = ExtResource("4_o0ld7")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("5_la84n")
|
||||
color_background = Color(0.36, 0.18612, 0.1116, 1)
|
||||
|
|
@ -1,95 +1,11 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://ckdttdkoo1t0s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dok3i8u5t1ka4" path="res://scenes/Ships/player_ship.tscn" id="1_b1l1c"]
|
||||
[ext_resource type="Script" path="res://scripts/star_system.gd" id="1_du5mm"]
|
||||
[ext_resource type="Shader" path="res://shaders/ship.gdshader" id="2_15op6"]
|
||||
[ext_resource type="Script" path="res://scripts/misc/ProjectilesContainer.gd" id="3_amh71"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_6w8qb"]
|
||||
resource_name = "gogo"
|
||||
script/source = "extends Node2D
|
||||
|
||||
@onready var items = $Items
|
||||
@onready var verified = $\"Verified Items\"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var dir = DirAccess.open(\"res://items\")
|
||||
var files = dir.get_files()
|
||||
var text = \"Items:\\n\"
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Hulls:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/hulls\")
|
||||
files = dir.get_files()
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Engines:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/engines\")
|
||||
files = dir.get_files()
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Shields:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/shields\")
|
||||
files = dir.get_files()
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Weapons:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/weapons/presets\")
|
||||
files = dir.get_files()
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
items.text = text
|
||||
fetch_modules()
|
||||
|
||||
|
||||
func fetch_modules():
|
||||
var dir = DirAccess.open(\"res://items\")
|
||||
var files = dir.get_files()
|
||||
var text = \"Items:\\n\"
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Verified Hulls:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/hulls\")
|
||||
var modules = dir.get_files()
|
||||
files = check_for_item(modules)
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Verified Engines:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/engines\")
|
||||
modules = dir.get_files()
|
||||
files = check_for_item(modules)
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Verified Shields:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/shields\")
|
||||
modules = dir.get_files()
|
||||
files = check_for_item(modules)
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
text += \"Verified Weapons:\\n\"
|
||||
dir = DirAccess.open(\"res://scenes/weapons/presets\")
|
||||
modules = dir.get_files()
|
||||
files = check_for_item(modules)
|
||||
for file in files:
|
||||
text += \"{file}\\n\".format({'file': file})
|
||||
verified.text = text
|
||||
|
||||
func check_for_item(modules : Array[String]) -> Array[String]:
|
||||
var returnable : Array[String] = []
|
||||
for module in modules:
|
||||
var itm = module.split('.', true, 1)[0]
|
||||
if Game.get_item(itm).name != Game.DEFAULT_ITEM.name:
|
||||
returnable.append(itm)
|
||||
return returnable
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_released(\"pause\"):
|
||||
get_tree().change_scene_to_file(\"res://scenes/MainMenu.tscn\")
|
||||
"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_m15k8"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ogy53"]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "Shield Material"
|
||||
shader = ExtResource("2_15op6")
|
||||
|
|
@ -100,25 +16,10 @@ shader_parameter/max_distance = 20.0
|
|||
shader_parameter/bublic_size = 20.0
|
||||
|
||||
[node name="Debug" type="Node2D"]
|
||||
script = SubResource("GDScript_6w8qb")
|
||||
|
||||
[node name="Items" type="Label" parent="."]
|
||||
offset_right = 640.0
|
||||
offset_bottom = 720.0
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Verified Items" type="Label" parent="."]
|
||||
offset_left = 640.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
script = ExtResource("1_du5mm")
|
||||
|
||||
[node name="PlayerShip" parent="." instance=ExtResource("1_b1l1c")]
|
||||
material = SubResource("ShaderMaterial_m15k8")
|
||||
material = SubResource("ShaderMaterial_ogy53")
|
||||
position = Vector2(608, 352)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue