Level transition changes. Wish I could do better than a string but resources and packescenes just not working.

This commit is contained in:
Dustin 2025-05-10 12:56:50 -07:00
parent 95c217be5c
commit 371e508293
9 changed files with 90 additions and 9 deletions

BIN
assets_tmp/elevator.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/elevator.png-1f928bcc3f839b22a2d6879c8e92f1f0.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets_tmp/elevator.png"
dest_files=[ "res://.import/elevator.png-1f928bcc3f839b22a2d6879c8e92f1f0.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
assets_tmp/mmz1_door.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/mmz1_door.png-579031ede58c9d4541d47c3e98f79062.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets_tmp/mmz1_door.png"
dest_files=[ "res://.import/mmz1_door.png-579031ede58c9d4541d47c3e98f79062.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -52,11 +52,11 @@ func stop_music():
if juke_box.playing:
juke_box.stop()
func change_level(_level_name :String, _position_name :String):
print("res://src/levels/" + _level_name + ".tscn" )
func change_level(_level_path :String, _position_name :String):
#print("res://src/levels/" + _level_name + ".tscn" )
var SceneTransition = get_node("/root/Main/ViewportContainer/Viewport/SceneTransition")
#var simultaneous_scene = preload("res://levels/level2.tscn").instance()
var new_level = load("res://src/levels/" + _level_name + ".tscn" ).instance()
var new_level = load( _level_path ).instance()
#print (get_tree().get_root().get_children())
for l in viewport.get_children():

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Template.tscn" type="PackedScene" id=1]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Door.gd" type="Script" id=2]
[ext_resource path="res://assets/mmz1_door.png" type="Texture" id=3]
[ext_resource path="res://assets_tmp/mmz1_door.png" type="Texture" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )

View File

@ -4,16 +4,27 @@ extends Interactable
## Things like 'door_right', 'stairs'
## helps the Player object pick an appropriate animation
export var _transition_type := 'door_right'
export var _destination_level_name: String
#export var _destination_level_name: String
export(String, FILE, "*.tscn") var _destination_level
#export var _foo: FileDialog
export var _destination_position_name := 'PlayerStart'
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
##TODO: I'd really like to verify the pact scene is a level but I can't until its instanced.
#func _ready():
# print(_destination_level.)
# print(_destination_level.get_state(), _destination_level.get_class() , _destination_level.get_state().get_node_type(1))
# print_debug(_destination_level._bundled)
#
# assert(_destination_level.get_state().get_node_type(0) == 'Level')
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
print("Okay, I'll transition the level now!")
LevelInfo.change_level(_destination_level_name, _destination_position_name)
#LevelInfo.change_level(_destination_level_name, _destination_position_name)
LevelInfo.change_level(_destination_level, _destination_position_name)

View File

@ -51,7 +51,7 @@ position = Vector2( -13, 28 )
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
position = Vector2( -12, 31 )
_transition_type = "door_left"
_destination_level_name = "TestBox"
_destination_level = "res://src/levels/TestBox.tscn"
_destination_position_name = "EnterRight"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]

View File

@ -80,7 +80,7 @@ shape = SubResource( 1 )
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
position = Vector2( 1032, 112 )
_destination_level_name = "CloneBox"
_destination_level = "res://src/levels/CloneBox.tscn"
_destination_position_name = "EnterLeft"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]