2024-05-08 11:28:26 -04:00
|
|
|
extends "res://player.gd"
|
|
|
|
|
2024-05-09 14:23:34 -04:00
|
|
|
var can_jump = true
|
|
|
|
|
2024-05-08 11:28:26 -04:00
|
|
|
func _ready():
|
|
|
|
speed = 1200
|
2024-05-09 14:23:34 -04:00
|
|
|
$"../".get_node("%Ability").add_child(preload("res://portal-ability.tscn").instantiate())
|
2024-05-08 11:28:26 -04:00
|
|
|
update_animation()
|
|
|
|
if config.load("user://settings.cfg") == OK:
|
|
|
|
absolute_movement = not config.get_value("config", "relative_controls")
|
|
|
|
|
|
|
|
func _input(event):
|
2024-05-09 14:23:34 -04:00
|
|
|
if event.is_action_pressed("jump") and can_jump:
|
|
|
|
can_jump = false
|
|
|
|
$"../".get_node("%Ability/Portal").start_countup(0.5)
|
2024-05-08 11:28:26 -04:00
|
|
|
$Sprite.speed_scale = 1
|
|
|
|
$Sprite.play("jump")
|
|
|
|
await $Sprite.animation_finished
|
2024-05-09 14:23:34 -04:00
|
|
|
$"../".get_node("%Ability/Portal").start_countdown(0.5)
|
2024-05-08 11:28:26 -04:00
|
|
|
global_position = get_global_mouse_position()
|
|
|
|
$Sprite.speed_scale = -1
|
|
|
|
$Sprite.play("jump")
|
|
|
|
await $Sprite.animation_finished
|
|
|
|
$Sprite.play("idle")
|
2024-05-09 14:23:34 -04:00
|
|
|
can_jump = true
|