extends Node2D signal droppedOff signal jonaldDroppedOff var status = "waiting" var fullSpin = false var boardedBucket = null var spinSpeed = 0.3 var cameraLimitTop var ticketItem = load("res://Items/Paper/FaireTicket.gd") func _process(delta): $Supports.rotation += spinSpeed*delta if status == "boarding": var result = check_for_bucket() if result != null: status = "riding" boardedBucket = result if status == "riding": GameVariables.player.global_position = boardedBucket.global_position var relativePos = boardedBucket.global_position - $Supports.global_position if relativePos.y < -100: fullSpin = true if fullSpin and relativePos.y > 0 and relativePos.x < 10: status = "waiting" LevelManager.get_skill("appreciating").experience_event("Ferris Wheel", "rode", 200) GameVariables.player.global_position += Vector2(0, 180) GameVariables.player.change_state("Idle") GameVariables.camera.limit_top = cameraLimitTop droppedOff.emit() func ride(): if InventoryManager.spend_item(ticketItem.new()): status = "boarding" fullSpin = false cameraLimitTop = GameVariables.camera.limit_top GameVariables.camera.limit_top = -10000 else: MessageManager.addMessage("You need one faire ticket to ride the ferris wheel.", null, "System", Color.MIDNIGHT_BLUE, true, false) GameVariables.player.change_state("Idle") func check_for_bucket(): var lowest = get_lowest_bucket() var relativePos = lowest.global_position - $Supports.global_position if relativePos.x < -40 or relativePos.x > 40: return null else: return lowest func get_lowest_bucket(): var lowest = null var lowestY = 1000 var buckets = $Supports.get_children() for bucket in buckets: var relativePos = bucket.global_position - $Supports.global_position if relativePos.y > lowestY or lowest == null: lowestY = relativePos.y lowest = bucket return lowest