65 lines
1.2 KiB
GDScript
65 lines
1.2 KiB
GDScript
extends NPC
|
|
|
|
var path
|
|
var pathFollower
|
|
|
|
var movementSpeed = 90
|
|
var stopped = false
|
|
var flying = false
|
|
|
|
var lastX = 0
|
|
|
|
# temp sugar until balloon is added
|
|
var balloonItem = preload("res://Items/Toys/Other/Balloon.gd")
|
|
var cloudItem = preload("res://Items/Natural/Cloud.gd")
|
|
|
|
func _ready():
|
|
characterName = "Pax"
|
|
pronouns = "fae/faer"
|
|
|
|
pathFollower = get_parent()
|
|
|
|
func _process(delta):
|
|
if stopped:
|
|
return
|
|
pathFollower.progress += movementSpeed * delta
|
|
|
|
if pathFollower.position.x < lastX:
|
|
$Sprite.flip_h = false
|
|
else:
|
|
$Sprite.flip_h = true
|
|
|
|
lastX = pathFollower.position.x
|
|
|
|
func complete_quest():
|
|
if !QuestManager.is_completed("Wombat in the Sky"):
|
|
SaveManager.set_save_value("PaxFlyQuestCompleted", true)
|
|
QuestManager.complete_quest("Wombat in the Sky")
|
|
|
|
func balloon_check():
|
|
if InventoryManager.check_if_in_inventory(balloonItem.new()):
|
|
return true
|
|
else:
|
|
return false
|
|
|
|
func take_balloon():
|
|
InventoryManager.spend_item(balloonItem.new())
|
|
|
|
func fly():
|
|
flying = true
|
|
$AnimationPlayer.play("Fly")
|
|
|
|
func Stop_Walk():
|
|
stopped = true
|
|
$Sprite.stop()
|
|
|
|
func dialogue_cancel():
|
|
if not flying:
|
|
stopped = false
|
|
$Sprite.play()
|
|
|
|
func give_cloud():
|
|
InventoryManager.add_item_to_inventory(cloudItem.new())
|
|
|
|
|