Ajout d'un mode infini
This commit is contained in:
@@ -50,7 +50,7 @@ func story():
|
||||
AudioManager.play_sfx("Respawn")
|
||||
|
||||
if (
|
||||
GameInfo.game_data.progression_data.story_step is TutorialStoryStep
|
||||
GameInfo.game_data.progression_data.get_story_step() is TutorialStoryStep
|
||||
and not TutorialStoryStep.INTRO_DIALOG in GameInfo.game_data.dialogs_done
|
||||
):
|
||||
%Phone.play_audio()
|
||||
@@ -80,7 +80,7 @@ func story():
|
||||
|
||||
func finish_scene():
|
||||
GameInfo.game_data.start_run()
|
||||
if GameInfo.game_data.progression_data.story_step is TutorialStoryStep:
|
||||
if GameInfo.game_data.progression_data.get_story_step() is TutorialStoryStep:
|
||||
GameInfo.game_data.current_run.choose_next_run_point()
|
||||
SceneManager.change_to_scene(RegionScene.new(GameInfo.game_data.current_region_data))
|
||||
else:
|
||||
|
||||
@@ -32,9 +32,4 @@ visible = false
|
||||
[node name="InteractTutorial" parent="Player3D/CanvasLayer/3dTutorial" parent_id_path=PackedInt32Array(549819967, 259323543) index="1" unique_id=1117243867]
|
||||
visible = false
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="." unique_id=281886327]
|
||||
transform = Transform3D(-0.98900557, 0.015714146, -0.14704114, -9.0072927e-10, 0.99433786, 0.10626406, 0.14787856, 0.10509577, -0.9834057, -2.3532534, 1.3807694, -30.463974)
|
||||
current = true
|
||||
fov = 90.9
|
||||
|
||||
[editable path="Player3D"]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dd6k80rhux1do" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/plant_info_screen.tscn" id="12_pxmsf"]
|
||||
[ext_resource type="PackedScene" uid="uid://da7a74dg30q1l" path="res://entities/player_3d/player_3D.tscn" id="13_a2cx2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd8j7v7qtybi8" path="res://stages/3d_scenes/cockpit_scene/ship_tutorial.tscn" id="13_u7lr8"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxap4l7udy5ek" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/infinite_mode_screen.tscn" id="13_wrlf0"]
|
||||
[ext_resource type="Material" uid="uid://cr7bp4fhh1ipr" path="res://entities/player_3d/resources/materials/post_process_quad.tres" id="14_d1blr"]
|
||||
[ext_resource type="PackedScene" uid="uid://ci4x1q326lvyy" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn" id="15_q4ojn"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn2hob1i72a25" path="res://stages/3d_scenes/cockpit_scene/fail_tutorial.tscn" id="15_wrlf0"]
|
||||
@@ -202,8 +203,14 @@ unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.239, 0, 4.02)
|
||||
|
||||
[node name="MutationDiscoveryScreen" parent="." unique_id=1948337200 instance=ExtResource("15_q4ojn")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 1.1896521, 0.015508115, 3.982)
|
||||
|
||||
[node name="InfiniteModeScreen" parent="." unique_id=1282307433 instance=ExtResource("13_wrlf0")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, 1.509958e-07, 0, 1, 0, -1.509958e-07, 0, -1, 1.1896521, 0.015508115, 3.982)
|
||||
visible = false
|
||||
|
||||
[node name="ShipTutorial" parent="." unique_id=868547496 node_paths=PackedStringArray("player") instance=ExtResource("13_u7lr8")]
|
||||
unique_name_in_owner = true
|
||||
player = NodePath("../Player3D")
|
||||
|
||||
@@ -241,6 +241,7 @@ size = Vector2i(1000, 512)
|
||||
[node name="TravelScreenContent" parent="TravelScreen/SubViewport" unique_id=1386845472 instance=ExtResource("17_emtfq")]
|
||||
unique_name_in_owner = true
|
||||
current_position = 4.0
|
||||
start = 4
|
||||
|
||||
[node name="StatusScreen" type="Sprite3D" parent="." unique_id=1257606535]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
[gd_scene format=3 uid="uid://dxap4l7udy5ek"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c1pmeo36i3ltn" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd" id="1_ubdy2"]
|
||||
[ext_resource type="Texture2D" uid="uid://sdrr43mek1cl" path="res://common/icons/globe.svg" id="2_fuw08"]
|
||||
[ext_resource type="Texture2D" uid="uid://uckrw5fan88k" path="res://common/icons/flag-2.svg" id="4_fuw08"]
|
||||
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="6_8ylkf"]
|
||||
[ext_resource type="PackedScene" uid="uid://i28ngc4hgq85" path="res://stages/3d_scenes/cockpit_scene/assets/3d/furnitures/screen.blend" id="7_sftbg"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_c5x8t"]
|
||||
viewport_path = NodePath("Sprite3D/SubViewport")
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_5jpjd"]
|
||||
font = ExtResource("6_8ylkf")
|
||||
font_size = 40
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ye21k"]
|
||||
font = ExtResource("6_8ylkf")
|
||||
font_size = 100
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wrlf0"]
|
||||
|
||||
[node name="InfiniteModeScreen" type="Node3D" unique_id=1881622243]
|
||||
script = ExtResource("1_ubdy2")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1624784968]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004657, 0, 0)
|
||||
pixel_size = 0.001
|
||||
texture = SubResource("ViewportTexture_c5x8t")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=1689184715]
|
||||
disable_3d = true
|
||||
transparent_bg = true
|
||||
size = Vector2i(813, 592)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Sprite3D/SubViewport" unique_id=1462242714]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 16
|
||||
alignment = 1
|
||||
|
||||
[node name="ActualDistanceTitle" type="HBoxContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=100436141]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
alignment = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Sprite3D/SubViewport/VBoxContainer/ActualDistanceTitle" unique_id=1852125670]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource("2_fuw08")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ActualDistanceTitleLabel" type="Label" parent="Sprite3D/SubViewport/VBoxContainer/ActualDistanceTitle" unique_id=1148366912]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "ACTUAL_DISTANCE"
|
||||
label_settings = SubResource("LabelSettings_5jpjd")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ActualDistanceValue" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=691842407]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_ye21k")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=464982333]
|
||||
layout_mode = 2
|
||||
theme_override_styles/separator = SubResource("StyleBoxEmpty_wrlf0")
|
||||
|
||||
[node name="BestDistanceTitle" type="HBoxContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=906856317]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
alignment = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Sprite3D/SubViewport/VBoxContainer/BestDistanceTitle" unique_id=1113494421]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource("4_fuw08")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="BestDistanceTitleLabel" type="Label" parent="Sprite3D/SubViewport/VBoxContainer/BestDistanceTitle" unique_id=2111278269]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "BEST_DISTANCE"
|
||||
label_settings = SubResource("LabelSettings_5jpjd")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="BestDistanceValue" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=44844379]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_ye21k")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="ScreenModel" parent="." unique_id=1871285491 instance=ExtResource("7_sftbg")]
|
||||
@@ -0,0 +1,39 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
class_name InfiniteModeScreen
|
||||
|
||||
const YELLOW_COLOR = Color("e29f32")
|
||||
|
||||
@export var actual_distance : int = 0 :
|
||||
set(v):
|
||||
actual_distance = v
|
||||
update()
|
||||
@export var best_distance : int = 0 :
|
||||
set(v):
|
||||
best_distance = v
|
||||
update()
|
||||
@export var colored_distance : bool = false :
|
||||
set(v):
|
||||
colored_distance = v
|
||||
update()
|
||||
|
||||
func _ready():
|
||||
if not Engine.is_editor_hint():
|
||||
fetch_game_values()
|
||||
update()
|
||||
|
||||
func fetch_game_values() -> void:
|
||||
actual_distance = GameInfo.game_data.current_run.level * 100
|
||||
best_distance = max(
|
||||
GameInfo.game_data.current_run.level * 100,
|
||||
GameInfo.game_data.progression_data.best_run * 100
|
||||
)
|
||||
colored_distance = actual_distance == best_distance
|
||||
|
||||
func update():
|
||||
if is_node_ready():
|
||||
%ActualDistanceValue.text = str(actual_distance)
|
||||
%BestDistanceValue.text = str(best_distance)
|
||||
|
||||
%ActualDistanceValue.modulate = YELLOW_COLOR if colored_distance else Color.WHITE
|
||||
%BestDistanceValue.modulate = YELLOW_COLOR if colored_distance else Color.WHITE
|
||||
@@ -0,0 +1 @@
|
||||
uid://c1pmeo36i3ltn
|
||||
@@ -12,9 +12,9 @@ const MUTATION_DISCOVERY_ELEMENT_SCENE = preload("res://stages/3d_scenes/cockpit
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if not Engine.is_editor_hint():
|
||||
all_mutations = GameInfo.game_data.progression_data.all_mutations
|
||||
mutations_unlocked = GameInfo.game_data.progression_data.mutations_unlocked
|
||||
planted_mutation_ids = GameInfo.game_data.progression_data.planted_mutation_ids
|
||||
all_mutations = GameInfo.game_data.progression_data.get_all_mutations()
|
||||
mutations_unlocked = len(GameInfo.game_data.progression_data.get_available_mutations())
|
||||
planted_mutation_ids = GameInfo.game_data.progression_data.get_mutations_discovered()
|
||||
update()
|
||||
|
||||
func update():
|
||||
|
||||
@@ -7,6 +7,7 @@ const START_ICON = preload("res://common/icons/device-floppy.svg")
|
||||
const REGION_ICON = preload("res://common/icons/globe.svg")
|
||||
const DESTINATION_ICON = preload("res://common/icons/flag-2.svg")
|
||||
const DANGER_ICON = preload("res://common/icons/alert-triangle.svg")
|
||||
const AND_MORE_ICON = preload("res://common/icons/dots.svg")
|
||||
|
||||
const PREVIOUS_COLOR = Color("2364AAAA")
|
||||
const CURRENT_COLOR = Color("e29f32")
|
||||
@@ -14,53 +15,78 @@ const NEXT_COLOR = Color("96B3DB")
|
||||
|
||||
const WIDTH = 800
|
||||
const V_DIST = 50
|
||||
const ANIMATION_SPEED := 5.0
|
||||
const MAX_STEP = 8
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = update
|
||||
@export_tool_button("Update recreate", "Callable") var update_recreate_action = func (): update(true, true)
|
||||
|
||||
@export var current_position : float = 0
|
||||
@export var story_step : StoryStep
|
||||
@export var start : int = 0
|
||||
|
||||
func _ready():
|
||||
update()
|
||||
update(false, true)
|
||||
|
||||
var ship_icon : Sprite2D
|
||||
|
||||
func update(with_animation := true):
|
||||
func update(with_animation := true, recreate_map = false):
|
||||
|
||||
if is_node_ready() and story_step:
|
||||
if recreate_map or not ship_icon:
|
||||
|
||||
if story_step and get_step_number() < story_step.get_region_sequence_length():
|
||||
start = floori(current_position)
|
||||
else:
|
||||
start = 0
|
||||
|
||||
for c in %Icons.get_children():
|
||||
c.queue_free()
|
||||
|
||||
for i in range(get_step_number()):
|
||||
var level = i + start
|
||||
var icon = REGION_ICON
|
||||
if story_step and level == 0:
|
||||
icon = START_ICON
|
||||
elif story_step and level == story_step.get_region_sequence_length() - 1:
|
||||
icon = DESTINATION_ICON
|
||||
|
||||
var color = NEXT_COLOR
|
||||
if level < current_position - start:
|
||||
color = PREVIOUS_COLOR
|
||||
elif level == current_position - start:
|
||||
color = CURRENT_COLOR
|
||||
|
||||
var modifiers := story_step.get_story_modifiers_for_region(level)
|
||||
modifiers.append_array(story_step.get_gameplay_modifiers_for_region(level))
|
||||
for m_i in range(len(modifiers)):
|
||||
spawn_icon(modifiers[m_i].get_icon(), Vector2(i,-m_i - 1),color, 0.7)
|
||||
|
||||
if story_step.is_run_point_dangerous(level):
|
||||
spawn_icon(DANGER_ICON, Vector2(i,-len(modifiers) - 1),color, 0.7)
|
||||
|
||||
spawn_icon(icon, Vector2(i,0),color)
|
||||
|
||||
ship_icon = spawn_icon(SHIP_ICON, Vector2(current_position - start, 1), CURRENT_COLOR, 1)
|
||||
|
||||
if story_step and get_step_number() + start < story_step.get_region_sequence_length():
|
||||
spawn_icon(AND_MORE_ICON, Vector2(get_step_number(), 0), NEXT_COLOR)
|
||||
|
||||
if ship_icon and with_animation:
|
||||
var tween = create_tween()
|
||||
tween.set_trans(Tween.TRANS_SPRING)
|
||||
tween.tween_property(ship_icon,"position",coord_to_pos(Vector2(current_position, 1)),5.)
|
||||
|
||||
tween.tween_property(ship_icon,"position",coord_to_pos(Vector2(current_position - start, 1)),ANIMATION_SPEED)
|
||||
|
||||
await tween.finished
|
||||
|
||||
for c in %Icons.get_children():
|
||||
c.queue_free()
|
||||
|
||||
for i in range(get_step_number()):
|
||||
var icon = REGION_ICON
|
||||
if i == 0:
|
||||
icon = START_ICON
|
||||
elif i == get_step_number() - 1:
|
||||
icon = DESTINATION_ICON
|
||||
for icon in %Icons.get_children():
|
||||
var color = NEXT_COLOR
|
||||
if icon.position.x < ship_icon.position.x:
|
||||
color = PREVIOUS_COLOR
|
||||
elif icon.position.x == ship_icon.position.x:
|
||||
color = CURRENT_COLOR
|
||||
icon.modulate = color
|
||||
|
||||
var color = NEXT_COLOR
|
||||
if i < current_position:
|
||||
color = PREVIOUS_COLOR
|
||||
elif i == current_position:
|
||||
color = CURRENT_COLOR
|
||||
|
||||
var modifiers := story_step.get_story_modifiers_for_region(i)
|
||||
modifiers.append_array(story_step.get_gameplay_modifiers_for_region(i))
|
||||
for m_i in range(len(modifiers)):
|
||||
spawn_icon(modifiers[m_i].get_icon(), Vector2(i,-m_i - 1),color, 0.7)
|
||||
|
||||
if story_step.is_run_point_dangerous(i):
|
||||
spawn_icon(DANGER_ICON, Vector2(i,-len(modifiers) - 1),color, 0.7)
|
||||
|
||||
spawn_icon(icon, Vector2(i,0),color)
|
||||
|
||||
ship_icon = spawn_icon(SHIP_ICON, Vector2(current_position, 1), CURRENT_COLOR, 1)
|
||||
|
||||
func spawn_icon(texture : Texture, coord := Vector2.ZERO, color := Color.WHITE, scaling := 1.) -> Sprite2D:
|
||||
var new_icon = Sprite2D.new()
|
||||
@@ -76,7 +102,7 @@ func spawn_icon(texture : Texture, coord := Vector2.ZERO, color := Color.WHITE,
|
||||
|
||||
func get_step_number() -> int:
|
||||
if story_step:
|
||||
return story_step.get_region_sequence_length()
|
||||
return min(story_step.get_region_sequence_length(), MAX_STEP)
|
||||
return 0
|
||||
|
||||
func coord_to_pos(coord : Vector2) -> Vector2:
|
||||
|
||||
@@ -7,6 +7,7 @@ shader = ExtResource("1_5gx2n")
|
||||
shader_parameter/line_number = 6.0
|
||||
shader_parameter/line_color = Color(0.13725491, 0.39215687, 0.6666667, 1)
|
||||
shader_parameter/line_thickness = 0.002000000095
|
||||
shader_parameter/inverse_result = false
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_psxhb"]
|
||||
noise_type = 2
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
[gd_scene format=3 uid="uid://dj4u5grx00ky1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://r1gn83h8re8m" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd" id="1_u6tks"]
|
||||
[ext_resource type="Script" uid="uid://bdonub7t01xmi" path="res://common/game_data/scripts/story/infinite_story_step.gd" id="2_xeca8"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_iergx"]
|
||||
script = ExtResource("2_xeca8")
|
||||
metadata/_custom_type_script = "uid://bdonub7t01xmi"
|
||||
|
||||
[node name="TravelScreenContent" type="Node2D" unique_id=1386845472]
|
||||
position = Vector2(500, 256)
|
||||
script = ExtResource("1_u6tks")
|
||||
current_position = 2.0
|
||||
current_position = 3.0
|
||||
story_step = SubResource("Resource_iergx")
|
||||
start = 2
|
||||
|
||||
[node name="Icons" type="Node2D" parent="." unique_id=1787603855]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -35,10 +35,9 @@ func _ready():
|
||||
if not "ship" in GameInfo.game_data.tutorials_done:
|
||||
await get_tree().create_timer(1).timeout
|
||||
%ShipTutorial.appear()
|
||||
|
||||
|
||||
if GameInfo.game_data.game_mode == GameData.GameMode.STORY:
|
||||
update_dialogs()
|
||||
%MutationDiscoveryScreen.visible = GameInfo.game_data.game_mode == GameData.Mode.STORY
|
||||
%InfiniteModeScreen.visible = GameInfo.game_data.game_mode == GameData.Mode.INFINITE
|
||||
|
||||
func update_dialogs():
|
||||
if GameInfo.game_data and GameInfo.game_data.current_run:
|
||||
@@ -87,6 +86,7 @@ func _on_phone_clicked():
|
||||
|
||||
func move_to_choosen_run_point():
|
||||
GameInfo.game_data.current_run.choose_next_run_point(choosen_run_point)
|
||||
%InfiniteModeScreen.fetch_game_values()
|
||||
|
||||
func can_exit() -> bool:
|
||||
return (
|
||||
|
||||
@@ -6,12 +6,7 @@ func _ready():
|
||||
%TakeOffAnimationPlayer.play("TookOff")
|
||||
|
||||
if GameInfo.game_data:
|
||||
%Planet3d.fertility_factor = (
|
||||
max(0,float(GameInfo.game_data.progression_data.story_step_i - 1))
|
||||
/ len(
|
||||
GameInfo.game_data.progression_data.get_all_story_steps()
|
||||
) - 1
|
||||
)
|
||||
%Planet3d.fertility_factor = (GameInfo.game_data.progression_data.get_story_progression())
|
||||
|
||||
%Ship.take_off.connect(_on_ship_take_off)
|
||||
%Ship.land.connect(_on_ship_land)
|
||||
|
||||
@@ -10,7 +10,7 @@ func setup_room(door_id : int):
|
||||
var all_vending_machines = %VendingMachines.get_children() as Array[VendingMachine3d]
|
||||
var vending_machine : VendingMachine3d = all_vending_machines[rng.randi()%len(all_vending_machines)]
|
||||
|
||||
var available_artefacts = GameInfo.game_data.progression_data.available_artefacts
|
||||
var available_artefacts = GameInfo.game_data.progression_data.get_all_artifacts()
|
||||
var artefacts = []
|
||||
|
||||
while len(artefacts) < 2:
|
||||
|
||||
Reference in New Issue
Block a user