Level Transition enhance
This commit is contained in:
parent
adebb005ab
commit
a230a976aa
|
|
@ -7,7 +7,7 @@ extends Node
|
|||
##TODO: Should be based on screen position for starter
|
||||
onready var player_start_position := Vector2(50,50)
|
||||
|
||||
func change_level(_level_name :String):
|
||||
func change_level(_level_name :String, _position_name :String):
|
||||
print("res://src/levels/" + _level_name + ".tscn" )
|
||||
var SceneTransition = get_node("/root/Main/SceneTransition")
|
||||
#var simultaneous_scene = preload("res://levels/level2.tscn").instance()
|
||||
|
|
@ -23,6 +23,8 @@ func change_level(_level_name :String):
|
|||
get_node("/root/Main").add_child(new_level)
|
||||
get_node("/root/Main").move_child(new_level,1)
|
||||
##TODO: Probably set start position
|
||||
if new_level.entrances.has(_position_name):
|
||||
player_start_position = new_level.entrances[_position_name].transform.origin
|
||||
print (get_node("/root/Main").get_children())
|
||||
SceneTransition.reset()
|
||||
#get_node("/root/Main").add_child_below_node(SceneTransition,new_level)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ 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_position_name := 'PlayerStart'
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
|
|
@ -16,4 +16,4 @@ 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("CloneBox")
|
||||
LevelInfo.change_level(_destination_level_name, _destination_position_name)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ collision_mask = 0
|
|||
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
||||
|
||||
[node name="PlayerStart" parent="." index="3"]
|
||||
position = Vector2( -7, 28 )
|
||||
position = Vector2( 147, 18 )
|
||||
|
||||
[node name="Hitbox_Component" parent="." index="4" instance=ExtResource( 3 )]
|
||||
damage_amount = 10
|
||||
|
|
@ -36,3 +36,6 @@ color = Color( 1, 0, 0, 1 )
|
|||
modulate = Color( 1, 0, 0, 1 )
|
||||
position = Vector2( 213, 45 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="EnterLeft" type="Position2D" parent="." index="5"]
|
||||
position = Vector2( -13, 28 )
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ position = Vector2( 268, 119 )
|
|||
shape = SubResource( 1 )
|
||||
|
||||
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
|
||||
_destination_level_name = "CloneBox"
|
||||
_destination_position_name = "EnterLeft"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
|
||||
modulate = Color( 1, 0, 1, 1 )
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user