diff --git a/project.godot b/project.godot index c21e553..844223e 100644 --- a/project.godot +++ b/project.godot @@ -90,7 +90,6 @@ config/name="Platformer" run/main_scene="res://src/Intro/Intro.tscn" boot_splash/image="res://assets/SplashScreen/BLANK.png" boot_splash/use_filter=false -boot_splash/bg_color=Color( 0.141176, 0.141176, 0.141176, 1 ) config/icon="res://icon.png" [autoload] @@ -202,5 +201,4 @@ attack={ [rendering] quality/2d/use_pixel_snap=true -environment/default_clear_color=Color( 0, 0, 0, 1 ) environment/default_environment="res://default_env.tres" diff --git a/src/Actors/Player.gd b/src/Actors/Player.gd index 630ab82..4d112ee 100644 --- a/src/Actors/Player.gd +++ b/src/Actors/Player.gd @@ -69,7 +69,7 @@ func _physics_process(delta: float) -> void: func _input_check() -> void: - if GameState.get_state() == GameState.States.GAME or GameState.get_state() == GameState.States.NEW_GAME: + if self._alive and (GameState.get_state() == GameState.States.GAME or GameState.get_state() == GameState.States.NEW_GAME): _is_jump_canceled = Input.is_action_just_released("jump") and !_is_wall_jumping and _velocity.y < 0.0; _get_direction() _check_dash() diff --git a/src/GameWorld/GameWorld.gd b/src/GameWorld/GameWorld.gd index cdf7bf0..3fdc7e8 100644 --- a/src/GameWorld/GameWorld.gd +++ b/src/GameWorld/GameWorld.gd @@ -40,6 +40,7 @@ func _ready() -> void: func _change_level( newLevel:Vector2 = Vector2.ZERO, oldLevel:Vector2 = Vector2(0,-1)): + print("Changing level [%s] -> [%s]" % [oldLevel, newLevel]) if oldLevel.y != -1: GameState.set_state(GameState.States.TRANSITIONING) Stage.fade_out(.5) @@ -49,11 +50,11 @@ func _change_level( newLevel:Vector2 = Vector2.ZERO, oldLevel:Vector2 = Vector2( $Level.remove_child(_levels[oldLevel.x][oldLevel.y]) if !_levels[newLevel.x][newLevel.y].is_class("Node2D"): _levels[newLevel.x][newLevel.y] = _levels[newLevel.x][newLevel.y].instance() - _levels[newLevel.x][newLevel.y].level_coords = newLevel - _levels[newLevel.x][newLevel.y].set_player(_player, _get_player_entering(oldLevel, newLevel)) + _levels[newLevel.x][newLevel.y].init_level_config(oldLevel, newLevel) + _levels[newLevel.x][newLevel.y].set_player(_player) _levels[newLevel.x][newLevel.y].connect("level_exited", self, "_on_level_exited") $Level.add_child(_levels[newLevel.x][newLevel.y]) - _levels[newLevel.x][newLevel.y]._set_active(true) + _levels[newLevel.x][newLevel.y]._set_active(true, _get_player_entering(oldLevel, newLevel)) Stage.fade_in() yield(Stage, "fade_finished") GameState.set_state(_levels[newLevel.x][newLevel.y].game_state) @@ -73,24 +74,8 @@ func _on_player_died(): yield(Stage, "fade_finished") GameState.set_state(prev_state) -func _on_level_exited(is_exit:bool, to_coords:Vector2, position:Vector2): - print("current level: %s, is_exit: %s to_coords: %s position %s" % [_current_zone_level, is_exit, to_coords, position]) - var next = Vector2.ZERO - if to_coords.x == -1: # The zone is to a specific plase - next = to_coords - else: - next = Vector2( - _current_zone_level.x, - _current_zone_level.y + 1 if is_exit else _current_zone_level.y - 1 - ) - if next.y < 0: - next.x -= 1 - next.y = len(_levels[next.x]) - 1 - if next.y > len(_levels[next.x]) - 1: - next.x += 1 - next.y = 0 - - - _change_level(next, _current_zone_level) +func _on_level_exited(is_exit:bool, to_coords:Vector2): + print("current level: %s, is_exit: %s to_coords: %s" % [_current_zone_level, is_exit, to_coords]) + _change_level(to_coords, _current_zone_level) yield(self, "level_ready") diff --git a/src/GameWorld/Levels/FirstLevels/TMP.tscn b/src/GameWorld/Levels/FirstLevels/TMP.tscn index 1139653..4e197dc 100644 --- a/src/GameWorld/Levels/FirstLevels/TMP.tscn +++ b/src/GameWorld/Levels/FirstLevels/TMP.tscn @@ -10,8 +10,6 @@ script = ExtResource( 1 ) level_entry_point = Vector2( 16, 240 ) level_exit_point = Vector2( 675, 240 ) -exit_area_2d_path = NodePath("ExitLevelArea") -enter_area_2d_path = NodePath("ExitLevelNextArea") camer_limits = { "bottom": 240, "left": 0, @@ -26,9 +24,6 @@ tile_data = PoolIntArray( -131072, 0, 0, -131071, 0, 131076, -131070, 0, 131076, position = Vector2( -15, 240 ) is_exit = false -[node name="ExitLevelNextArea" parent="." instance=ExtResource( 5 )] -position = Vector2( 680, 240 ) - [node name="SpawnPoint" parent="." instance=ExtResource( 4 )] position = Vector2( 239, 240 ) node = ExtResource( 3 ) diff --git a/src/GameWorld/Levels/FirstLevels/TMP2.gd b/src/GameWorld/Levels/FirstLevels/TMP2.gd index 9796b06..d4a9b74 100644 --- a/src/GameWorld/Levels/FirstLevels/TMP2.gd +++ b/src/GameWorld/Levels/FirstLevels/TMP2.gd @@ -5,17 +5,3 @@ func _ready() -> void: print("TMP ready") -func _on_ExitLevelArea_body_entered(body: Node) -> void: - if body == _player and is_active_level: - print("_on_ExitLevelArea_body_entered") - self.is_active_level = false; - emit_signal("level_exited", false) - pass # Replace with function body. - - -func _on_ExitLevelAreaNext_body_entered(body: Node) -> void: - if body == _player and is_active_level: - print("_on_ExitLevelAreaNext_body_entered") - self.is_active_level = false; - emit_signal("level_exited", true) - pass # Replace with function body. diff --git a/src/GameWorld/Levels/FirstLevels/TMP2.tscn b/src/GameWorld/Levels/FirstLevels/TMP2.tscn index 574ef58..96d712d 100644 --- a/src/GameWorld/Levels/FirstLevels/TMP2.tscn +++ b/src/GameWorld/Levels/FirstLevels/TMP2.tscn @@ -4,9 +4,7 @@ [ext_resource path="res://assets/Tiles/SolidsTileMap.tscn" type="PackedScene" id=2] [ext_resource path="res://src/Actors/Goblin.tscn" type="PackedScene" id=3] [ext_resource path="res://src/Scripts/SpawnPoint.tscn" type="PackedScene" id=4] - -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 10, 18 ) +[ext_resource path="res://src/Scripts/WarpZone.tscn" type="PackedScene" id=5] [node name="TMP2" type="Node2D"] script = ExtResource( 1 ) @@ -22,24 +20,10 @@ camer_limits = { [node name="SolidsTileMap" parent="." instance=ExtResource( 2 )] tile_data = PoolIntArray( -131072, 0, 0, -131071, 0, 131076, -131070, 0, 131076, -131069, 0, 131076, -131068, 0, 131076, -131067, 0, 1, -131066, 0, 1, -131065, 0, 1, -131064, 0, 1, -131063, 0, 1, -131062, 0, 1, -131061, 0, 131076, -131060, 0, 1, -131059, 0, 131076, -131058, 0, 1, -131057, 0, 131076, -131056, 0, 131076, -131055, 0, 1, -131054, 0, 1, -131053, 0, 131076, -131052, 0, 1, -131051, 0, 1, -131050, 0, 1, -131049, 0, 131076, -131048, 0, 131076, -131047, 0, 1, -131046, 0, 131076, -131045, 0, 1, -131044, 0, 131076, -131043, 0, 1, -131042, 0, 2, -65536, 0, 65536, -65535, 0, 3, -65534, 0, 131073, -65533, 0, 4, -65532, 0, 4, -65531, 0, 131073, -65530, 0, 131073, -65529, 0, 4, -65528, 0, 4, -65527, 0, 131073, -65526, 0, 4, -65525, 0, 4, -65524, 0, 4, -65523, 0, 131073, -65522, 0, 4, -65521, 0, 131073, -65520, 0, 4, -65519, 0, 4, -65518, 0, 131073, -65517, 0, 131073, -65516, 0, 131073, -65515, 0, 4, -65514, 0, 4, -65513, 0, 131073, -65512, 0, 4, -65511, 0, 4, -65510, 0, 131073, -65509, 0, 131073, -65508, 0, 131073, -65507, 0, 5, -65506, 0, 65539, 65535, 0, 0, 0, 0, 131077, 1, 0, 65538, 29, 0, 65536, 30, 0, 65539, 131071, 0, 65536, 65536, 0, 65537, 65537, 0, 65539, 65550, 0, 1, 65551, 0, 1, 65552, 0, 1, 65565, 0, 65541, 65566, 0, 65538, 196607, 0, 65536, 131072, 0, 65537, 131073, 0, 65538, 131084, 0, 1, 131085, 0, 1, 131088, 0, 1, 131089, 0, 1, 131101, 0, 65541, 131102, 0, 65539, 262143, 0, 65536, 196608, 0, 65537, 196609, 0, 65538, 196619, 0, 1, 196620, 0, 1, 196625, 0, 1, 196637, 0, 65536, 196638, 0, 131075, 196639, 0, 1, 196640, 0, 131076, 196641, 0, 1, 196642, 0, 1, 196643, 0, 1, 196644, 0, 1, 196645, 0, 1, 196646, 0, 131076, 196647, 0, 1, 196648, 0, 131076, 196649, 0, 1, 196650, 0, 2, 327679, 0, 65541, 262144, 0, 65537, 262145, 0, 65538, 262154, 0, 1, 262155, 0, 1, 262161, 0, 1, 262173, 0, 65536, 262174, 0, 3, 262175, 0, 4, 262176, 0, 131073, 262177, 0, 4, 262178, 0, 131073, 262179, 0, 5, 262180, 0, 65537, 262181, 0, 65537, 262182, 0, 65537, 262183, 0, 65537, 262184, 0, 65537, 262185, 0, 65537, 262186, 0, 65538, 393215, 0, 65541, 327680, 0, 65537, 327681, 0, 65539, 327696, 0, 1, 327697, 0, 1, 327709, 0, 65536, 327710, 0, 65538, 327715, 0, 65541, 327716, 0, 65537, 327717, 0, 65537, 327718, 0, 65537, 327719, 0, 65537, 327720, 0, 65537, 327721, 0, 65537, 327722, 0, 65539, 458751, 0, 65541, 393216, 0, 65537, 393217, 0, 65538, 393232, 0, 1, 393245, 0, 65536, 393246, 0, 65538, 393251, 0, 65541, 393252, 0, 65537, 393253, 0, 65537, 393254, 0, 65537, 393255, 0, 65537, 393256, 0, 65537, 393257, 0, 65537, 393258, 0, 65538, 524287, 0, 65541, 458752, 0, 65537, 458753, 0, 65538, 458767, 0, 1, 458768, 0, 1, 458781, 0, 65541, 458782, 0, 65538, 458787, 0, 65541, 458788, 0, 65537, 458789, 0, 65537, 458790, 0, 65537, 458791, 0, 65537, 458792, 0, 65537, 458793, 0, 65537, 458794, 0, 65539, 589823, 0, 65536, 524288, 0, 65537, 524289, 0, 65538, 524301, 0, 1, 524302, 0, 1, 524303, 0, 1, 524317, 0, 65536, 524318, 0, 65538, 524323, 0, 65541, 524324, 0, 65537, 524325, 0, 65537, 524326, 0, 65537, 524327, 0, 65537, 524328, 0, 65537, 524329, 0, 65537, 524330, 0, 65538, 655359, 0, 65541, 589824, 0, 65537, 589825, 0, 65539, 589835, 0, 1, 589836, 0, 1, 589837, 0, 1, 589853, 0, 65541, 589854, 0, 65539, 589859, 0, 65541, 589860, 0, 65537, 589861, 0, 65537, 589862, 0, 65537, 589863, 0, 65537, 589864, 0, 65537, 589865, 0, 65537, 589866, 0, 65538, 720895, 0, 65541, 655360, 0, 65537, 655361, 0, 65539, 655369, 0, 0, 655370, 0, 131076, 655371, 0, 2, 655389, 0, 65541, 655390, 0, 65538, 655395, 0, 131072, 655396, 0, 131073, 655397, 0, 131073, 655398, 0, 131073, 655399, 0, 131073, 655400, 0, 131073, 655401, 0, 5, 655402, 0, 65538, 786431, 0, 65541, 720896, 0, 65537, 720897, 0, 65539, 720905, 0, 131072, 720906, 0, 131073, 720907, 0, 131074, 720908, 0, 1, 720909, 0, 1, 720910, 0, 1, 720911, 0, 1, 720912, 0, 1, 720913, 0, 1, 720914, 0, 1, 720925, 0, 65536, 720926, 0, 65538, 720937, 0, 65541, 720938, 0, 65539, 851967, 0, 131072, 786432, 0, 131073, 786433, 0, 131074, 786461, 0, 131072, 786462, 0, 131074, 786473, 0, 131072, 786474, 0, 131074, 852004, 0, 0, 852005, 0, 2, 917540, 0, 65541, 917541, 0, 65538, 1048573, 0, 0, 1048574, 0, 1, 1048575, 0, 131076, 983040, 0, 131076, 983041, 0, 1, 983042, 0, 131076, 983043, 0, 131076, 983044, 0, 1, 983045, 0, 131076, 983046, 0, 131076, 983047, 0, 1, 983048, 0, 131076, 983049, 0, 1, 983050, 0, 131076, 983051, 0, 1, 983052, 0, 131076, 983053, 0, 1, 983054, 0, 1, 983055, 0, 131076, 983056, 0, 131076, 983057, 0, 1, 983058, 0, 1, 983059, 0, 131076, 983060, 0, 131076, 983061, 0, 131076, 983062, 0, 1, 983063, 0, 1, 983064, 0, 1, 983065, 0, 131076, 983066, 0, 1, 983067, 0, 131076, 983068, 0, 131076, 983069, 0, 131076, 983070, 0, 131076, 983071, 0, 1, 983072, 0, 1, 983073, 0, 131076, 983074, 0, 131076, 983075, 0, 131076, 983076, 0, 131077, 983077, 0, 131075, 983078, 0, 131076, 983079, 0, 1, 983080, 0, 131076, 983081, 0, 1, 983082, 0, 2, 1114109, 0, 131072, 1114110, 0, 4, 1114111, 0, 131073, 1048576, 0, 4, 1048577, 0, 4, 1048578, 0, 4, 1048579, 0, 4, 1048580, 0, 131073, 1048581, 0, 131073, 1048582, 0, 131073, 1048583, 0, 131073, 1048584, 0, 131073, 1048585, 0, 131073, 1048586, 0, 131073, 1048587, 0, 131073, 1048588, 0, 4, 1048589, 0, 131073, 1048590, 0, 131073, 1048591, 0, 131073, 1048592, 0, 4, 1048593, 0, 131073, 1048594, 0, 131073, 1048595, 0, 131073, 1048596, 0, 131073, 1048597, 0, 4, 1048598, 0, 131073, 1048599, 0, 4, 1048600, 0, 4, 1048601, 0, 4, 1048602, 0, 131073, 1048603, 0, 4, 1048604, 0, 4, 1048605, 0, 4, 1048606, 0, 4, 1048607, 0, 131073, 1048608, 0, 4, 1048609, 0, 4, 1048610, 0, 131073, 1048611, 0, 4, 1048612, 0, 131073, 1048613, 0, 131073, 1048614, 0, 131073, 1048615, 0, 131073, 1048616, 0, 131073, 1048617, 0, 4, 1048618, 0, 131074 ) -[node name="ExitLevelArea" type="Area2D" parent="."] -position = Vector2( -28, 218 ) -collision_layer = 0 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="ExitLevelArea"] -position = Vector2( 0, 6 ) -shape = SubResource( 1 ) - -[node name="ExitLevelAreaNext" type="Area2D" parent="."] -position = Vector2( 694, 218 ) -collision_layer = 0 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="ExitLevelAreaNext"] -position = Vector2( 0, 6 ) -shape = SubResource( 1 ) - [node name="SpawnPoint" parent="." instance=ExtResource( 4 )] position = Vector2( 239, 240 ) node = ExtResource( 3 ) -[connection signal="body_entered" from="ExitLevelArea" to="." method="_on_ExitLevelArea_body_entered"] -[connection signal="body_entered" from="ExitLevelAreaNext" to="." method="_on_ExitLevelAreaNext_body_entered"] + +[node name="WarpZone" parent="." instance=ExtResource( 5 )] +position = Vector2( -16, 240 ) +is_exit = false diff --git a/src/GameWorld/Levels/Level.gd b/src/GameWorld/Levels/Level.gd index 50cc6bb..db67fe5 100644 --- a/src/GameWorld/Levels/Level.gd +++ b/src/GameWorld/Levels/Level.gd @@ -16,6 +16,9 @@ export var level_exit_point := Vector2.ZERO var level_coords :=Vector2.ZERO export(Vector2) var prev_level = null +export(Vector2) var next_level = null + +var _first_time_init = true export var camer_limits := { @@ -30,22 +33,31 @@ func _ready(): -func _set_active(activated:bool, prev_level_:Vector2): - is_active_level = activated +func init_level_config(prev_level_:Vector2, level_coords_:Vector2): + print("Initializing [%s]: prev = %s | current = %s" % [self.name, prev_level_, level_coords_]) self.prev_level = prev_level_ + self.level_coords = level_coords_ + self.next_level = Vector2(level_coords.x, level_coords.y + 1) + + +func _set_active(activated:bool, is_entering:bool): + print("Setting active [%s]: active = %s " % [self.name, activated]) + is_active_level = activated if activated: - for warp in _get_all_warps(): - warp.connect("player_entered", self, "_on_WarpZone_player_entered") + if _first_time_init: _set_wrap_zones() + _set_player_position(is_entering) emit_signal("level_ready") -func set_player(player:Player, is_entering:bool, spesific_position=null): +func set_player(player:Player): + print("Setting player [%s]" % [self.name]) _player = player _camera = _player.get_camera() _set_camera_limits() - _set_player_position(is_entering, spesific_position) - add_child(player) + add_child(_player) + func remove_player(): + print("Removing player [%s]" % [self.name]) remove_child(_player) _camera = null _player = null @@ -56,19 +68,32 @@ func _set_camera_limits(): _camera.limit_bottom = camer_limits.bottom _camera.limit_left = camer_limits.left -func _set_player_position(is_entering:bool, spesific_position=null): - if spesific_position != null: - _player.position = spesific_position - else: - _player.position = level_entry_point if is_entering else level_exit_point - _player.face_player(is_entering) - _player.respawn_position = _player.position +func _set_player_position(is_entering:bool): + var warps = _get_all_warps() + for warp in warps: + if warp.to_level_coord == prev_level: + _player.position = warp.get_checkpoint_position() + _player.face_player(is_entering) + _player.respawn_position = _player.position + print("Found point warp.position.x = %s player spawn.x = %s" % [warp.position.x, _player.position.x]) +func _set_wrap_zones(): + _first_time_init = false + var warps = _get_all_warps() + for warp in warps: + warp.connect("player_entered", self, "_on_WarpZone_player_entered") + var has_custom_level = warp.to_level_coord != warp.NON_SPECIFIED_LEVEL + if not has_custom_level: + if not warp.is_exit: warp.to_level_coord = self.prev_level + else: warp.to_level_coord = self.next_level + print("Warp has no costum level set to: %s" % [warp.to_level_coord]) + else: + print("Warp a costum level: %s" % [warp.to_level_coord]) -func _on_WarpZone_player_entered(is_exit, to_coords, position) -> void: - print("_on_WarpZone_player_entered is_exit=%s to_coord=%s position=%s" % [is_exit, to_coords, position]) +func _on_WarpZone_player_entered(is_exit, to_level_coord) -> void: + print("_on_WarpZone_player_entered is_exit=%s to_level=%s" % [is_exit, to_level_coord]) self.is_active_level = false; - emit_signal("level_exited", is_exit, to_coords) + emit_signal("level_exited", is_exit, to_level_coord) pass # Replace with function body. @@ -77,4 +102,5 @@ func _get_all_warps(): for node in get_children(): if node.is_in_group("WarpZones"): warps.push_back(node) - return warps \ No newline at end of file + print("_get_all_warps [%s]: #%d of warps found" % [self.name, len(warps)]) + return warps diff --git a/src/GameWorld/Levels/PreGame.gd b/src/GameWorld/Levels/PreGame.gd index 42cad79..31ed03c 100644 --- a/src/GameWorld/Levels/PreGame.gd +++ b/src/GameWorld/Levels/PreGame.gd @@ -39,8 +39,3 @@ func _process(delta: float) -> void: $AmbiantLighting.change_light("NIGHT") else: $AmbiantLighting.change_light("DAY") - - if _player.position.x > 700: - print("exited") - is_active_level = false - emit_signal("level_exited", true) diff --git a/src/GameWorld/Levels/PreGame.tscn b/src/GameWorld/Levels/PreGame.tscn index 965bcd5..6f5f5b8 100644 --- a/src/GameWorld/Levels/PreGame.tscn +++ b/src/GameWorld/Levels/PreGame.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=2] +[gd_scene load_steps=24 format=2] [ext_resource path="res://src/GameWorld/Levels/PreGame.gd" type="Script" id=1] [ext_resource path="res://assets/Tiles/background_0.png" type="Texture" id=2] @@ -14,6 +14,7 @@ [ext_resource path="res://assets/Tiles/SolidsTileMap.tscn" type="PackedScene" id=12] [ext_resource path="res://src/Actors/WiseOldDude/WiseOldDude.tscn" type="PackedScene" id=13] [ext_resource path="res://src/GameWorld/AmbiantLighting.tscn" type="PackedScene" id=14] +[ext_resource path="res://src/Scripts/WarpZone.tscn" type="PackedScene" id=15] [sub_resource type="TileSet" id=1] 0/name = "tileset.png 0" @@ -260,4 +261,8 @@ position = Vector2( 15, -12 ) position = Vector2( 535, 42 ) [node name="AmbiantLighting" parent="." instance=ExtResource( 14 )] + +[node name="WarpZone" parent="." instance=ExtResource( 15 )] +position = Vector2( 723, 225 ) +to_level_coord = Vector2( 0, 1 ) [connection signal="body_entered" from="CutsceneAreas/OldDudeIntroArea" to="." method="_on_OldDudeIntroArea_body_entered"] diff --git a/src/GameWorld/Levels/WorldHub.gd b/src/GameWorld/Levels/WorldHub.gd index e7500aa..f9ec97b 100644 --- a/src/GameWorld/Levels/WorldHub.gd +++ b/src/GameWorld/Levels/WorldHub.gd @@ -8,5 +8,3 @@ func _enter_tree() -> void: AudioManager.play_music(AudioManager.Music.PreGame) -func _on_WarpZone_player_entered(is_exit, zone): - emit_signal("level_exited", is_exit, zone) diff --git a/src/GameWorld/Levels/WorldHub.tscn b/src/GameWorld/Levels/WorldHub.tscn index 40fecf5..352f665 100644 --- a/src/GameWorld/Levels/WorldHub.tscn +++ b/src/GameWorld/Levels/WorldHub.tscn @@ -12,7 +12,6 @@ [node name="WorldHub" type="Node2D"] script = ExtResource( 1 ) level_entry_point = Vector2( 20, 220 ) -enter_area_2d_path = NodePath("EnterLevelArea") camer_limits = { "bottom": 260, "left": 0, @@ -60,19 +59,19 @@ texture = ExtResource( 7 ) [node name="TrapTiles" parent="World" instance=ExtResource( 5 )] [node name="SolidsTileMap" parent="World" instance=ExtResource( 6 )] -tile_data = PoolIntArray( -327680, 0, 0, -327679, 0, 131076, -327678, 0, 1, -327677, 0, 131076, -327676, 0, 131076, -327675, 0, 131076, -327674, 0, 131076, -327673, 0, 131076, -327672, 0, 1, -327671, 0, 1, -327670, 0, 131076, -327669, 0, 1, -327668, 0, 131076, -327667, 0, 1, -327666, 0, 1, -327665, 0, 131076, -327664, 0, 131076, -327663, 0, 131076, -327662, 0, 1, -327661, 0, 131076, -327660, 0, 1, -327659, 0, 131076, -327658, 0, 1, -327657, 0, 1, -327656, 0, 1, -327655, 0, 1, -327654, 0, 1, -327653, 0, 131076, -327652, 0, 1, -327651, 0, 1, -327650, 0, 2, -262144, 0, 65536, -262143, 0, 3, -262142, 0, 4, -262141, 0, 4, -262140, 0, 131073, -262139, 0, 131073, -262138, 0, 131073, -262137, 0, 4, -262136, 0, 131073, -262135, 0, 4, -262134, 0, 4, -262133, 0, 4, -262132, 0, 131073, -262131, 0, 4, -262130, 0, 131073, -262129, 0, 131073, -262128, 0, 131073, -262127, 0, 131073, -262126, 0, 4, -262125, 0, 131073, -262124, 0, 4, -262123, 0, 131073, -262122, 0, 131073, -262121, 0, 4, -262120, 0, 131073, -262119, 0, 4, -262118, 0, 4, -262117, 0, 5, -262116, 0, 65537, -262115, 0, 3, -262114, 0, 131074, -196608, 0, 65541, -196607, 0, 65539, -196581, 0, 65541, -196580, 0, 65537, -196579, 0, 65538, -131072, 0, 65536, -131071, 0, 65538, -131045, 0, 65536, -131044, 0, 65537, -131043, 0, 65538, -65536, 0, 65541, -65535, 0, 65538, -65509, 0, 65536, -65508, 0, 65537, -65507, 0, 65538, 0, 0, 65536, 1, 0, 65538, 27, 0, 65536, 28, 0, 65537, 29, 0, 65539, 65536, 0, 65541, 65537, 0, 65539, 65563, 0, 65541, 65564, 0, 65537, 65565, 0, 65539, 131072, 0, 65536, 131073, 0, 65539, 131099, 0, 65536, 131100, 0, 65537, 131101, 0, 65539, 196608, 0, 65536, 196609, 0, 65539, 196614, 0, 0, 196615, 0, 131076, 196616, 0, 2, 196635, 0, 65536, 196636, 0, 65537, 196637, 0, 65539, 262144, 0, 65536, 262145, 0, 65539, 262150, 0, 65541, 262151, 0, 65537, 262152, 0, 65539, 262171, 0, 65541, 262172, 0, 65537, 262173, 0, 65538, 327680, 0, 65541, 327681, 0, 65539, 327686, 0, 65536, 327687, 0, 65537, 327688, 0, 65538, 327707, 0, 65536, 327708, 0, 65537, 327709, 0, 65539, 393216, 0, 65536, 393217, 0, 65538, 393222, 0, 65541, 393223, 0, 65537, 393224, 0, 65539, 393229, 0, 0, 393230, 0, 1, 393231, 0, 1, 393232, 0, 2, 393237, 0, 0, 393238, 0, 1, 393239, 0, 2, 393243, 0, 65536, 393244, 0, 65537, 393245, 0, 65538, 393254, 0, 0, 393255, 0, 131076, 393256, 0, 1, 393257, 0, 131076, 393258, 0, 1, 393259, 0, 131076, 393260, 0, 1, 393261, 0, 1, 393262, 0, 131076, 393263, 0, 131076, 393264, 0, 131076, 393265, 0, 2, 458752, 0, 65536, 458753, 0, 65538, 458758, 0, 131072, 458759, 0, 131073, 458760, 0, 131074, 458765, 0, 65536, 458766, 0, 65537, 458767, 0, 65537, 458768, 0, 65538, 458773, 0, 65541, 458774, 0, 65537, 458775, 0, 65538, 458779, 0, 65536, 458780, 0, 65537, 458781, 0, 65539, 458790, 0, 131072, 458791, 0, 4, 458792, 0, 4, 458793, 0, 5, 458794, 0, 65537, 458795, 0, 65537, 458796, 0, 65537, 458797, 0, 65537, 458798, 0, 65537, 458799, 0, 65537, 458800, 0, 65537, 458801, 0, 65539, 524288, 0, 65541, 524289, 0, 65538, 524301, 0, 131072, 524302, 0, 131073, 524303, 0, 4, 524304, 0, 131074, 524309, 0, 131072, 524310, 0, 4, 524311, 0, 131074, 524315, 0, 65536, 524316, 0, 65537, 524317, 0, 65538, 524329, 0, 65541, 524330, 0, 65537, 524331, 0, 65537, 524332, 0, 65537, 524333, 0, 65537, 524334, 0, 65537, 524335, 0, 65537, 524336, 0, 65537, 524337, 0, 65539, 589824, 0, 65541, 589825, 0, 65539, 589851, 0, 65541, 589852, 0, 65537, 589853, 0, 131075, 589854, 0, 1, 589855, 0, 131076, 589856, 0, 131076, 589857, 0, 131076, 589858, 0, 1, 589859, 0, 1, 589860, 0, 2, 589865, 0, 65536, 589866, 0, 65537, 589867, 0, 65537, 589868, 0, 65537, 589869, 0, 65537, 589870, 0, 65537, 589871, 0, 65537, 589872, 0, 65537, 589873, 0, 65539, 655360, 0, 65536, 655361, 0, 65539, 655377, 0, 0, 655378, 0, 131076, 655379, 0, 2, 655387, 0, 65541, 655388, 0, 65537, 655389, 0, 3, 655390, 0, 4, 655391, 0, 4, 655392, 0, 4, 655393, 0, 4, 655394, 0, 4, 655395, 0, 4, 655396, 0, 131074, 655401, 0, 65541, 655402, 0, 65537, 655403, 0, 65537, 655404, 0, 65537, 655405, 0, 65537, 655406, 0, 65537, 655407, 0, 65537, 655408, 0, 65537, 655409, 0, 65538, 720896, 0, 131072, 720897, 0, 131074, 720913, 0, 131072, 720914, 0, 4, 720915, 0, 131074, 720923, 0, 131072, 720924, 0, 4, 720925, 0, 131074, 720937, 0, 65536, 720938, 0, 65537, 720939, 0, 65537, 720940, 0, 65537, 720941, 0, 65537, 720942, 0, 65537, 720943, 0, 65537, 720944, 0, 65537, 720945, 0, 65539, 786470, 0, 0, 786471, 0, 1, 786472, 0, 1, 786473, 0, 131077, 786474, 0, 65537, 786475, 0, 65537, 786476, 0, 65537, 786477, 0, 65537, 786478, 0, 65537, 786479, 0, 65537, 786480, 0, 65537, 786481, 0, 65539, 852006, 0, 65536, 852007, 0, 65537, 852008, 0, 65537, 852009, 0, 65537, 852010, 0, 65537, 852011, 0, 65537, 852012, 0, 65537, 852013, 0, 65537, 852014, 0, 65537, 852015, 0, 65537, 852016, 0, 65537, 852017, 0, 65538, 917504, 0, 0, 917505, 0, 1, 917506, 0, 131076, 917507, 0, 131076, 917508, 0, 1, 917509, 0, 1, 917510, 0, 1, 917511, 0, 131076, 917512, 0, 131076, 917513, 0, 131076, 917514, 0, 131076, 917515, 0, 1, 917516, 0, 131076, 917517, 0, 131076, 917518, 0, 131076, 917519, 0, 131076, 917520, 0, 1, 917521, 0, 1, 917522, 0, 1, 917523, 0, 131076, 917524, 0, 131076, 917525, 0, 131076, 917526, 0, 131076, 917527, 0, 1, 917528, 0, 131076, 917529, 0, 131076, 917530, 0, 1, 917531, 0, 1, 917532, 0, 131076, 917533, 0, 131076, 917534, 0, 1, 917535, 0, 1, 917536, 0, 1, 917537, 0, 1, 917538, 0, 1, 917539, 0, 131076, 917540, 0, 131076, 917541, 0, 131076, 917542, 0, 131077, 917543, 0, 65537, 917544, 0, 65537, 917545, 0, 65537, 917546, 0, 65537, 917547, 0, 65537, 917548, 0, 65537, 917549, 0, 65537, 917550, 0, 65537, 917551, 0, 65537, 917552, 0, 65537, 917553, 0, 65539, 983040, 0, 65541, 983041, 0, 65537, 983042, 0, 65537, 983043, 0, 65537, 983044, 0, 65537, 983045, 0, 65537, 983046, 0, 65537, 983047, 0, 65537, 983048, 0, 65537, 983049, 0, 65537, 983050, 0, 65537, 983051, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983054, 0, 65537, 983055, 0, 65537, 983056, 0, 65537, 983057, 0, 65537, 983058, 0, 65537, 983059, 0, 65537, 983060, 0, 65537, 983061, 0, 65537, 983062, 0, 65537, 983063, 0, 65537, 983064, 0, 65537, 983065, 0, 65537, 983066, 0, 65537, 983067, 0, 65537, 983068, 0, 65537, 983069, 0, 65537, 983070, 0, 65537, 983071, 0, 65537, 983072, 0, 65537, 983073, 0, 65537, 983074, 0, 65537, 983075, 0, 65537, 983076, 0, 65537, 983077, 0, 65537, 983078, 0, 65537, 983079, 0, 65537, 983080, 0, 65537, 983081, 0, 65537, 983082, 0, 65537, 983083, 0, 65537, 983084, 0, 65537, 983085, 0, 65537, 983086, 0, 65537, 983087, 0, 65537, 983088, 0, 65537, 983089, 0, 65539, 1048576, 0, 131072, 1048577, 0, 4, 1048578, 0, 4, 1048579, 0, 131073, 1048580, 0, 4, 1048581, 0, 4, 1048582, 0, 4, 1048583, 0, 4, 1048584, 0, 131073, 1048585, 0, 4, 1048586, 0, 4, 1048587, 0, 131073, 1048588, 0, 131073, 1048589, 0, 131073, 1048590, 0, 4, 1048591, 0, 4, 1048592, 0, 131073, 1048593, 0, 131073, 1048594, 0, 131073, 1048595, 0, 4, 1048596, 0, 4, 1048597, 0, 131073, 1048598, 0, 4, 1048599, 0, 131073, 1048600, 0, 131073, 1048601, 0, 131073, 1048602, 0, 4, 1048603, 0, 131073, 1048604, 0, 4, 1048605, 0, 131073, 1048606, 0, 4, 1048607, 0, 4, 1048608, 0, 4, 1048609, 0, 4, 1048610, 0, 131073, 1048611, 0, 4, 1048612, 0, 4, 1048613, 0, 4, 1048614, 0, 4, 1048615, 0, 131073, 1048616, 0, 4, 1048617, 0, 131073, 1048618, 0, 4, 1048619, 0, 4, 1048620, 0, 4, 1048621, 0, 131073, 1048622, 0, 131073, 1048623, 0, 131073, 1048624, 0, 4, 1048625, 0, 131074 ) - -[node name="EnterLevelArea" parent="." instance=ExtResource( 2 )] -position = Vector2( -2, 224 ) +tile_data = PoolIntArray( -327680, 0, 0, -327679, 0, 131076, -327678, 0, 1, -327677, 0, 131076, -327676, 0, 131076, -327675, 0, 131076, -327674, 0, 131076, -327673, 0, 131076, -327672, 0, 1, -327671, 0, 1, -327670, 0, 131076, -327669, 0, 1, -327668, 0, 131076, -327667, 0, 1, -327666, 0, 1, -327665, 0, 131076, -327664, 0, 131076, -327663, 0, 131076, -327662, 0, 1, -327661, 0, 131076, -327660, 0, 1, -327659, 0, 131076, -327658, 0, 1, -327657, 0, 1, -327656, 0, 1, -327655, 0, 1, -327654, 0, 1, -327653, 0, 131076, -327652, 0, 1, -327651, 0, 1, -327650, 0, 2, -262144, 0, 65536, -262143, 0, 3, -262142, 0, 4, -262141, 0, 4, -262140, 0, 131073, -262139, 0, 131073, -262138, 0, 131073, -262137, 0, 4, -262136, 0, 131073, -262135, 0, 4, -262134, 0, 4, -262133, 0, 4, -262132, 0, 131073, -262131, 0, 4, -262130, 0, 131073, -262129, 0, 131073, -262128, 0, 131073, -262127, 0, 131073, -262126, 0, 4, -262125, 0, 131073, -262124, 0, 4, -262123, 0, 131073, -262122, 0, 131073, -262121, 0, 4, -262120, 0, 131073, -262119, 0, 4, -262118, 0, 4, -262117, 0, 5, -262116, 0, 65537, -262115, 0, 3, -262114, 0, 131074, -196608, 0, 65541, -196607, 0, 65539, -196581, 0, 65541, -196580, 0, 65537, -196579, 0, 65538, -131072, 0, 65536, -131071, 0, 65538, -131045, 0, 65536, -131044, 0, 65537, -131043, 0, 65538, -65536, 0, 65541, -65535, 0, 65538, -65509, 0, 65536, -65508, 0, 65537, -65507, 0, 65538, 0, 0, 65536, 1, 0, 65538, 27, 0, 65536, 28, 0, 65537, 29, 0, 65539, 65536, 0, 65541, 65537, 0, 65539, 65563, 0, 65541, 65564, 0, 65537, 65565, 0, 65539, 131072, 0, 65536, 131073, 0, 65539, 131099, 0, 65536, 131100, 0, 65537, 131101, 0, 65539, 196608, 0, 65536, 196609, 0, 65539, 196614, 0, 0, 196615, 0, 131076, 196616, 0, 2, 196635, 0, 65536, 196636, 0, 65537, 196637, 0, 65539, 262144, 0, 65536, 262145, 0, 65539, 262150, 0, 65541, 262151, 0, 65537, 262152, 0, 65539, 262171, 0, 65541, 262172, 0, 65537, 262173, 0, 65538, 327680, 0, 65541, 327681, 0, 65539, 327686, 0, 65536, 327687, 0, 65537, 327688, 0, 65538, 327707, 0, 65536, 327708, 0, 65537, 327709, 0, 65539, 393216, 0, 65536, 393217, 0, 65538, 393222, 0, 65541, 393223, 0, 65537, 393224, 0, 65539, 393229, 0, 0, 393230, 0, 1, 393231, 0, 1, 393232, 0, 2, 393237, 0, 0, 393238, 0, 1, 393239, 0, 2, 393243, 0, 65536, 393244, 0, 65537, 393245, 0, 65538, 393254, 0, 0, 393255, 0, 131076, 393256, 0, 1, 393257, 0, 131076, 393258, 0, 1, 393259, 0, 131076, 393260, 0, 1, 393261, 0, 1, 393262, 0, 131076, 393263, 0, 131076, 393264, 0, 131076, 393265, 0, 2, 458752, 0, 65536, 458753, 0, 65538, 458758, 0, 131072, 458759, 0, 131073, 458760, 0, 131074, 458765, 0, 65536, 458766, 0, 65537, 458767, 0, 65537, 458768, 0, 65538, 458773, 0, 65541, 458774, 0, 65537, 458775, 0, 65538, 458779, 0, 65536, 458780, 0, 65537, 458781, 0, 65539, 458790, 0, 131072, 458791, 0, 4, 458792, 0, 4, 458793, 0, 5, 458794, 0, 65537, 458795, 0, 65537, 458796, 0, 65537, 458797, 0, 65537, 458798, 0, 65537, 458799, 0, 65537, 458800, 0, 65537, 458801, 0, 65539, 524288, 0, 65541, 524289, 0, 65538, 524301, 0, 131072, 524302, 0, 131073, 524303, 0, 4, 524304, 0, 131074, 524309, 0, 131072, 524310, 0, 4, 524311, 0, 131074, 524315, 0, 65536, 524316, 0, 65537, 524317, 0, 65538, 524329, 0, 65541, 524330, 0, 65537, 524331, 0, 65537, 524332, 0, 65537, 524333, 0, 65537, 524334, 0, 65537, 524335, 0, 65537, 524336, 0, 65537, 524337, 0, 65539, 589824, 0, 65541, 589825, 0, 65539, 589851, 0, 65541, 589852, 0, 65537, 589853, 0, 131075, 589854, 0, 1, 589855, 0, 131076, 589856, 0, 131076, 589857, 0, 131076, 589858, 0, 1, 589859, 0, 1, 589860, 0, 2, 589865, 0, 65536, 589866, 0, 65537, 589867, 0, 65537, 589868, 0, 65537, 589869, 0, 65537, 589870, 0, 65537, 589871, 0, 65537, 589872, 0, 65537, 589873, 0, 65539, 655360, 0, 65536, 655361, 0, 65539, 655377, 0, 0, 655378, 0, 131076, 655379, 0, 2, 655387, 0, 65541, 655388, 0, 65537, 655389, 0, 3, 655390, 0, 4, 655391, 0, 4, 655392, 0, 4, 655393, 0, 4, 655394, 0, 4, 655395, 0, 4, 655396, 0, 131074, 655401, 0, 65541, 655402, 0, 65537, 655403, 0, 65537, 655404, 0, 65537, 655405, 0, 65537, 655406, 0, 65537, 655407, 0, 65537, 655408, 0, 65537, 655409, 0, 65538, 720896, 0, 131072, 720897, 0, 131074, 720913, 0, 131072, 720914, 0, 4, 720915, 0, 131074, 720923, 0, 131072, 720924, 0, 4, 720925, 0, 131074, 720937, 0, 65536, 720938, 0, 65537, 720939, 0, 65537, 720940, 0, 65537, 720941, 0, 65537, 720942, 0, 65537, 720943, 0, 65537, 720944, 0, 65537, 720945, 0, 65539, 786470, 0, 0, 786471, 0, 1, 786472, 0, 1, 786473, 0, 131077, 786474, 0, 65537, 786475, 0, 65537, 786476, 0, 65537, 786477, 0, 65537, 786478, 0, 65537, 786479, 0, 65537, 786480, 0, 65537, 786481, 0, 65539, 852006, 0, 65536, 852007, 0, 65537, 852008, 0, 65537, 852009, 0, 65537, 852010, 0, 65537, 852011, 0, 65537, 852012, 0, 65537, 852013, 0, 65537, 852014, 0, 65537, 852015, 0, 65537, 852016, 0, 65537, 852017, 0, 65538, 983035, 0, 0, 983036, 0, 1, 983037, 0, 1, 983038, 0, 131076, 983039, 0, 131076, 917504, 0, 131076, 917505, 0, 1, 917506, 0, 131076, 917507, 0, 131076, 917508, 0, 1, 917509, 0, 1, 917510, 0, 1, 917511, 0, 131076, 917512, 0, 131076, 917513, 0, 131076, 917514, 0, 131076, 917515, 0, 1, 917516, 0, 131076, 917517, 0, 131076, 917518, 0, 131076, 917519, 0, 131076, 917520, 0, 1, 917521, 0, 1, 917522, 0, 1, 917523, 0, 131076, 917524, 0, 131076, 917525, 0, 131076, 917526, 0, 131076, 917527, 0, 1, 917528, 0, 131076, 917529, 0, 131076, 917530, 0, 1, 917531, 0, 1, 917532, 0, 131076, 917533, 0, 131076, 917534, 0, 1, 917535, 0, 1, 917536, 0, 1, 917537, 0, 1, 917538, 0, 1, 917539, 0, 131076, 917540, 0, 131076, 917541, 0, 131076, 917542, 0, 131077, 917543, 0, 65537, 917544, 0, 65537, 917545, 0, 65537, 917546, 0, 65537, 917547, 0, 65537, 917548, 0, 65537, 917549, 0, 65537, 917550, 0, 65537, 917551, 0, 65537, 917552, 0, 65537, 917553, 0, 65539, 1048571, 0, 65536, 1048572, 0, 65537, 1048573, 0, 65537, 1048574, 0, 65537, 1048575, 0, 65537, 983040, 0, 65537, 983041, 0, 65537, 983042, 0, 65537, 983043, 0, 65537, 983044, 0, 65537, 983045, 0, 65537, 983046, 0, 65537, 983047, 0, 65537, 983048, 0, 65537, 983049, 0, 65537, 983050, 0, 65537, 983051, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983054, 0, 65537, 983055, 0, 65537, 983056, 0, 65537, 983057, 0, 65537, 983058, 0, 65537, 983059, 0, 65537, 983060, 0, 65537, 983061, 0, 65537, 983062, 0, 65537, 983063, 0, 65537, 983064, 0, 65537, 983065, 0, 65537, 983066, 0, 65537, 983067, 0, 65537, 983068, 0, 65537, 983069, 0, 65537, 983070, 0, 65537, 983071, 0, 65537, 983072, 0, 65537, 983073, 0, 65537, 983074, 0, 65537, 983075, 0, 65537, 983076, 0, 65537, 983077, 0, 65537, 983078, 0, 65537, 983079, 0, 65537, 983080, 0, 65537, 983081, 0, 65537, 983082, 0, 65537, 983083, 0, 65537, 983084, 0, 65537, 983085, 0, 65537, 983086, 0, 65537, 983087, 0, 65537, 983088, 0, 65537, 983089, 0, 65539, 1114107, 0, 131072, 1114108, 0, 131073, 1114109, 0, 131073, 1114110, 0, 131073, 1114111, 0, 131073, 1048576, 0, 4, 1048577, 0, 4, 1048578, 0, 4, 1048579, 0, 131073, 1048580, 0, 4, 1048581, 0, 4, 1048582, 0, 4, 1048583, 0, 4, 1048584, 0, 131073, 1048585, 0, 4, 1048586, 0, 4, 1048587, 0, 131073, 1048588, 0, 131073, 1048589, 0, 131073, 1048590, 0, 4, 1048591, 0, 4, 1048592, 0, 131073, 1048593, 0, 131073, 1048594, 0, 131073, 1048595, 0, 4, 1048596, 0, 4, 1048597, 0, 131073, 1048598, 0, 4, 1048599, 0, 131073, 1048600, 0, 131073, 1048601, 0, 131073, 1048602, 0, 4, 1048603, 0, 131073, 1048604, 0, 4, 1048605, 0, 131073, 1048606, 0, 4, 1048607, 0, 4, 1048608, 0, 4, 1048609, 0, 4, 1048610, 0, 131073, 1048611, 0, 4, 1048612, 0, 4, 1048613, 0, 4, 1048614, 0, 4, 1048615, 0, 131073, 1048616, 0, 4, 1048617, 0, 131073, 1048618, 0, 4, 1048619, 0, 4, 1048620, 0, 4, 1048621, 0, 131073, 1048622, 0, 131073, 1048623, 0, 131073, 1048624, 0, 4, 1048625, 0, 131074 ) [node name="AmbiantLighting" parent="." instance=ExtResource( 3 )] [node name="WarpZone" parent="." instance=ExtResource( 2 )] position = Vector2( 360, 97 ) -zone = 1 +to_level_coord = Vector2( 1, 0 ) [node name="WarpZone2" parent="." instance=ExtResource( 2 )] position = Vector2( 240, 96 ) -zone = 2 -[connection signal="player_entered" from="WarpZone" to="." method="_on_WarpZone_player_entered"] -[connection signal="player_entered" from="WarpZone2" to="." method="_on_WarpZone_player_entered"] +to_level_coord = Vector2( 2, 0 ) + +[node name="WarpZone3" parent="." instance=ExtResource( 2 )] +position = Vector2( -5, 224 ) +is_exit = false +[connection signal="player_entered" from="WarpZone3" to="." method="_on_WarpZone_player_entered"] diff --git a/src/Items/CheckPoint.gd b/src/Items/CheckPoint.gd index 8b3c716..56f5704 100644 --- a/src/Items/CheckPoint.gd +++ b/src/Items/CheckPoint.gd @@ -2,7 +2,6 @@ extends Node2D class_name CheckPoint -signal activated export var activated:=false @@ -16,13 +15,8 @@ func activate() -> void: activated = true $AnimationPlayer.play("activated") $Particles2D.emitting = true - emit_signal("activated", self) func _on_activated_animation_finished(): $Particles2D.amount = 5 $AnimationPlayer.play("active") - -func _on_Area2D_body_entered(body: Node) -> void: - if body.name == "Player": - activate() diff --git a/src/Items/CheckPoint.tscn b/src/Items/CheckPoint.tscn index f2698fe..537767c 100644 --- a/src/Items/CheckPoint.tscn +++ b/src/Items/CheckPoint.tscn @@ -1,13 +1,10 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://assets/Items/save_point_anim_strip_9.png" type="Texture" id=1] [ext_resource path="res://assets/Items/torch_ligt_texture.png" type="Texture" id=2] [ext_resource path="res://src/Items/CheckPoint.gd" type="Script" id=3] -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 10, 11 ) - -[sub_resource type="Animation" id=2] +[sub_resource type="Animation" id=1] length = 0.7 tracks/0/type = "value" tracks/0/path = NodePath("Light2D:enabled") @@ -72,7 +69,7 @@ tracks/4/keys = { } ] } -[sub_resource type="Animation" id=3] +[sub_resource type="Animation" id=2] resource_name = "active" length = 0.7 loop = true @@ -125,7 +122,7 @@ tracks/3/keys = { "values": [ Vector2( 1, 1 ), Vector2( 1.63405, 1.63405 ), Vector2( 2.21172, 2.21172 ), Vector2( 2.11387, 2.11387 ) ] } -[sub_resource type="Animation" id=4] +[sub_resource type="Animation" id=3] length = 0.7 loop = true tracks/0/type = "value" @@ -165,27 +162,27 @@ tracks/2/keys = { "values": [ 1, 2, 3, 4, 5, 6, 7, 8 ] } -[sub_resource type="Gradient" id=5] +[sub_resource type="Gradient" id=4] colors = PoolColorArray( 0.145098, 1, 1, 1, 0.941176, 0.713726, 0, 0.870588 ) -[sub_resource type="GradientTexture" id=6] -gradient = SubResource( 5 ) +[sub_resource type="GradientTexture" id=5] +gradient = SubResource( 4 ) -[sub_resource type="Curve" id=7] +[sub_resource type="Curve" id=6] min_value = -200.0 max_value = 200.0 _data = [ Vector2( 0, 200 ), 0.0, -253.551, 0, 0, Vector2( 1, -200 ), 74.3008, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=8] -curve = SubResource( 7 ) +[sub_resource type="CurveTexture" id=7] +curve = SubResource( 6 ) -[sub_resource type="Curve" id=9] +[sub_resource type="Curve" id=8] _data = [ Vector2( 0.00784314, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.0772727 ), 0.0, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=10] -curve = SubResource( 9 ) +[sub_resource type="CurveTexture" id=9] +curve = SubResource( 8 ) -[sub_resource type="ParticlesMaterial" id=11] +[sub_resource type="ParticlesMaterial" id=10] emission_shape = 2 emission_box_extents = Vector3( 5, 4, 1 ) flag_disable_z = true @@ -197,25 +194,17 @@ orbit_velocity = 0.0 orbit_velocity_random = 0.0 linear_accel = 100.0 linear_accel_random = 0.2 -linear_accel_curve = SubResource( 8 ) +linear_accel_curve = SubResource( 7 ) angle = 31.8 angle_random = 0.5 scale = 1.5 scale_random = 0.06 -scale_curve = SubResource( 10 ) -color_ramp = SubResource( 6 ) +scale_curve = SubResource( 9 ) +color_ramp = SubResource( 5 ) [node name="CheckPoint" type="Node2D"] script = ExtResource( 3 ) -[node name="Area2D" type="Area2D" parent="."] -collision_layer = 16 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -visible = false -position = Vector2( 0, -11 ) -shape = SubResource( 1 ) - [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0, -10 ) texture = ExtResource( 1 ) @@ -233,9 +222,9 @@ shadow_item_cull_mask = -2147483639 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "idle" -anims/activated = SubResource( 2 ) -anims/active = SubResource( 3 ) -anims/idle = SubResource( 4 ) +anims/activated = SubResource( 1 ) +anims/active = SubResource( 2 ) +anims/idle = SubResource( 3 ) [node name="Particles2D" type="Particles2D" parent="."] position = Vector2( 0, -4.625 ) @@ -244,5 +233,4 @@ amount = 7 lifetime = 0.3 speed_scale = 0.5 explosiveness = 0.25 -process_material = SubResource( 11 ) -[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] +process_material = SubResource( 10 ) diff --git a/src/Scripts/WarpZone.gd b/src/Scripts/WarpZone.gd index c992184..a04ad5b 100644 --- a/src/Scripts/WarpZone.gd +++ b/src/Scripts/WarpZone.gd @@ -3,15 +3,25 @@ extends Area2D class_name WarpZone signal player_entered - -var NON_SPECIFIED_LEVEL :=Vector2(-1, -1) - -export var to_level_coord:Vector2 =NON_SPECIFIED_LEVEL +export var to_level_coord:Vector2 = Vector2(-1, -1) export var is_exit:bool = true +const spawn_offset = 30 + +var initialized = false + +const NON_SPECIFIED_LEVEL :=Vector2(-1, -1) + func _ready() -> void: - add_to_group("WarpZones") + if not initialized: add_to_group("WarpZones") + initialized = true; + func _on_body_entered(body:Node): if body.name == "Player" and get_parent().is_active_level: - emit_signal("player_entered", is_exit, to_level_coord, position) + print("Warp - exit=%s to_level=%s" % [is_exit, to_level_coord]) + emit_signal("player_entered", is_exit, to_level_coord) + +func get_checkpoint_position(): + var factor = -1 if is_exit else 1 + return position + Vector2(factor * spawn_offset, 0) \ No newline at end of file