This commit is contained in:
user 2024-12-29 03:07:59 +01:00
parent 3e410de576
commit c033c4679a
16 changed files with 1411 additions and 49 deletions

View File

@ -5,7 +5,7 @@
[ext_resource type="Script" path="res://src/spine_sprite.gd" id="5_f351d"] [ext_resource type="Script" path="res://src/spine_sprite.gd" id="5_f351d"]
[ext_resource type="SpineSkeletonFileResource" uid="uid://dy0llktw1x7i6" path="res://assets/characters/pasadena/spine.skel" id="5_k5je5"] [ext_resource type="SpineSkeletonFileResource" uid="uid://dy0llktw1x7i6" path="res://assets/characters/pasadena/spine.skel" id="5_k5je5"]
[sub_resource type="ViewportTexture" id="ViewportTexture_6ixgq"] [sub_resource type="ViewportTexture" id="ViewportTexture_5dikh"]
viewport_path = NodePath("MeshInstance3D/SubViewport") viewport_path = NodePath("MeshInstance3D/SubViewport")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a31vv"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a31vv"]
@ -16,7 +16,7 @@ diffuse_mode = 3
specular_mode = 1 specular_mode = 1
disable_fog = true disable_fog = true
vertex_color_use_as_albedo = true vertex_color_use_as_albedo = true
albedo_texture = SubResource("ViewportTexture_6ixgq") albedo_texture = SubResource("ViewportTexture_5dikh")
billboard_mode = 1 billboard_mode = 1
[sub_resource type="QuadMesh" id="QuadMesh_iwcmf"] [sub_resource type="QuadMesh" id="QuadMesh_iwcmf"]
@ -44,6 +44,7 @@ axis_lock_angular_z = true
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
layers = 4
material_override = SubResource("StandardMaterial3D_a31vv") material_override = SubResource("StandardMaterial3D_a31vv")
cast_shadow = 0 cast_shadow = 0
gi_mode = 0 gi_mode = 0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://b2maarsg7u3po"] [gd_scene load_steps=12 format=3 uid="uid://b2maarsg7u3po"]
[ext_resource type="Script" path="res://assets/characters/player.gd" id="1_fwkda"] [ext_resource type="Script" path="res://assets/characters/player.gd" id="1_fwkda"]
[ext_resource type="Script" path="res://src/viewport.gd" id="2_0d00w"] [ext_resource type="Script" path="res://src/viewport.gd" id="2_0d00w"]
@ -6,12 +6,16 @@
[ext_resource type="Script" path="res://src/camera_3d.gd" id="2_cjtsr"] [ext_resource type="Script" path="res://src/camera_3d.gd" id="2_cjtsr"]
[ext_resource type="Script" path="res://src/spine_sprite.gd" id="4_bwb5d"] [ext_resource type="Script" path="res://src/spine_sprite.gd" id="4_bwb5d"]
[sub_resource type="ViewportTexture" id="ViewportTexture_d2fqw"] [sub_resource type="ViewportTexture" id="ViewportTexture_472lm"]
viewport_path = NodePath("MeshInstance3D/SubViewport") viewport_path = NodePath("MeshInstance3D/SubViewport")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5xxpu"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a31vv"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a31vv"]
next_pass = SubResource("ShaderMaterial_5xxpu")
transparency = 1 transparency = 1
albedo_texture = SubResource("ViewportTexture_d2fqw") diffuse_mode = 3
albedo_texture = SubResource("ViewportTexture_472lm")
[sub_resource type="QuadMesh" id="QuadMesh_iwcmf"] [sub_resource type="QuadMesh" id="QuadMesh_iwcmf"]
@ -30,12 +34,13 @@ script = ExtResource("1_fwkda")
transform = Transform3D(0.999987, -0.00490892, -0.00171441, 0.00514322, 0.982274, 0.187381, 0.000764184, -0.187388, 0.982286, -0.015, 1.154, 5.342) transform = Transform3D(0.999987, -0.00490892, -0.00171441, 0.00514322, 0.982274, 0.187381, 0.000764184, -0.187388, 0.982286, -0.015, 1.154, 5.342)
current = true current = true
fov = 19.0 fov = 19.0
size = 2.0 size = 1.5
far = 1000.0 far = 1000.0
script = ExtResource("2_cjtsr") script = ExtResource("2_cjtsr")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(0.999996, 0.0005929, -0.00274461, 0, 0.977453, 0.211152, 0.00280793, -0.211152, 0.977449, 0, 0, 0) transform = Transform3D(0.999996, 0.0005929, -0.00274461, 0, 0.977453, 0.211152, 0.00280793, -0.211152, 0.977449, 0, 0, 0)
layers = 2
material_override = SubResource("StandardMaterial3D_a31vv") material_override = SubResource("StandardMaterial3D_a31vv")
cast_shadow = 0 cast_shadow = 0
mesh = SubResource("QuadMesh_iwcmf") mesh = SubResource("QuadMesh_iwcmf")

View File

@ -1,27 +1,21 @@
[gd_scene load_steps=21 format=3 uid="uid://b2b0sgltiefki"] [gd_scene load_steps=22 format=3 uid="uid://b2b0sgltiefki"]
[ext_resource type="Script" path="res://assets/levels/level_1.gd" id="1_4n7jv"] [ext_resource type="Script" path="res://assets/levels/level_1.gd" id="1_4n7jv"]
[ext_resource type="Texture2D" uid="uid://h04a4ju855bp" path="res://assets/objects/kenney_prototype-textures/PNG/Dark/texture_02.png" id="1_xris1"] [ext_resource type="Texture2D" uid="uid://h04a4ju855bp" path="res://assets/objects/kenney_prototype-textures/PNG/Dark/texture_02.png" id="1_xris1"]
[ext_resource type="PackedScene" uid="uid://hylwpibwtg0c" path="res://assets/objects/box/box.tscn" id="2_8p87y"] [ext_resource type="PackedScene" uid="uid://hylwpibwtg0c" path="res://assets/objects/box/box.tscn" id="2_8p87y"]
[ext_resource type="PackedScene" uid="uid://s1ftlvvluili" path="res://assets/objects/box_small/box_small.tscn" id="2_ml88v"] [ext_resource type="PackedScene" uid="uid://s1ftlvvluili" path="res://assets/objects/box_small/box_small.tscn" id="2_ml88v"]
[ext_resource type="PackedScene" uid="uid://bs6cfck1f4yp5" path="res://assets/objects/transition.tscn" id="5_if8du"] [ext_resource type="PackedScene" uid="uid://bs6cfck1f4yp5" path="res://assets/objects/transition.tscn" id="5_if8du"]
[ext_resource type="PackedScene" uid="uid://b2hrbmuimfxj8" path="res://assets/levels/level2.tscn" id="6_cjkey"]
[ext_resource type="Script" path="res://src/viewport.gd" id="6_uuo0x"] [ext_resource type="Script" path="res://src/viewport.gd" id="6_uuo0x"]
[ext_resource type="Texture2D" uid="uid://x60cxv42nmsa" path="res://assets/bubbles.png" id="7_el3mb"] [ext_resource type="Texture2D" uid="uid://x60cxv42nmsa" path="res://assets/bubbles.png" id="7_el3mb"]
[ext_resource type="PackedScene" uid="uid://bh6be020myw3t" path="res://assets/levels/level3.tscn" id="7_n0sps"]
[ext_resource type="Shader" path="res://assets/levels/test.gdshader" id="8_68tud"] [ext_resource type="Shader" path="res://assets/levels/test.gdshader" id="8_68tud"]
[ext_resource type="PackedScene" uid="uid://cbfoxxoamehgg" path="res://assets/characters/npc.tscn" id="9_kit50"] [ext_resource type="PackedScene" uid="uid://cbfoxxoamehgg" path="res://assets/characters/npc.tscn" id="9_kit50"]
[ext_resource type="PackedScene" uid="uid://ck73aacpkronl" path="res://assets/objects/wall/wall.tscn" id="10_dy0n7"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_ulx7c"]
sky_top_color = Color(0.129, 0.129, 0.129, 1)
sky_horizon_color = Color(0.129, 0.129, 0.129, 1)
ground_bottom_color = Color(0.129, 0.129, 0.129, 1)
ground_horizon_color = Color(0.129, 0.129, 0.129, 1)
[sub_resource type="Sky" id="Sky_rnwem"]
sky_material = SubResource("ProceduralSkyMaterial_ulx7c")
[sub_resource type="Environment" id="Environment_06i34"] [sub_resource type="Environment" id="Environment_06i34"]
background_mode = 2 background_mode = 2
sky = SubResource("Sky_rnwem") sky_custom_fov = 1.5
tonemap_mode = 2 tonemap_mode = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_er7pi"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_er7pi"]
@ -36,14 +30,14 @@ size = Vector2(10, 5)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_flcen"] [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_flcen"]
data = PackedVector3Array(5, 0, 5, -5, 0, 5, 5, 0, -5, -5, 0, 5, -5, 0, -5, 5, 0, -5) data = PackedVector3Array(5, 0, 5, -5, 0, 5, 5, 0, -5, -5, 0, 5, -5, 0, -5, 5, 0, -5)
[sub_resource type="ViewportTexture" id="ViewportTexture_puele"] [sub_resource type="ViewportTexture" id="ViewportTexture_udj7f"]
viewport_path = NodePath("MeshInstance3D/SubViewport") viewport_path = NodePath("MeshInstance3D/SubViewport")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mdr1l"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mdr1l"]
transparency = 2 transparency = 2
alpha_scissor_threshold = 0.5 alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0 alpha_antialiasing_mode = 0
albedo_texture = SubResource("ViewportTexture_puele") albedo_texture = SubResource("ViewportTexture_udj7f")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lrfyr"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_lrfyr"]
@ -67,8 +61,12 @@ environment = SubResource("Environment_06i34")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.990369, 0.119902, -0.0692252, 0, 0.499998, 0.866027, 0.138451, -0.857686, 0.495183, 0, 3.47491, 2.77581) transform = Transform3D(0.990369, 0.119902, -0.0692252, 0, 0.499998, 0.866027, 0.138451, -0.857686, 0.495183, 0, 3.47491, 2.77581)
light_energy = 0.454 layers = 0
shadow_enabled = true light_cull_mask = 4293918720
shadow_reverse_cull_face = true
shadow_opacity = 0.0
shadow_blur = 0.0
directional_shadow_mode = 0
directional_shadow_max_distance = 54.0 directional_shadow_max_distance = 54.0
[node name="Floor" type="MeshInstance3D" parent="."] [node name="Floor" type="MeshInstance3D" parent="."]
@ -88,7 +86,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.31663, 0.5, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.61149, 0.132777, -0.890927) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.61149, 0.132777, -0.890927)
[node name="Transition" parent="." instance=ExtResource("5_if8du")] [node name="Transition" parent="." instance=ExtResource("5_if8du")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0.0325054, 1) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0.0325054, 0)
to_ = ExtResource("7_n0sps")
[node name="Transition2" parent="." instance=ExtResource("5_if8du")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.51772, 0.0276638, 0.00178146)
to_ = ExtResource("6_cjkey")
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
@ -103,9 +106,21 @@ script = ExtResource("6_uuo0x")
[node name="SubViewport" type="SubViewport" parent="MeshInstance3D"] [node name="SubViewport" type="SubViewport" parent="MeshInstance3D"]
[node name="ColorRect" type="ColorRect" parent="MeshInstance3D/SubViewport"] [node name="ColorRect" type="ColorRect" parent="MeshInstance3D/SubViewport"]
light_mask = 0
material = SubResource("ShaderMaterial_d4amb") material = SubResource("ShaderMaterial_d4amb")
offset_right = 512.0 offset_right = 512.0
offset_bottom = 512.0 offset_bottom = 512.0
[node name="NPC" parent="." instance=ExtResource("9_kit50")] [node name="NPC" parent="." instance=ExtResource("9_kit50")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.565993, 0.48192, -0.421152) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.565993, 0.48192, -0.421152)
[node name="Wall" parent="." instance=ExtResource("10_dy0n7")]
transform = Transform3D(-7.52286e-09, 0, 1, 0, 1, 0, -0.172103, 0, -4.37114e-08, -2, 0, -2)
[node name="DirectionalLight3D2" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 1, 0)
visible = false
layers = 0
light_energy = 0.831
light_bake_mode = 0
light_cull_mask = 4294443008

View File

@ -1,7 +1,9 @@
[gd_scene load_steps=9 format=3 uid="uid://b2hrbmuimfxj8"] [gd_scene load_steps=11 format=3 uid="uid://b2hrbmuimfxj8"]
[ext_resource type="Texture2D" uid="uid://h04a4ju855bp" path="res://assets/objects/kenney_prototype-textures/PNG/Dark/texture_02.png" id="1_54j28"] [ext_resource type="Texture2D" uid="uid://h04a4ju855bp" path="res://assets/objects/kenney_prototype-textures/PNG/Dark/texture_02.png" id="1_54j28"]
[ext_resource type="PackedScene" uid="uid://hylwpibwtg0c" path="res://assets/objects/box/box.tscn" id="2_owuk1"] [ext_resource type="PackedScene" uid="uid://hylwpibwtg0c" path="res://assets/objects/box/box.tscn" id="2_owuk1"]
[ext_resource type="PackedScene" uid="uid://bs6cfck1f4yp5" path="res://assets/objects/transition.tscn" id="3_p5ecg"]
[ext_resource type="PackedScene" uid="uid://b2b0sgltiefki" path="res://assets/levels/level1.tscn" id="4_sk633"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tp8ku"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tp8ku"]
sky_top_color = Color(0.129, 0.129, 0.129, 1) sky_top_color = Color(0.129, 0.129, 0.129, 1)
@ -55,4 +57,8 @@ shape = SubResource("ConcavePolygonShape3D_w1gda")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.00805, 0.25778, -0.993837) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.00805, 0.25778, -0.993837)
[node name="Box2" parent="." instance=ExtResource("2_owuk1")] [node name="Box2" parent="." instance=ExtResource("2_owuk1")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.447608, 0.258858, -0.51353) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.447608, 0.258858, -2.72201)
[node name="Transition" parent="." instance=ExtResource("3_p5ecg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.55105, 0.0474857, -0.0136185)
to_ = ExtResource("4_sk633")

64
assets/levels/level3.tscn Normal file
View File

@ -0,0 +1,64 @@
[gd_scene load_steps=11 format=3 uid="uid://bh6be020myw3t"]
[ext_resource type="Texture2D" uid="uid://h04a4ju855bp" path="res://assets/objects/kenney_prototype-textures/PNG/Dark/texture_02.png" id="1_trws4"]
[ext_resource type="PackedScene" uid="uid://hylwpibwtg0c" path="res://assets/objects/box/box.tscn" id="2_fn56u"]
[ext_resource type="PackedScene" uid="uid://bs6cfck1f4yp5" path="res://assets/objects/transition.tscn" id="3_36sk0"]
[ext_resource type="PackedScene" uid="uid://b2b0sgltiefki" path="res://assets/levels/level1.tscn" id="4_7w3pv"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tp8ku"]
sky_top_color = Color(0.129, 0.129, 0.129, 1)
sky_horizon_color = Color(0.129, 0.129, 0.129, 1)
ground_bottom_color = Color(0.129, 0.129, 0.129, 1)
ground_horizon_color = Color(0.129, 0.129, 0.129, 1)
[sub_resource type="Sky" id="Sky_shl8g"]
sky_material = SubResource("ProceduralSkyMaterial_tp8ku")
[sub_resource type="Environment" id="Environment_d3cpo"]
background_mode = 2
sky = SubResource("Sky_shl8g")
tonemap_mode = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t7r8y"]
albedo_texture = ExtResource("1_trws4")
uv1_triplanar = true
[sub_resource type="PlaneMesh" id="PlaneMesh_ka7wb"]
lightmap_size_hint = Vector2i(52, 52)
material = SubResource("StandardMaterial3D_t7r8y")
size = Vector2(50, 50)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_w1gda"]
data = PackedVector3Array(5, 0, 5, -5, 0, 5, 5, 0, -5, -5, 0, 5, -5, 0, -5, 5, 0, -5)
[node name="Level" type="Node3D"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_d3cpo")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.990369, 0.119902, -0.0692252, 0, 0.499998, 0.866027, 0.138451, -0.857686, 0.495183, 0, 3.47491, 2.77581)
light_energy = 0.454
shadow_enabled = true
directional_shadow_max_distance = 54.0
[node name="Floor" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00175023, -5.96046e-08, 0.00229335)
mesh = SubResource("PlaneMesh_ka7wb")
skeleton = NodePath("../DirectionalLight3D")
[node name="StaticBody3D" type="StaticBody3D" parent="Floor"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D"]
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0)
shape = SubResource("ConcavePolygonShape3D_w1gda")
[node name="Box" parent="." instance=ExtResource("2_fn56u")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.00805, 0.25778, -1.99384)
[node name="Box2" parent="." instance=ExtResource("2_fn56u")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.88343, 0.258858, -3.32785)
[node name="Transition" parent="." instance=ExtResource("3_36sk0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.76062, 0.0104516, -0.702033)
to_ = ExtResource("4_7w3pv")

View File

@ -32,5 +32,3 @@ script = ExtResource("6_xklu3")
[node name="CameraManager" type="Node" parent="."] [node name="CameraManager" type="Node" parent="."]
script = ExtResource("7_i2npv") script = ExtResource("7_i2npv")
[node name="MainCamera" type="Camera3D" parent="CameraManager"]

View File

@ -21,4 +21,5 @@ shape = SubResource("BoxShape3D_w7cyf")
[node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D"] [node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0) transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
layers = 524288
mesh = SubResource("BoxMesh_u56mx") mesh = SubResource("BoxMesh_u56mx")

View File

@ -1,17 +1,17 @@
extends Node3D extends Node3D
@export var to_: Node = null; @export var to_: Resource = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
pass # Replace with function body. pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
pass pass
func _on_area_3d_area_entered(area: Area3D) -> void: func _on_area_3d_area_entered(area: Area3D) -> void:
#emit_signal() if "Player" in area.get_groups():
pass print("Player stepped on transition to " + str(to_))
if not to_:
print_debug("No scene specified in transition" + str(self))
print(to_)
Messagebus.CHANGE_SCENE.emit(to_)

File diff suppressed because it is too large Load Diff

18
assets/ui/main_ui.tscn Normal file
View File

@ -0,0 +1,18 @@
[gd_scene format=3 uid="uid://sq6kut2r2bqx"]
[node name="MainUi" type="CanvasLayer"]
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="MarginContainer" type="MarginContainer" parent="Control"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0

View File

@ -21,6 +21,8 @@ config/icon="res://icon.svg"
Console="*res://addons/console/console.gd" Console="*res://addons/console/console.gd"
GDRx="*res://addons/reactivex/__gdrxsingleton__.gd" GDRx="*res://addons/reactivex/__gdrxsingleton__.gd"
CyclopsAutoload="*res://addons/cyclops_level_builder/cyclops_global_scene.tscn"
Messagebus="*res://src/messagebus.gd"
[display] [display]
@ -36,7 +38,7 @@ project/assembly_name="Test Project"
[editor_plugins] [editor_plugins]
enabled=PackedStringArray("res://addons/Todo_Manager/plugin.cfg", "res://addons/console/plugin.cfg", "res://addons/reactivex/plugin.cfg", "res://addons/script-ide/plugin.cfg") enabled=PackedStringArray("res://addons/Todo_Manager/plugin.cfg", "res://addons/console/plugin.cfg", "res://addons/cyclops_level_builder/plugin.cfg", "res://addons/reactivex/plugin.cfg", "res://addons/script-ide/plugin.cfg")
[input] [input]

View File

@ -1,19 +1,38 @@
extends Node extends Node
signal scene_transition
var CURRENT_LEVEL: Node3D = null var CURRENT_LEVEL: Node3D = null
var CURRENT_PLAYER: CharacterBody3D = null var CURRENT_PLAYER: CharacterBody3D = null
var combined_signal : Observable
var prop = ReactiveProperty.new(42)
signal TestSignal
func _ready() -> void: func _ready() -> void:
var lvl = load("res://assets/levels/level1.tscn") var lvl: Resource = load("res://assets/levels/level1.tscn")
var player = load("res://assets/characters/player.tscn") var player: Resource = load("res://assets/characters/player.tscn")
CURRENT_LEVEL = lvl.instantiate() CURRENT_LEVEL = lvl.instantiate()
CURRENT_PLAYER = player.instantiate() CURRENT_PLAYER = player.instantiate()
CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0) CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0)
add_child(CURRENT_LEVEL) add_child(CURRENT_LEVEL)
CURRENT_LEVEL.add_child(CURRENT_PLAYER) CURRENT_LEVEL.add_child(CURRENT_PLAYER)
#CURRENT_LEVEL.remove_child() combined_signal = GDRx.from_signal(Messagebus.CHANGE_SCENE)\
.first()\
.debounce(1)
combined_signal.subscribe(transition_to).dispose_with(self)
#prop.subscribe(func(i): print(">> ", i))
func transition_to(scene: PackedScene):
print(">>>>>>>"+str(scene))
CURRENT_LEVEL.remove_child(CURRENT_PLAYER)
remove_child(CURRENT_LEVEL)
var lvl = load(scene.resource_path)
var new_level = lvl.instantiate()
new_level.add_child(CURRENT_PLAYER)
CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0)
CURRENT_PLAYER.set_owner(new_level)
add_child(new_level)
print("Transitioned to "+str(scene))
CURRENT_LEVEL = new_level
func _process(delta: float) -> void: func _process(delta: float) -> void:
if (CURRENT_PLAYER.global_position.y) < -5: if (CURRENT_PLAYER.global_position.y) < -5:

View File

@ -1,11 +1,11 @@
extends Node extends Node
@export var test := 100 @export var test := 100
signal showMenu
func _ready() -> void: func _ready() -> void:
GDRx.start_periodic_timer(1.0) \ GDRx.start_periodic_timer(1.0) \
.subscribe(func(i): print("Tick: ", i)) \ .subscribe(func(i): print("Tick: ", i)) \
.dispose_with(self) .dispose_with(self)
func move() -> void: func move() -> void:
pass pass

3
src/messagebus.gd Normal file
View File

@ -0,0 +1,3 @@
extends Node
signal CHANGE_SCENE(scene)

View File

@ -1,8 +1,6 @@
@tool @tool
extends MeshInstance3D extends MeshInstance3D
@onready var camera = $"../Camera3D"
func _ready(): func _ready():
if material_override != null: if material_override != null:
material_override.albedo_texture = $SubViewport.get_texture() material_override.albedo_texture = $SubViewport.get_texture()