Compare commits
2 Commits
c613eac80f
...
2763b57b40
Author | SHA1 | Date |
---|---|---|
Felipe M | 2763b57b40 | |
Felipe M | 0143c01c1e |
|
@ -7,7 +7,6 @@ var active = true
|
|||
|
||||
|
||||
func _on_Door_body_entered(player):
|
||||
print("hit door")
|
||||
if active:
|
||||
player.emit_signal("his_door", self)
|
||||
player.emit_signal("hit_door", self)
|
||||
active = false
|
||||
|
|
|
@ -13,10 +13,11 @@ collision_layer = 0
|
|||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Collider" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 16, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( -6, 0 )
|
||||
position = Vector2( 10, 0 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Door_body_entered"]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[gd_resource type="Resource" format=2]
|
||||
|
||||
[resource]
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Levels/Level.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Door.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Levels/DoorConnections/00_link_01.tres" type="Resource" id=3]
|
||||
|
||||
[node name="Level_00" instance=ExtResource( 1 )]
|
||||
|
||||
|
@ -9,4 +10,6 @@
|
|||
tile_data = PoolIntArray( 0, 0, 4, 1, 0, 196609, 2, 0, 196609, 3, 0, 196609, 4, 0, 196609, 5, 0, 196609, 6, 0, 196609, 7, 0, 196609, 8, 0, 196609, 9, 0, 196609, 10, 0, 196609, 11, 0, 196609, 12, 0, 196609, 13, 0, 196609, 14, 0, 196609, 15, 0, 196609, 16, 0, 196609, 17, 0, 196609, 18, 0, 196609, 19, 0, 7, 65536, 0, 65539, 65555, 0, 65539, 131072, 0, 65539, 131091, 0, 65539, 196608, 0, 65539, 196627, 0, 65539, 262144, 0, 65539, 262163, 0, 65539, 327680, 0, 65539, 327699, 0, 65539, 393216, 0, 65539, 393235, 0, 65539, 458752, 0, 65539, 458771, 0, 131075, 524288, 0, 65539, 589824, 0, 65539, 655360, 0, 196612, 655361, 0, 196609, 655362, 0, 196609, 655363, 0, 196609, 655364, 0, 196609, 655365, 0, 196609, 655366, 0, 196609, 655367, 0, 196609, 655368, 0, 196609, 655369, 0, 196609, 655370, 0, 196609, 655371, 0, 196609, 655372, 0, 196609, 655373, 0, 196609, 655374, 0, 196609, 655375, 0, 196609, 655376, 0, 196609, 655377, 0, 196609, 655378, 0, 196609, 655379, 0, 196610 )
|
||||
|
||||
[node name="Door" parent="." index="1" instance=ExtResource( 2 )]
|
||||
position = Vector2( 320, 144 )
|
||||
position = Vector2( 312, 144 )
|
||||
connection = ExtResource( 3 )
|
||||
new_level_path = "res://Levels/Level_01.tscn"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Levels/Door.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Level.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Levels/DoorConnections/00_link_01.tres" type="Resource" id=3]
|
||||
|
||||
[node name="Level_01" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="TileMap" parent="." index="0"]
|
||||
tile_data = PoolIntArray( 393216, 0, 4, 393217, 0, 196609, 393218, 0, 196609, 393219, 0, 196609, 393220, 0, 196609, 393221, 0, 7, 458752, 0, 131075, 458757, 0, 131075, 655360, 0, 196608, 655361, 0, 196609, 655362, 0, 196609, 655363, 0, 196609, 655364, 0, 196609, 655365, 0, 196610 )
|
||||
|
||||
[node name="InDoor" parent="." index="1" instance=ExtResource( 1 )]
|
||||
position = Vector2( 8, 144 )
|
||||
scale = Vector2( -1, 1 )
|
||||
connection = ExtResource( 3 )
|
||||
new_level_path = "res://Levels/Level_00.tscn"
|
|
@ -0,0 +1,178 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Enemies/Enemy.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyHead.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyBody.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyWing.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemy.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyLeg1.png" type="Texture" id=6]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyLeg2.png" type="Texture" id=7]
|
||||
[ext_resource path="res://Assets/Enemies/BossEnemyLeg3.png" type="Texture" id=8]
|
||||
|
||||
[node name="BossEnemy" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="OnionLayer" type="Sprite" parent="." index="0"]
|
||||
modulate = Color( 1, 1, 1, 0.113725 )
|
||||
position = Vector2( 0, -11 )
|
||||
texture = ExtResource( 5 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Sprite" parent="." index="1"]
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="LeftWing" type="Sprite" parent="Sprite" index="0"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( -8, -19 )
|
||||
texture = ExtResource( 4 )
|
||||
offset = Vector2( -21, -5 )
|
||||
|
||||
[node name="RightWing" type="Sprite" parent="Sprite" index="1"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 50, -19 )
|
||||
rotation = 3.14159
|
||||
scale = Vector2( 1, -1 )
|
||||
texture = ExtResource( 4 )
|
||||
offset = Vector2( 21, -5 )
|
||||
|
||||
[node name="LeftUpperLeg" type="Sprite" parent="Sprite" index="2"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( -12, -12 )
|
||||
texture = ExtResource( 6 )
|
||||
offset = Vector2( -4, 1 )
|
||||
__meta__ = {
|
||||
"_edit_ik_": true
|
||||
}
|
||||
|
||||
[node name="MiddleSegment" type="Sprite" parent="Sprite/LeftUpperLeg" index="0"]
|
||||
position = Vector2( -9, 3 )
|
||||
texture = ExtResource( 7 )
|
||||
offset = Vector2( -2, 4 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndSegment" type="Sprite" parent="Sprite/LeftUpperLeg/MiddleSegment" index="0"]
|
||||
position = Vector2( -6, 10 )
|
||||
texture = ExtResource( 8 )
|
||||
offset = Vector2( 1, 2 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndPoint" type="Position2D" parent="Sprite/LeftUpperLeg/MiddleSegment/EndSegment" index="0"]
|
||||
position = Vector2( 3, 5 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="LeftLowerLeg" type="Sprite" parent="Sprite" index="3"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( -9, 4.76837e-07 )
|
||||
rotation = -0.261799
|
||||
texture = ExtResource( 6 )
|
||||
offset = Vector2( -4, 1 )
|
||||
__meta__ = {
|
||||
"_edit_ik_": true
|
||||
}
|
||||
|
||||
[node name="MiddleSegment" type="Sprite" parent="Sprite/LeftLowerLeg" index="0"]
|
||||
position = Vector2( -12, 3 )
|
||||
rotation = -0.436332
|
||||
texture = ExtResource( 7 )
|
||||
offset = Vector2( -2, 4 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndSegment" type="Sprite" parent="Sprite/LeftLowerLeg/MiddleSegment" index="0"]
|
||||
position = Vector2( -6, 10 )
|
||||
rotation = -0.349066
|
||||
texture = ExtResource( 8 )
|
||||
offset = Vector2( 1, 2 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndPoint" type="Position2D" parent="Sprite/LeftLowerLeg/MiddleSegment/EndSegment" index="0"]
|
||||
position = Vector2( 3, 5 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="RightUpeerLeg" type="Sprite" parent="Sprite" index="4"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 12, -12 )
|
||||
texture = ExtResource( 6 )
|
||||
offset = Vector2( 5, 1 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_ik_": true
|
||||
}
|
||||
|
||||
[node name="MiddleSegment" type="Sprite" parent="Sprite/RightUpeerLeg" index="0"]
|
||||
position = Vector2( 12, 3 )
|
||||
texture = ExtResource( 7 )
|
||||
offset = Vector2( 3, 4 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndSegment" type="Sprite" parent="Sprite/RightUpeerLeg/MiddleSegment" index="0"]
|
||||
position = Vector2( 6, 10 )
|
||||
rotation = 0.261799
|
||||
texture = ExtResource( 8 )
|
||||
offset = Vector2( -1, 2 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndPoint" type="Position2D" parent="Sprite/RightUpeerLeg/MiddleSegment/EndSegment" index="0"]
|
||||
position = Vector2( -3, 5 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="RightLowerLeg" type="Sprite" parent="Sprite" index="5"]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 9, 0 )
|
||||
rotation = 0.261799
|
||||
texture = ExtResource( 6 )
|
||||
offset = Vector2( 5, 1 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_ik_": true
|
||||
}
|
||||
|
||||
[node name="MiddleSegment" type="Sprite" parent="Sprite/RightLowerLeg" index="0"]
|
||||
position = Vector2( 12.1781, 2.94854 )
|
||||
rotation = 0.436332
|
||||
texture = ExtResource( 7 )
|
||||
offset = Vector2( 3, 4 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndSegment" type="Sprite" parent="Sprite/RightLowerLeg/MiddleSegment" index="0"]
|
||||
position = Vector2( 6, 10 )
|
||||
rotation = 0.261799
|
||||
texture = ExtResource( 8 )
|
||||
offset = Vector2( -1, 2 )
|
||||
flip_h = true
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="EndPoint" type="Position2D" parent="Sprite/RightLowerLeg/MiddleSegment/EndSegment" index="0"]
|
||||
position = Vector2( -3, 5 )
|
||||
__meta__ = {
|
||||
"_edit_bone_": true
|
||||
}
|
||||
|
||||
[node name="Head" type="Sprite" parent="Sprite" index="6"]
|
||||
position = Vector2( 0, -7 )
|
||||
texture = ExtResource( 2 )
|
|
@ -1,6 +1,33 @@
|
|||
extends Node
|
||||
|
||||
var MainInstances = ResourceLoader.MainInstances
|
||||
|
||||
onready var currentLevel = $Level_00
|
||||
|
||||
func _ready():
|
||||
VisualServer.set_default_clear_color(Color.black)
|
||||
MainInstances.Player.connect("hit_door", self, "_on_Player_hit_door")
|
||||
|
||||
func _on_Player_hit_door(door):
|
||||
# Executes the function after the current tick of the game is done, to make
|
||||
# sure everything is ready to be switched since we're doing calculations
|
||||
# based on the current level
|
||||
call_deferred("change_levels", door)
|
||||
|
||||
func change_levels(door):
|
||||
var offset = currentLevel.position
|
||||
currentLevel.queue_free()
|
||||
var NewLevel = load(door.new_level_path)
|
||||
var newLevel = NewLevel.instance()
|
||||
add_child(newLevel)
|
||||
var newDoor = get_door_with_connection(door)
|
||||
var exit_position = newDoor.position - offset
|
||||
newLevel.position = door.position - exit_position
|
||||
|
||||
func get_door_with_connection(outgoingDoor):
|
||||
var doors = get_tree().get_nodes_in_group("Door")
|
||||
for door in doors:
|
||||
if door.connection == outgoingDoor.connection and door != outgoingDoor:
|
||||
return door
|
||||
|
||||
return null
|
||||
|
|
Loading…
Reference in New Issue