forked from discomrade/EscapeFromCatalunya
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
941 B
38 lines
941 B
2 years ago
|
extends "res://level/common/level.gd"
|
||
|
|
||
|
onready var player = $Player
|
||
|
onready var playerHitbox = player.get_main_hitbox()
|
||
|
|
||
|
var won = false
|
||
|
|
||
|
func _init():
|
||
|
# Set these constants before they are read on player's ready
|
||
|
out_of_bounds_y_start = -1
|
||
|
out_of_bounds_y_end = -4
|
||
|
|
||
|
func _ready():
|
||
|
$Music.play()
|
||
|
player.achievement("Objective: Escape", "Porky has sent mercenaries to kidnap you! Escape the town.")
|
||
|
|
||
|
func win():
|
||
|
if !won:
|
||
|
won = true
|
||
|
player.achievement("Escaped the town!", "")
|
||
|
$Music.stop()
|
||
|
$WinTheme.play()
|
||
|
|
||
|
|
||
|
func _on_WaypointCheckpoint1_body_entered(body):
|
||
|
if body == playerHitbox:
|
||
|
player.achievement("Checkpoint!", "")
|
||
|
player.initial_position = player.global_transform.origin
|
||
|
|
||
|
func _on_AchieveWetKitty_body_entered(body):
|
||
|
if body == playerHitbox:
|
||
|
player.achievement("Achievement: Wet Kitty", "no youre not supposed to like water\n >:(")
|
||
|
|
||
|
func _on_WaypointEndLevel_body_entered(body):
|
||
|
if body == playerHitbox:
|
||
|
win()
|
||
|
|