Progress day 1
|
@ -0,0 +1 @@
|
||||||
|
*.import
|
After Width: | Height: | Size: 352 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1009 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 828 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 773 B |
After Width: | Height: | Size: 921 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 600 KiB |
After Width: | Height: | Size: 3.7 KiB |
|
@ -1,5 +1,7 @@
|
||||||
[gd_resource type="Environment" load_steps=2 format=2]
|
[gd_resource type="Environment" load_steps=2 format=2]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSky" id=1]
|
[sub_resource type="ProceduralSky" id=1]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
background_mode = 2
|
background_mode = 2
|
||||||
background_sky = SubResource( 1 )
|
background_sky = SubResource( 1 )
|
||||||
|
|
|
@ -16,11 +16,17 @@ _global_script_class_icons={
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="LD48"
|
config/name="LD48"
|
||||||
|
boot_splash/fullsize=false
|
||||||
|
boot_splash/use_filter=false
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
GameState="*res://src/GameState.tscn"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
quality/driver/fallback_to_gles2=true
|
||||||
vram_compression/import_etc=true
|
vram_compression/import_etc=true
|
||||||
vram_compression/import_etc2=false
|
vram_compression/import_etc2=false
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
|
|
|
@ -0,0 +1,226 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
var current_scene = null
|
||||||
|
|
||||||
|
var difficulty = null
|
||||||
|
var difficulties = {
|
||||||
|
"Easy": 0,
|
||||||
|
"Medium": 1,
|
||||||
|
"Hard": 2,
|
||||||
|
}
|
||||||
|
var difficulty_data = {
|
||||||
|
0: {
|
||||||
|
"planet": "res://assets/moon.png",
|
||||||
|
"starting_altitude": 60000,
|
||||||
|
"starting_crew": 5,
|
||||||
|
"starting_drag": 1,
|
||||||
|
"drag_function": funcref(self, "moon_drag"),
|
||||||
|
"rescue_altitude": 10000,
|
||||||
|
"maximum_crew": 15,
|
||||||
|
"minimum_altitude": 1000,
|
||||||
|
},
|
||||||
|
1: {
|
||||||
|
"planet": "res://assets/planet.png",
|
||||||
|
"starting_altitude": 600000,
|
||||||
|
"starting_crew": 4,
|
||||||
|
"starting_drag": 10,
|
||||||
|
"drag_function": funcref(self, "planet_drag"),
|
||||||
|
"rescue_altitude": 100000,
|
||||||
|
"maximum_crew": 10,
|
||||||
|
"minimum_altitude": 30000,
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
"planet": "res://assets/blackhole.png",
|
||||||
|
"starting_altitude": 200000001000000,
|
||||||
|
"starting_crew": 3,
|
||||||
|
"starting_drag": 100,
|
||||||
|
"drag_function": funcref(self, "blackhole_drag"),
|
||||||
|
"rescue_altitude": 200000000100000,
|
||||||
|
"maximum_crew": 6,
|
||||||
|
"minimum_altitude": 200000000000000,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var current_depth = 0
|
||||||
|
const OptionsPerLevel = 3
|
||||||
|
const TreeDepth = 5
|
||||||
|
|
||||||
|
const EncounterTypes = [
|
||||||
|
"ArtificialSatellite",
|
||||||
|
"NaturalSatellite",
|
||||||
|
"Comet",
|
||||||
|
"Debris",
|
||||||
|
#"Gases",
|
||||||
|
"Mystery",
|
||||||
|
"Alien",
|
||||||
|
"Ship",
|
||||||
|
"Station",
|
||||||
|
"LocationSpecific", # Eg., Moon, Planet, Blackhole...
|
||||||
|
]
|
||||||
|
const EncounterData = {
|
||||||
|
"ArtificialSattelite" : {
|
||||||
|
"tooltip": ""
|
||||||
|
},
|
||||||
|
"NaturalSattelite" : {},
|
||||||
|
"Comet" : {},
|
||||||
|
"Debris" : {},
|
||||||
|
#"Gases" : {},
|
||||||
|
"Mystery" : {},
|
||||||
|
"Alien" : {},
|
||||||
|
"Ship" : {},
|
||||||
|
"Station" : {},
|
||||||
|
"LocationSpecific" : {},
|
||||||
|
}
|
||||||
|
|
||||||
|
var rng = RandomNumberGenerator.new()
|
||||||
|
var encounters = {
|
||||||
|
# 0: [
|
||||||
|
# {
|
||||||
|
# "type": EncounterTypeString,
|
||||||
|
# "instance": EncounterNode,
|
||||||
|
# "selected": Boolean (false),
|
||||||
|
# "visited": Boolean (false),
|
||||||
|
# }, ...
|
||||||
|
# ], ...
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var current_state = 0
|
||||||
|
var states = {
|
||||||
|
0: "Choose Difficulty",
|
||||||
|
1: "Generate Map",
|
||||||
|
2: "Intro",
|
||||||
|
3: "Set Resources and Generate Crew",
|
||||||
|
4: "Choose flight-path In",
|
||||||
|
5: "Encounters",
|
||||||
|
6: "Choose flight-path Out",
|
||||||
|
7: "End Game",
|
||||||
|
}
|
||||||
|
|
||||||
|
const default_ship_stats = {
|
||||||
|
"health": 1000,
|
||||||
|
"deltav": 1000,
|
||||||
|
"supplies": 1000,
|
||||||
|
"crew": [],
|
||||||
|
"next_crew_id": 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
var target_point = null
|
||||||
|
var ship_stats = Dictionary(default_ship_stats)
|
||||||
|
var orbit_stats = {
|
||||||
|
"altitude": 0,
|
||||||
|
"drag": 0,
|
||||||
|
"estimated_escape_dv": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func initialize(d):
|
||||||
|
self.difficulty = d
|
||||||
|
# Generate a map
|
||||||
|
var i = 0
|
||||||
|
while i < self.TreeDepth:
|
||||||
|
var n = 0
|
||||||
|
self.encounters[i] = []
|
||||||
|
while n < self.OptionsPerLevel:
|
||||||
|
var type = self.EncounterTypes[self.rng.randi_range(0, len(self.EncounterTypes)-1)]
|
||||||
|
var encounter = {
|
||||||
|
"type": type,
|
||||||
|
"instance": null,
|
||||||
|
"visited": false,
|
||||||
|
"selected": false,
|
||||||
|
"locked": false,
|
||||||
|
}
|
||||||
|
self.encounters[i].append(encounter)
|
||||||
|
n += 1
|
||||||
|
i += 1
|
||||||
|
self.encounters[i] = []
|
||||||
|
self.encounters[i].append({
|
||||||
|
"type": "RescueOperation",
|
||||||
|
"instance": null,
|
||||||
|
"visited": false,
|
||||||
|
"selected": true,
|
||||||
|
"locked": true,
|
||||||
|
})
|
||||||
|
for level in encounters.keys():
|
||||||
|
print("Encounter level " + str(level))
|
||||||
|
for e in self.encounters[level]:
|
||||||
|
print("\tOption: " + e.type)
|
||||||
|
|
||||||
|
# Set the orbit stats
|
||||||
|
self.orbit_stats["altitude"] = get_difficulty_data("starting_altitude")
|
||||||
|
self.orbit_stats["drag"] = get_difficulty_data("starting_drag")
|
||||||
|
self.generate_crew()
|
||||||
|
get_tree().get_root().call_deferred("add_child", ResourceLoader.load("res://src/ui/Background.tscn").instance())
|
||||||
|
|
||||||
|
func get_difficulty_data(key):
|
||||||
|
return self.difficulty_data[self.difficulty][key]
|
||||||
|
|
||||||
|
func generate_crew():
|
||||||
|
self.ship_stats["crew"].append({
|
||||||
|
"name": "Wellspring's Captain",
|
||||||
|
"may_be_sacrified": false,
|
||||||
|
"picture": null,
|
||||||
|
"personality": "paragon",
|
||||||
|
"position": null,
|
||||||
|
"morale": null,
|
||||||
|
"tooltip": "This is you",
|
||||||
|
"upkeep": 10,
|
||||||
|
"id": 1,
|
||||||
|
})
|
||||||
|
var x = 0
|
||||||
|
while x < self.get_difficulty_data("starting_crew"):
|
||||||
|
self.ship_stats["crew"].append({
|
||||||
|
"name": "Xxx",
|
||||||
|
"may_be_sacrified": true,
|
||||||
|
"picture": null,
|
||||||
|
"position": null,
|
||||||
|
"upkeep": 10,
|
||||||
|
"morale": 100,
|
||||||
|
"tooltip": null,
|
||||||
|
"personality": null,
|
||||||
|
"id": self.ship_stats['next_crew_id'],
|
||||||
|
})
|
||||||
|
x += 1
|
||||||
|
self.ship_stats['next_crew_id'] += 1
|
||||||
|
|
||||||
|
func goto_scene(scene, current = null):
|
||||||
|
call_deferred("_deferred_goto_scene", scene, current)
|
||||||
|
|
||||||
|
func _deferred_goto_scene(scene, current = null):
|
||||||
|
get_tree().get_root().print_tree_pretty()
|
||||||
|
if current:
|
||||||
|
current.free()
|
||||||
|
elif self.current_scene:
|
||||||
|
self.current_scene.free()
|
||||||
|
var next = ResourceLoader.load(scene).instance()
|
||||||
|
get_tree().get_root().add_child(next)
|
||||||
|
get_tree().set_current_scene(next)
|
||||||
|
self.current_scene = next
|
||||||
|
|
||||||
|
func start_introduction():
|
||||||
|
self.current_state = 2
|
||||||
|
self.goto_scene("res://src/ui/Intro.tscn")
|
||||||
|
|
||||||
|
func end_introduction():
|
||||||
|
self.current_state = 4
|
||||||
|
self.goto_scene("res://src/ui/ChooseFlightIn.tscn")
|
||||||
|
|
||||||
|
func start_encounters(picks):
|
||||||
|
var x = 0
|
||||||
|
while x < len(self.encounters):
|
||||||
|
self.encounters[x][picks[x]]["selected"] = true
|
||||||
|
self.encounters[x][picks[x]]["locked"] = true
|
||||||
|
x += 1
|
||||||
|
self.current_state = 5
|
||||||
|
self.goto_scene("res://src/ui/Encounters.tscn")
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/GameState.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="GameState" type="Node"]
|
||||||
|
script = ExtResource( 1 )
|
|
@ -0,0 +1,3 @@
|
||||||
|
[gd_scene format=2]
|
||||||
|
|
||||||
|
[node name="Ship" type="Node2D"]
|
|
@ -0,0 +1,17 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/starfield.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[node name="Background" type="Node2D"]
|
||||||
|
z_index = -1
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
|
margin_left = -108.0
|
||||||
|
margin_top = 7.62939e-06
|
||||||
|
margin_right = 1892.0
|
||||||
|
margin_bottom = 1000.0
|
||||||
|
rect_scale = Vector2( 0.6, 0.6 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if GameState.difficulty == null:
|
||||||
|
GameState.initialize(0)
|
||||||
|
get_node("Ready").set_disabled(true)
|
||||||
|
get_node("Ready").connect("pressed", self, "_on_ready_pressed")
|
||||||
|
for c in get_node("Map").get_children():
|
||||||
|
if c.get_name().match("Level?"):
|
||||||
|
c.activate_options()
|
||||||
|
c.connect("encounter_choice_changed", self, "_update_ready_state")
|
||||||
|
|
||||||
|
func _update_ready_state():
|
||||||
|
var all_ready = true
|
||||||
|
for c in get_node("Map").get_children():
|
||||||
|
if c.get_name().match("Level?"):
|
||||||
|
all_ready = all_ready and c.has_active()
|
||||||
|
get_node("Ready").set_disabled(not all_ready)
|
||||||
|
|
||||||
|
func _on_ready_pressed():
|
||||||
|
get_node("Ready").set_disabled(true)
|
||||||
|
var picks = []
|
||||||
|
for c in get_node("Map").get_children():
|
||||||
|
if c.get_name().match("Level?"):
|
||||||
|
picks.append(c.get_active_option_index())
|
||||||
|
GameState.start_encounters(picks)
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,44 @@
|
||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/ChooseFlightIn.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://src/ui/Map.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://src/ui/ShipStats.tscn" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://src/ui/CrewUI.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
[node name="ChooseFlightIn" type="Node2D"]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||||
|
margin_left = -2.0
|
||||||
|
margin_right = 1022.0
|
||||||
|
margin_bottom = 123.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "
|
||||||
|
[center]Our scanners have detected points of interest along the flight path to the [b]Diligent[/b].
|
||||||
|
Plot a course to the rendezvous with the [b]Diligent[/b] by selecting an encounter from each group.
|
||||||
|
|
||||||
|
Hit \"Engage\" when everything is plotted to confirm the course.[/center]"
|
||||||
|
text = "
|
||||||
|
Our scanners have detected points of interest along the flight path to the Diligent.
|
||||||
|
Plot a course to the rendezvous with the Diligent by selecting an encounter from each group.
|
||||||
|
|
||||||
|
Hit \"Engage\" when everything is plotted to confirm the course."
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Map" parent="." instance=ExtResource( 2 )]
|
||||||
|
|
||||||
|
[node name="ShipStats" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
||||||
|
[node name="CrewUI" parent="." instance=ExtResource( 4 )]
|
||||||
|
|
||||||
|
[node name="Ready" type="Button" parent="."]
|
||||||
|
margin_left = 447.0
|
||||||
|
margin_top = 536.0
|
||||||
|
margin_right = 586.0
|
||||||
|
margin_bottom = 584.0
|
||||||
|
text = "Engage"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
func initialize(data):
|
||||||
|
find_node("Name").set_bbcode("[center]" + data['name'] + "[/center]")
|
||||||
|
if data['morale']:
|
||||||
|
find_node("Morale").set_value(data['morale'])
|
||||||
|
else:
|
||||||
|
get_node("Container/Morale").set_visible(false)
|
||||||
|
if data['picture']:
|
||||||
|
get_node("Container/Image").set_texture(ResourceLoader.load(data['picture']))
|
||||||
|
else:
|
||||||
|
get_node("Container/Image").set_texture(ResourceLoader.load("res://assets/crewPlaceholder.png"))
|
||||||
|
var tt = ""
|
||||||
|
if data['tooltip']:
|
||||||
|
tt = data['tooltip']
|
||||||
|
tt += "\n\n"
|
||||||
|
for i in data.keys():
|
||||||
|
if i == "tooltip":
|
||||||
|
continue
|
||||||
|
tt += i + ": " + str(data[i]) + "\n\n"
|
||||||
|
find_node("Image").set_tooltip(tt)
|
|
@ -0,0 +1,42 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/CrewEntry.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Crew" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Container" type="VBoxContainer" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Image" type="TextureRect" parent="Container"]
|
||||||
|
margin_right = 100.0
|
||||||
|
margin_bottom = 100.0
|
||||||
|
rect_min_size = Vector2( 100, 100 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Name" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_top = 104.0
|
||||||
|
margin_right = 100.0
|
||||||
|
margin_bottom = 119.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
fit_content_height = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Morale" type="ProgressBar" parent="Container"]
|
||||||
|
margin_top = 123.0
|
||||||
|
margin_right = 100.0
|
||||||
|
margin_bottom = 137.0
|
||||||
|
step = 1.0
|
|
@ -0,0 +1,43 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
const crew_per_page = 4
|
||||||
|
var current_page = 0
|
||||||
|
var entries = {}
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self.entries = {}
|
||||||
|
var count = len(GameState.ship_stats['crew'])
|
||||||
|
self.current_page = 0
|
||||||
|
var max_pages = (count / self.crew_per_page) + 1
|
||||||
|
self.print_tree_pretty()
|
||||||
|
if self.current_page == 0:
|
||||||
|
get_node("Container/Pager/Previous").set_disabled(true)
|
||||||
|
get_node("Container/Display").set_text(str(self.current_page + 1 ) + " / " + str(max_pages))
|
||||||
|
print(max_pages)
|
||||||
|
if max_pages < 2 or ((current_page+1) >= max_pages):
|
||||||
|
get_node("Container/Pager/Previous").set_disabled(true)
|
||||||
|
var crew_entry_ui = ResourceLoader.load("res://src/ui/CrewEntry.tscn")
|
||||||
|
for c in GameState.ship_stats['crew']:
|
||||||
|
var e = crew_entry_ui.instance();
|
||||||
|
e.initialize(c)
|
||||||
|
entries[c['id']] = e
|
||||||
|
e.set_custom_minimum_size(Vector2(100, 137))
|
||||||
|
var x = 0 + (current_page * crew_per_page);
|
||||||
|
var limit = x + crew_per_page
|
||||||
|
while x < limit:
|
||||||
|
if x >= len(entries.keys()):
|
||||||
|
break;
|
||||||
|
var key = entries.keys()[x]
|
||||||
|
get_node("Container/Crew").add_child(entries[key])
|
||||||
|
x += 1
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,47 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/CrewUI.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="CrewUI" type="Control"]
|
||||||
|
margin_left = 918.0
|
||||||
|
margin_right = 1020.0
|
||||||
|
margin_bottom = 599.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Container" type="VBoxContainer" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Crew" type="VBoxContainer" parent="Container"]
|
||||||
|
margin_right = 44.0
|
||||||
|
|
||||||
|
[node name="Display" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = 44.0
|
||||||
|
margin_bottom = 19.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
fit_content_height = true
|
||||||
|
|
||||||
|
[node name="Pager" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 23.0
|
||||||
|
margin_right = 44.0
|
||||||
|
margin_bottom = 43.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_stretch_ratio = 0.0
|
||||||
|
|
||||||
|
[node name="Previous" type="Button" parent="Container/Pager"]
|
||||||
|
margin_right = 20.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "<"
|
||||||
|
|
||||||
|
[node name="Next" type="Button" parent="Container/Pager"]
|
||||||
|
margin_left = 24.0
|
||||||
|
margin_right = 44.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = ">"
|
|
@ -0,0 +1,68 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
var timer = 0
|
||||||
|
var waiting = true
|
||||||
|
var wait_condition = null
|
||||||
|
var data = null
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func start(d):
|
||||||
|
self.data = d
|
||||||
|
self.timer = 0
|
||||||
|
self.process_step("init")
|
||||||
|
self.waiting = false
|
||||||
|
|
||||||
|
func end():
|
||||||
|
self.waiting = true
|
||||||
|
|
||||||
|
func _input(ev):
|
||||||
|
if self.waiting:
|
||||||
|
if self.wait_condition is String and self.wait_condition == "space" and Input.is_key_pressed(KEY_SPACE):
|
||||||
|
self.waiting = false
|
||||||
|
self.wait_condition = null
|
||||||
|
if self.wait_condition is Array and ev is InputEventKey and ev.pressed:
|
||||||
|
self.waiting = false
|
||||||
|
self.wait_condition[0].call_func()
|
||||||
|
self.wait_condition = null
|
||||||
|
|
||||||
|
|
||||||
|
func process_step(id):
|
||||||
|
print(self.data.keys())
|
||||||
|
if not self.data.keys().has(id):
|
||||||
|
print("Step '" + id + "' not found. Skipping")
|
||||||
|
return
|
||||||
|
for action in self.data[id]:
|
||||||
|
print("Running action: " + action["type"])
|
||||||
|
if action["type"] == "set_speaker":
|
||||||
|
self.find_node("Speaker").set_texture(ResourceLoader.load(action["args"]))
|
||||||
|
elif action["type"] == "reset_text":
|
||||||
|
self.find_node("Text").set_bbcode("")
|
||||||
|
elif action["type"] == "add_line":
|
||||||
|
self.find_node("Text").append_bbcode("[b]" + action["args"][0] + ": [/b]")
|
||||||
|
self.find_node("Text").append_bbcode(action["args"][1] + "\n")
|
||||||
|
elif action["type"] == "wait_for_space":
|
||||||
|
self.find_node("Text").append_bbcode("[center][i]Hit space to continue[/i][/center]\n")
|
||||||
|
self.waiting = true
|
||||||
|
self.wait_condition = "space"
|
||||||
|
elif action["type"] == "wait_for_key":
|
||||||
|
self.find_node("Text").append_bbcode("[center][i]Press any key to continue[/i][/center]\n")
|
||||||
|
self.waiting = true
|
||||||
|
self.wait_condition = action["args"]
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
if not waiting:
|
||||||
|
var old_timer = self.timer
|
||||||
|
self.timer += delta
|
||||||
|
for k in self.data.keys():
|
||||||
|
if str(k) != "init" and k > old_timer and k <= self.timer:
|
||||||
|
self.process_step(k)
|
|
@ -0,0 +1,36 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/Dialogue.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Control" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
margin_left = 825.0
|
||||||
|
margin_right = 1025.0
|
||||||
|
margin_bottom = 600.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Speaker" type="TextureRect" parent="VBoxContainer"]
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 200.0
|
||||||
|
rect_min_size = Vector2( 0, 200 )
|
||||||
|
|
||||||
|
[node name="Text" type="RichTextLabel" parent="VBoxContainer"]
|
||||||
|
margin_top = 204.0
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 564.0
|
||||||
|
rect_min_size = Vector2( 0, 360 )
|
||||||
|
bbcode_enabled = true
|
||||||
|
|
||||||
|
[node name="ChoiceContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_top = 568.0
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 568.0
|
|
@ -0,0 +1,36 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
var buttonNames = [
|
||||||
|
"EasyButton",
|
||||||
|
"MediumButton",
|
||||||
|
"HardButton"
|
||||||
|
]
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
# Bind button callbacks
|
||||||
|
for n in buttonNames:
|
||||||
|
var button = self.find_node(n)
|
||||||
|
button.connect("toggled", self, "_on_difficulty_button_pressed", [n])
|
||||||
|
self.find_node("MediumButton").set_pressed(true)
|
||||||
|
self.find_node("StartButton").connect("pressed", self, "_on_start_button_pressed")
|
||||||
|
|
||||||
|
func _on_difficulty_button_pressed(state, buttonName):
|
||||||
|
var any_active = state
|
||||||
|
for n in buttonNames:
|
||||||
|
if n != buttonName:
|
||||||
|
if state:
|
||||||
|
self.find_node(n).set_pressed(false)
|
||||||
|
any_active = any_active or self.find_node(n).is_pressed()
|
||||||
|
self.find_node("StartButton").disabled = not any_active
|
||||||
|
|
||||||
|
func _on_start_button_pressed():
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,114 @@
|
||||||
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/blackhole_icon.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://assets/planet icon.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/moon icon.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://assets/moon pressed.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://assets/blackhole pressed.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://assets/planet pressed.png" type="Texture" id=6]
|
||||||
|
[ext_resource path="res://src/ui/DifficultySelector.gd" type="Script" id=7]
|
||||||
|
|
||||||
|
[node name="DifficultySelector" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_top = -1.0
|
||||||
|
margin_bottom = -1.0
|
||||||
|
script = ExtResource( 7 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_right = 908.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
rect_min_size = Vector2( 300, 400 )
|
||||||
|
|
||||||
|
[node name="EasyButton" type="TextureButton" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 300.0
|
||||||
|
rect_min_size = Vector2( 0, 300 )
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 3 )
|
||||||
|
texture_pressed = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "Easy"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||||
|
margin_top = 304.0
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
rect_min_size = Vector2( 0, 100 )
|
||||||
|
text = "Easy"
|
||||||
|
|
||||||
|
[node name="VBoxContainer3" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 304.0
|
||||||
|
margin_right = 604.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
rect_min_size = Vector2( 300, 400 )
|
||||||
|
|
||||||
|
[node name="MediumButton" type="TextureButton" parent="VBoxContainer/HBoxContainer/VBoxContainer3"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 300.0
|
||||||
|
rect_min_size = Vector2( 0, 300 )
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 2 )
|
||||||
|
texture_pressed = ExtResource( 6 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "Easy"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer/HBoxContainer/VBoxContainer3"]
|
||||||
|
margin_top = 304.0
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
rect_min_size = Vector2( 0, 100 )
|
||||||
|
text = "Medium"
|
||||||
|
|
||||||
|
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 608.0
|
||||||
|
margin_right = 908.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
rect_min_size = Vector2( 300, 400 )
|
||||||
|
|
||||||
|
[node name="HardButton" type="TextureButton" parent="VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 300.0
|
||||||
|
rect_min_size = Vector2( 0, 300 )
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 1 )
|
||||||
|
texture_pressed = ExtResource( 5 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "Easy"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||||
|
margin_top = 304.0
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 404.0
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer/HBoxContainer/VBoxContainer2/MarginContainer"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 100.0
|
||||||
|
rect_min_size = Vector2( 0, 100 )
|
||||||
|
text = "Hard"
|
||||||
|
|
||||||
|
[node name="StartButton" type="Button" parent="VBoxContainer"]
|
||||||
|
margin_top = 408.0
|
||||||
|
margin_right = 908.0
|
||||||
|
margin_bottom = 428.0
|
||||||
|
text = "Start"
|
|
@ -0,0 +1,69 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
signal encounter_choice_changed
|
||||||
|
|
||||||
|
var choices = 3
|
||||||
|
var buttonNames = [
|
||||||
|
"Option0",
|
||||||
|
"Option1",
|
||||||
|
"Option2",
|
||||||
|
]
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
# Bind button callbacks
|
||||||
|
for n in buttonNames:
|
||||||
|
var button = self.find_node(n)
|
||||||
|
button.connect("toggled", self, "_on_option_button_pressed", [n])
|
||||||
|
|
||||||
|
func initialize(nOptions = null):
|
||||||
|
if nOptions != null:
|
||||||
|
self.choices = nOptions
|
||||||
|
var x = 0
|
||||||
|
while x < 3:
|
||||||
|
self.find_node("Option" + str(x)).visible = x < nOptions
|
||||||
|
x += 1
|
||||||
|
|
||||||
|
func activate_options():
|
||||||
|
if self.choices > 1:
|
||||||
|
for c in self.get_children():
|
||||||
|
if c.visible:
|
||||||
|
c.set_disabled(false)
|
||||||
|
|
||||||
|
func disable_options():
|
||||||
|
for c in self.get_children():
|
||||||
|
if c.visible:
|
||||||
|
c.set_disabled(true)
|
||||||
|
|
||||||
|
func get_active_option_index():
|
||||||
|
var x = 0
|
||||||
|
for c in self.get_children():
|
||||||
|
if c.is_pressed():
|
||||||
|
return x
|
||||||
|
else:
|
||||||
|
x += 1
|
||||||
|
return null
|
||||||
|
|
||||||
|
func has_active():
|
||||||
|
var active = false
|
||||||
|
for n in buttonNames:
|
||||||
|
active = active or self.get_node(n).is_pressed()
|
||||||
|
return active
|
||||||
|
|
||||||
|
func _on_option_button_pressed(state, buttonName):
|
||||||
|
for n in buttonNames:
|
||||||
|
if n != buttonName:
|
||||||
|
if state:
|
||||||
|
self.find_node(n).set_pressed(false)
|
||||||
|
emit_signal("encounter_choice_changed")
|
||||||
|
#for n in buttonNames:
|
||||||
|
# if self.find_node(n).is_pressed():
|
||||||
|
# print("Button" + n + " is pressed")
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,52 @@
|
||||||
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/EncounterChoice.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://assets/encounterPlaceholder2.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/encounterPlaceholder0.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://assets/encounterPlaceholder1.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://assets/encounterIconPlaceholder0_pressed.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://assets/encounterIconPlaceholder1_pressed.png" type="Texture" id=6]
|
||||||
|
[ext_resource path="res://assets/encounterIconPlaceholder2_pressed.png" type="Texture" id=7]
|
||||||
|
|
||||||
|
[node name="EncounterChoice" type="Node2D"]
|
||||||
|
position = Vector2( -0.5, 0.5 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Option0" type="TextureButton" parent="."]
|
||||||
|
margin_left = -28.8286
|
||||||
|
margin_top = 14.3104
|
||||||
|
margin_right = 11.1714
|
||||||
|
margin_bottom = 54.3104
|
||||||
|
hint_tooltip = "Option 0"
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 3 )
|
||||||
|
texture_pressed = ExtResource( 5 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Option1" type="TextureButton" parent="."]
|
||||||
|
margin_left = 24.2782
|
||||||
|
margin_top = 16.5904
|
||||||
|
margin_right = 64.2782
|
||||||
|
margin_bottom = 56.5904
|
||||||
|
hint_tooltip = "Option 1"
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 4 )
|
||||||
|
texture_pressed = ExtResource( 6 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Option2" type="TextureButton" parent="."]
|
||||||
|
margin_left = 17.7514
|
||||||
|
margin_top = -36.9294
|
||||||
|
margin_right = 57.7514
|
||||||
|
margin_bottom = 3.07064
|
||||||
|
hint_tooltip = "Option 2"
|
||||||
|
toggle_mode = true
|
||||||
|
texture_normal = ExtResource( 2 )
|
||||||
|
texture_pressed = ExtResource( 7 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/Map.tscn" type="PackedScene" id=1]
|
||||||
|
[ext_resource path="res://src/ui/ShipStats.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://src/ui/CrewUI.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
|
[node name="Encounters" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Map" parent="." instance=ExtResource( 1 )]
|
||||||
|
|
||||||
|
[node name="CrewUI" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
||||||
|
[node name="Control" parent="." instance=ExtResource( 2 )]
|
|
@ -0,0 +1,76 @@
|
||||||
|
[gd_scene format=2]
|
||||||
|
|
||||||
|
[node name="GameMenu" type="Control"]
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ContinueButton" type="MenuButton" parent="."]
|
||||||
|
margin_left = 158.967
|
||||||
|
margin_top = 115.601
|
||||||
|
margin_right = 397.967
|
||||||
|
margin_bottom = 135.601
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ContinueButton"]
|
||||||
|
margin_right = 76.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
text = "Continue"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HelpButton" type="MenuButton" parent="."]
|
||||||
|
margin_left = 160.494
|
||||||
|
margin_top = 140.127
|
||||||
|
margin_right = 448.494
|
||||||
|
margin_bottom = 160.127
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="HelpButton"]
|
||||||
|
anchor_right = 0.069
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_right = 20.128
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Help"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="LeaveGameButton" type="MenuButton" parent="."]
|
||||||
|
anchor_right = 0.246
|
||||||
|
anchor_bottom = 0.033
|
||||||
|
margin_right = -239.904
|
||||||
|
margin_bottom = 0.200001
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="LeaveGameButton"]
|
||||||
|
margin_left = 157.858
|
||||||
|
margin_top = 167.583
|
||||||
|
margin_right = 297.858
|
||||||
|
margin_bottom = 192.583
|
||||||
|
text = "Abandon Game"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ExitGameButton" type="MenuButton" parent="."]
|
||||||
|
margin_left = 90.8717
|
||||||
|
margin_top = 99.7807
|
||||||
|
margin_right = 114.872
|
||||||
|
margin_bottom = 124.781
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ExitGameButton"]
|
||||||
|
margin_left = 67.7083
|
||||||
|
margin_top = 96.2171
|
||||||
|
margin_right = 238.708
|
||||||
|
margin_bottom = 118.217
|
||||||
|
text = "End Program"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
var dialogue = {
|
||||||
|
"init": [
|
||||||
|
{
|
||||||
|
"type": "set_speaker",
|
||||||
|
"args": "res://assets/captain.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "reset_text",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
0.5: [
|
||||||
|
{
|
||||||
|
"type": "add_line",
|
||||||
|
"args": [
|
||||||
|
"Diligent's Captain",
|
||||||
|
"[i]*bzzt*[/i] Mayday! Mayday! [i]*crackle*[/i]",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "wait_for_space",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
1.0: [
|
||||||
|
{
|
||||||
|
"type": "add_line",
|
||||||
|
"args": [
|
||||||
|
"You",
|
||||||
|
"This is the captain of the [b]Wellspring[/b]. What's your situation?",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "add_line",
|
||||||
|
"args": [
|
||||||
|
"Diligent's Captain",
|
||||||
|
"We've lost power and we're being dragged deeper into this gravity [i]*bzzt*[/i].\n" \
|
||||||
|
+ "[i]*crack*[/i] warp crystal, if you can get here and take us out."
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "wait_for_space",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
1.5: [
|
||||||
|
{
|
||||||
|
"type": "add_line",
|
||||||
|
"args": [
|
||||||
|
"You",
|
||||||
|
"Acknowledged, we're on our way. Wellspring out.\n\n",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "add_line",
|
||||||
|
"args": [
|
||||||
|
"Narrator",
|
||||||
|
"[color=a20d0d]With your ship and crew, and the resources you have at and. You start plotting a course to rendezvous with the [b]Diligent[/b].[/color]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "wait_for_key",
|
||||||
|
"args": [
|
||||||
|
funcref(self, "end")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
find_node("Dialogue").start(self.dialogue)
|
||||||
|
|
||||||
|
|
||||||
|
func _input(_ev):
|
||||||
|
if Input.is_key_pressed(KEY_ESCAPE):
|
||||||
|
self.end()
|
||||||
|
|
||||||
|
func end():
|
||||||
|
# Leave introduction
|
||||||
|
find_node("Dialogue").end()
|
||||||
|
GameState.end_introduction()
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,26 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/Map.tscn" type="PackedScene" id=1]
|
||||||
|
[ext_resource path="res://src/ui/Dialogue.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://src/ui/Intro.gd" type="Script" id=3]
|
||||||
|
|
||||||
|
[node name="Intro" type="Node2D"]
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
rect_min_size = Vector2( 150, 0 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="HBoxContainer"]
|
||||||
|
margin_right = 150.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
rect_min_size = Vector2( 150, 0 )
|
||||||
|
text = "Hit \"Escape\" to skip"
|
||||||
|
|
||||||
|
[node name="Dialogue" parent="." instance=ExtResource( 2 )]
|
||||||
|
|
||||||
|
[node name="Map" parent="." instance=ExtResource( 1 )]
|
|
@ -0,0 +1,25 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
# Connect start button with our callback
|
||||||
|
self.find_node("DifficultySelector").find_node("StartButton").connect("pressed", self, "_on_start_button_pressed")
|
||||||
|
GameState.current_scene = self
|
||||||
|
|
||||||
|
func _on_start_button_pressed():
|
||||||
|
# Get the difficulty button that is pressed
|
||||||
|
var chosen_difficulty = 0
|
||||||
|
#var state = get_tree().get_root().find_node("GameState")
|
||||||
|
for d in GameState.difficulties.keys():
|
||||||
|
if self.find_node(d+ "Button").is_pressed():
|
||||||
|
chosen_difficulty = GameState.difficulties[d]
|
||||||
|
break
|
||||||
|
print("Chosen difficulty: " + GameState.difficulties.keys()[chosen_difficulty] + "(" + str(chosen_difficulty) + ")")
|
||||||
|
self.find_node("DifficultySelector").find_node("StartButton").disconnect("pressed", self, "_on_start_button_pressed")
|
||||||
|
GameState.initialize(chosen_difficulty)
|
||||||
|
GameState.start_introduction()
|
|
@ -0,0 +1,24 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/MainMenu.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://src/ui/DifficultySelector.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
[node name="MainMenu" type="Node2D"]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="DifficultySelector" parent="." instance=ExtResource( 2 )]
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 56.1231
|
||||||
|
margin_top = 130.328
|
||||||
|
margin_right = 56.1231
|
||||||
|
margin_bottom = 130.328
|
||||||
|
|
||||||
|
[node name="Title" type="RichTextLabel" parent="."]
|
||||||
|
margin_right = 1026.0
|
||||||
|
margin_bottom = 129.0
|
||||||
|
text = "Title: Gravity Well Diver
|
||||||
|
"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
# For testing
|
||||||
|
if GameState.difficulty == null:
|
||||||
|
GameState.initialize(0)
|
||||||
|
self.find_node("Planet").set_texture(ResourceLoader.load(GameState.get_difficulty_data("planet")))
|
||||||
|
var encounterChoice = ResourceLoader.load("res://src/ui/EncounterChoice.tscn")
|
||||||
|
for level in GameState.encounters.keys():
|
||||||
|
print(level)
|
||||||
|
var name = "Level" + str(level)
|
||||||
|
var choice = encounterChoice.instance()
|
||||||
|
choice.name = name
|
||||||
|
choice.initialize(len(GameState.encounters[level]))
|
||||||
|
choice.set_global_position(get_node("Level" + str(level) + "Location").get_global_position())
|
||||||
|
choice.set_global_rotation(get_node("Level" + str(level) + "Location").get_global_rotation())
|
||||||
|
choice.set_global_scale(get_node("Level" + str(level) + "Location").get_global_scale())
|
||||||
|
var x = 0
|
||||||
|
while x < len(GameState.encounters[level]):
|
||||||
|
# Fixes the rotation of the individual buttons
|
||||||
|
var n = choice.find_node("Option" + str(x))
|
||||||
|
if not n:
|
||||||
|
continue
|
||||||
|
n.set_rotation(
|
||||||
|
-(find_node("Level" + str(level) + "Location").get_global_rotation())
|
||||||
|
)
|
||||||
|
# Set icon and tooltip
|
||||||
|
print("Checking for icons related to '" + GameState.encounters[level][x]["type"] + "'")
|
||||||
|
var texture = ResourceLoader.load("res://assets/encounterIcon" + GameState.encounters[level][x]["type"] + ".png")
|
||||||
|
var texture_pressed = ResourceLoader.load("res://assets/encounterIcon" + GameState.encounters[level][x]["type"] + "_pressed.png")
|
||||||
|
if texture:
|
||||||
|
n.set_normal_texture(texture)
|
||||||
|
if texture_pressed:
|
||||||
|
n.set_pressed_texture(texture_pressed)
|
||||||
|
n.set_disabled(true)
|
||||||
|
n.set_tooltip(GameState.encounters[level][x]["type"])
|
||||||
|
if GameState.encounters[level][x]["selected"]:
|
||||||
|
# The texture change is used since when disabled the normal_texture is shown regardless of press state.
|
||||||
|
n.set_pressed(true)
|
||||||
|
n.set_normal_texture(n.get_pressed_texture())
|
||||||
|
x += 1
|
||||||
|
if GameState.current_state == 4: # picking course
|
||||||
|
choice.activate_options()
|
||||||
|
self.add_child(choice)
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,50 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/planet placeholder.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://src/ui/Map.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[node name="Map" type="Node2D"]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Planet" type="TextureRect" parent="."]
|
||||||
|
margin_left = 298.328
|
||||||
|
margin_top = 212.136
|
||||||
|
margin_right = 598.328
|
||||||
|
margin_bottom = 512.136
|
||||||
|
rect_scale = Vector2( 0.66, 0.66 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
stretch_mode = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Level0Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 81.8951, 64.2559 )
|
||||||
|
scale = Vector2( 0.9, 0.9 )
|
||||||
|
|
||||||
|
[node name="Level1Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 686.657, 109.613 )
|
||||||
|
scale = Vector2( 0.95, 0.95 )
|
||||||
|
|
||||||
|
[node name="Level2Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 633.741, 343.958 )
|
||||||
|
rotation = 1.22173
|
||||||
|
scale = Vector2( 1.05, 1.05 )
|
||||||
|
|
||||||
|
[node name="Level3Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 371.677, 463.651 )
|
||||||
|
scale = Vector2( 1.15, 1.15 )
|
||||||
|
|
||||||
|
[node name="Level4Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 265.844, 239.385 )
|
||||||
|
rotation = 2.79253
|
||||||
|
scale = Vector2( 1.05, 1.05 )
|
||||||
|
|
||||||
|
[node name="Level5Location" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 506.488, 220.486 )
|
||||||
|
|
||||||
|
[node name="Line2D" type="Line2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
points = PoolVector2Array( 674.571, 84.9249, 667.428, 67.4635, 654.729, 50.0021, 622.187, 36.5092, 550.754, 19.8415, 449.16, 13.4919, 357.091, 18.2541, 229.305, 36.5092, 118.981, 68.2572 )
|
||||||
|
width = 5.0
|
||||||
|
default_color = Color( 0.545098, 1, 0.4, 1 )
|
|
@ -0,0 +1,31 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
connect("ship_stats_changed", self, "_on_update_stats")
|
||||||
|
self.update_stats()
|
||||||
|
|
||||||
|
func _on_update_stats():
|
||||||
|
self.update_stats()
|
||||||
|
|
||||||
|
func update_stats():
|
||||||
|
get_node("Container/Health").set_value(GameState.ship_stats["health"])
|
||||||
|
get_node("Container/Supplies").set_value(GameState.ship_stats["supplies"])
|
||||||
|
get_node("Container/Crew").set_value(len(GameState.ship_stats["crew"]))
|
||||||
|
get_node("Container/Crew").set_max(GameState.get_difficulty_data("maximum_crew"))
|
||||||
|
get_node("Container/DeltaV").set_bbcode("[center]" + str(GameState.ship_stats["deltav"]) + " DeltaV[/center]")
|
||||||
|
get_node("Container/Altitude").set_value(GameState.orbit_stats["altitude"])
|
||||||
|
get_node("Container/Altitude").set_max(GameState.get_difficulty_data("starting_altitude"))
|
||||||
|
get_node("Container/Altitude").set_min(GameState.get_difficulty_data("minimum_altitude"))
|
||||||
|
get_node("Container/AltitudeLabel").set_bbcode("[center]xxx / yyy[/center]")
|
||||||
|
get_node("Container/DragContainer/Drag").set_text(str(GameState.orbit_stats["drag"]))
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -0,0 +1,130 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/ui/ShipStats.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Control" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 1.68188
|
||||||
|
margin_top = -0.840912
|
||||||
|
margin_right = 1.68188
|
||||||
|
margin_bottom = -0.840942
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Container" type="VBoxContainer" parent="."]
|
||||||
|
margin_left = -1.0
|
||||||
|
margin_top = 407.0
|
||||||
|
margin_right = 254.0
|
||||||
|
margin_bottom = 601.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 15.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "[center]Ship Statistics[/center]"
|
||||||
|
text = "Ship Statistics"
|
||||||
|
fit_content_height = true
|
||||||
|
|
||||||
|
[node name="Health" type="ProgressBar" parent="Container"]
|
||||||
|
margin_top = 19.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 33.0
|
||||||
|
max_value = 1000.0
|
||||||
|
step = 1.0
|
||||||
|
|
||||||
|
[node name="Supplies" type="ProgressBar" parent="Container"]
|
||||||
|
margin_top = 37.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 51.0
|
||||||
|
max_value = 1000.0
|
||||||
|
step = 1.0
|
||||||
|
|
||||||
|
[node name="Crew" type="ProgressBar" parent="Container"]
|
||||||
|
margin_top = 55.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 69.0
|
||||||
|
min_value = 1.0
|
||||||
|
max_value = 15.0
|
||||||
|
step = 1.0
|
||||||
|
value = 1.0
|
||||||
|
|
||||||
|
[node name="DeltaV" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_top = 73.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 88.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "[center]X / Y Δv[/center]"
|
||||||
|
text = "X / Y Δv"
|
||||||
|
fit_content_height = true
|
||||||
|
|
||||||
|
[node name="Label" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_top = 92.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 107.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "[center]Orbit Statistics[/center]"
|
||||||
|
text = "Orbit Statistics"
|
||||||
|
fit_content_height = true
|
||||||
|
|
||||||
|
[node name="Altitude" type="HSlider" parent="Container"]
|
||||||
|
margin_top = 111.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 127.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
rect_min_size = Vector2( 200, 0 )
|
||||||
|
step = 1.0
|
||||||
|
editable = false
|
||||||
|
scrollable = false
|
||||||
|
|
||||||
|
[node name="AltitudeLabel" type="RichTextLabel" parent="Container"]
|
||||||
|
margin_top = 131.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 146.0
|
||||||
|
bbcode_enabled = true
|
||||||
|
fit_content_height = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="DragContainer" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 150.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 165.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Container/DragContainer"]
|
||||||
|
margin_right = 29.0
|
||||||
|
margin_bottom = 14.0
|
||||||
|
text = "Drag"
|
||||||
|
|
||||||
|
[node name="Drag" type="RichTextLabel" parent="Container/DragContainer"]
|
||||||
|
margin_left = 33.0
|
||||||
|
margin_right = 233.0
|
||||||
|
margin_bottom = 15.0
|
||||||
|
rect_min_size = Vector2( 200, 0 )
|
||||||
|
fit_content_height = true
|
||||||
|
|
||||||
|
[node name="DvContainer" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 169.0
|
||||||
|
margin_right = 255.0
|
||||||
|
margin_bottom = 184.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Container/DvContainer"]
|
||||||
|
margin_right = 49.0
|
||||||
|
margin_bottom = 14.0
|
||||||
|
text = "escp dv"
|
||||||
|
|
||||||
|
[node name="EstEscapeDV" type="RichTextLabel" parent="Container/DvContainer"]
|
||||||
|
margin_left = 53.0
|
||||||
|
margin_right = 253.0
|
||||||
|
margin_bottom = 15.0
|
||||||
|
rect_min_size = Vector2( 200, 0 )
|
||||||
|
fit_content_height = true
|