Commit 4129c688 authored by Julia Santos's avatar Julia Santos

Commented more of the scripts, balcony now unlocks first instead of putting...

Commented more of the scripts, balcony now unlocks first instead of putting you directly onto the balcony after lockpicking
parent 9520ad67
extends "res://Item.gd"
# This script progresses the dialogue between the Moxie and Brodie, hiding itself and resetting the conversation after it has ended
onready var sceneProgress = 0
......
extends Node2D
# This script is the general event handler of the game.
# It coordinates information and event triggers between different scenes and UI elements.
# Signal-related functions typically start with an underscore (_), while functions that are simply called do not
#UI elements
onready var notepad = get_parent().get_node("UI/To do")
onready var moxie = get_parent().get_node("Moxie")
onready var left = get_parent().get_node("UI/Left")
onready var right = get_parent().get_node("UI/Right")
onready var left = get_parent().get_node("UI/Left") # left arrow
onready var right = get_parent().get_node("UI/Right") # right arrow
onready var inventory = get_parent().get_node("UI/Inventory")
onready var deselect = get_parent().get_node("UI/Button")
onready var energy = get_parent().get_node("UI/Energy bar")
onready var dialogue = get_parent().get_node("UI/Dialogue Box/RichTextLabel")
onready var movementHandle = get_parent().get_node("UI/Movement Handler")
onready var movementHandle = get_parent().get_node("UI/Movement Handler") # not a UI element, just the node that handles the left/right movement between rooms
#rooms
onready var bedroom = get_parent().get_node("Bedroom")
......@@ -27,16 +31,16 @@ onready var neighborsRoom = get_parent().get_node("Neighbor's room")
onready var neighborsBalcony = get_parent().get_node("Neighbor's balcony")
#functioning stuff
onready var quests = notepad.get_node("Quests")
onready var quests = notepad.get_node("Quests") # the specific quest list
onready var groceries = false #if groceries were put away
onready var newQuests = false
onready var newQuests = false # if the 2nd round of quests have been given
onready var lockedNotepad #if ur locked from certain areas bc u havent gotten the notebook yet
onready var labNotes = 0
onready var clothes = 0
onready var bathroomClean = 0
onready var cleaningMaterials = 0
onready var canFrontDoor = false
onready var foundBanana = false
onready var labNotes = 0 # how many lab notes have been collected
onready var clothes = 0 # how many pieces of clothing have been collected in the bedroom
onready var bathroomClean = 0 # how much of the bathroom has been cleaned
onready var cleaningMaterials = 0 # how many times the cleaning materials have been successfully used
onready var canFrontDoor = false # whether or not Moxie has a reason to go to leave their apartment, and so go to the hallway
onready var foundBanana = false # whether or not Moxie has spotted Banana in the balcony
#items in the rooms that need access to the event handler
......@@ -45,10 +49,9 @@ export(Array, NodePath) onready var eventItems
# Called when the node enters the scene tree for the first time.
func _ready():
notepad.hide()
for item in eventItems:
for item in eventItems: # passes a reference to the handler to all listed items, so that they can connect a certain signal to a function in this script
get_node(item).passEvent(self)
#connect_stools()
lockedNotepad = true
lockedNotepad = true # ensures that certain areas are locked before the player retrieves the notebook
right.hide()
left.hide()
......@@ -84,12 +87,10 @@ func _start_lab(): # trying the lab the first time, adds the new quests
#change sprite for terrarium
bedroom.get_node("Terrarium").flavorText = "OMG! Where did Banana go??"
func _add_quest(questName):
print("Added "+questName)
func _add_quest(questName): # adding a quest to the quest list
quests.add(questName)
func _remove_quest(questName):
print("Removed "+ questName)
func _remove_quest(questName): # removing a quest from the quest list
quests.finishQuest(questName)
func _add_lab_note(): # when a new lab note is retrieved
......@@ -99,28 +100,27 @@ func _add_lab_note(): # when a new lab note is retrieved
func get_lab_notes(): # returns how many lab notes the player has found
return labNotes
func _add_clothes():
func _add_clothes(): # adds to the number of pieces of clothing that have been collected
clothes = clothes + 1
func get_clothes():
func get_clothes(): # returns the number of pieces of clothing that have been collected
return clothes
func _clean(toolUsed):
func _clean(toolUsed): # adds to the number of items that have been cleaned, and to the number of times the cleaning materials have been used
bathroomClean = bathroomClean + 1
print("Cleaned " + str(bathroomClean))
if toolUsed == "Cleaning mat":
cleaningMaterials += 1
if bathroomClean == 5:
quests.finishQuest("Clean bathroom")
if cleaningMaterials == 3:
if cleaningMaterials == 3: # if the cleaning materials have cleaned 3 objects (sink, mirror, and floor), remove it
inventory.remove_item_name("Cleaning mat")
if bathroomClean == 5: # if it's done, finish the quest
quests.finishQuest("Clean bathroom")
func getClean():
func getClean(): # returns the number of objects that have been cleaned
return bathroomClean
func _foundBanana():
#quests.finishQuest("Find Banana")
func _foundBanana(): # keeps track that Banana has been spotted on the balcony
foundBanana = true
# ----------------- Notebook puzzle events -----------------
func _enter_notebook_laundry(): # trying to engage in the notebook puzzle for doing laundry
if !quests.hasQuest("Do laundry"):
......@@ -148,7 +148,6 @@ func _enter_notebook_laundry(): # trying to engage in the notebook puzzle for do
return "The groceries are still in the way."
func _laundry_finished(): # finishing notebook puzzle for laundry
print("Finished laundry")
quests.finishQuest("Do laundry")
inventory.remove_item_name("Dirty clothes")
inventory.remove_item_name("Laundry detergent")
......@@ -174,19 +173,19 @@ func _bathroom_exit(): # exiting bathroom
bedroom.show()
movementHandle.enableMovement()
func _balcony_enter():
func _balcony_enter(): # entering balcony
movementHandle.disableMovement()
balcony.show()
livingRoom.hide()
func _balcony_exit():
func _balcony_exit(): # exiting balcony
movementHandle.enableMovement()
balcony.hide()
livingRoom.show()
func _living_to_hallway():
if ((inventory.hasItem("Trash") != -1) || foundBanana):
canFrontDoor = true
func _living_to_hallway(): # moving from living room to hallway, if there's a reason to
if ((inventory.hasItem("Trash") != -1) || foundBanana): # either Moxie has to take out the trash or has to look for Banana
canFrontDoor = true # leaving the apartment is now permanently enabled
if canFrontDoor:
movementHandle.disableMovement()
......@@ -196,26 +195,26 @@ func _living_to_hallway():
else:
dialogue.text = "You know, my philosophy has always been, 'If there's no reason to leave my apartment, why leave?'"
func _hallway_to_living():
func _hallway_to_living(): # moving from hallway to moxie's living room
movementHandle.enableMovement()
hallway.hide()
livingRoom.show()
func _hallway_to_neighbor():
func _hallway_to_neighbor(): # moving from hallway to neighbor's living room
movementHandle.disableMovement()
hallway.hide()
neighborsRoom.show()
func _neighbor_to_hallway():
func _neighbor_to_hallway(): # moving from neighbor's living room to the hallway
hallway.show()
neighborsRoom.hide()
func _neighbor_to_balcony():
func _neighbor_to_balcony(): # moving from neighbor's living room to their balcony
movementHandle.disableMovement()
neighborsRoom.hide()
neighborsBalcony.show()
func _balcony_to_neighbor():
func _balcony_to_neighbor(): # moving from neighbor's balcony to their living room
neighborsRoom.show()
neighborsBalcony.hide()
......@@ -232,7 +231,6 @@ func zoom_out(): # for returning from close up perspectives
moxie.show()
inventory.show()
if !lockedNotepad:
print("Notepad isnt locked")
#get_parent().get_node("UI/Movement Handler").check_arrows() # show arrows depending on situation
movementHandle.enableMovement()
deselect.show()
......@@ -262,25 +260,25 @@ func _return_fridge(): # returning from fridge view
zoom_out()
notepad.show()
func _open_cabinet():
func _open_cabinet(): # looking inside kitchen cabinet
zoom_in()
inventory.show()
kitchen.hide()
insideCabinet.show()
func _close_cabinet():
func _close_cabinet(): # leaving kitchen cabinet
zoom_out()
kitchen.show()
insideCabinet.hide()
func _in_desk():
if !lockedNotepad:
func _in_desk(): # looking at desk
if !lockedNotepad: # only if notepad has been retrieved
zoom_in()
inventory.show()
desk.show()
bedroom.hide()
func _out_desk():
func _out_desk(): # leaving desk
zoom_out()
desk.hide()
bedroom.show()
......
extends RichTextLabel
# This script handles the list of quests that the player must accomplish, and displays it
# variables editable in the Inspector
export(PoolStringArray) onready var quests # array of all the current quests
func _ready(): # Called when the node enters the scene tree for the first time.
showQuests()
pass
func add(q):
func add(q): # adds a quest to the list
quests.append(q)
showQuests()
func finishQuest(q):
func finishQuest(q): # removes a quest from the list
var index = 0
var found = false
print("trying to find quest to remove " + q)
#print("trying to find quest to remove " + q)
for quest in quests:
if quest == q:
quests.remove(index)
print("Quest found, will remove")
#print("Quest found, will remove")
showQuests()
found = true
index += 1
......@@ -28,14 +27,13 @@ func finishQuest(q):
print("Unable to delete quest")
func showQuests():
func showQuests(): # concatenates the quests into an easy-to-read-list and displays it
if quests.size() > 0:
text = "- " + quests.join("\n- ") # prints all quests on the notepad
else:
text = ""
#print(quests.join("\n- "))
func hasQuest(questInq): # checks if the array contains a certain quest
func hasQuest(questInq): # checks if the list contains a certain questm returns true if it does
var has = false
for quest in quests:
if quest == questInq:
......
......@@ -2,7 +2,7 @@ extends "res://Item.gd"
onready var unlocked = false
signal enter
signal foundBanana
# This script brings the player to the balcony, only once unlocked by the bobby pins
# Called when the node enters the scene tree for the first time.
func _ready():
......@@ -12,7 +12,7 @@ func passEvent(handler):
connect("enter", handler,"_balcony_enter")
connect("foundBanana", handler,"_foundBanana")
func mouseInteraction():
func mouseInteraction(): # changes flavor text after the first itneraction, and signals that the player has seen where Banana is
if flavorText == "BANANA?? How did you even get out there?":
.mouseInteraction()
flavorText = "Huh? The door's locked from the outside! How did this even--?! Ugh. There's gotta be another way to get there. Maybe all the heist movies I've seen will finally come in handy ha ha ha!"
......@@ -30,7 +30,6 @@ func objInteraction(selected): # when an object is used on it
dialogueBox.text = "No flavor text found" #can replace this later!
if inventory.get_item_text(selected) == "Bobby pins": # unlocking the door with a bobby pin
dialogueBox.text = "I can't believe that actually worked?!"
emit_signal("enter")
unlocked = true
unlocked = true # can now go through the balcony door freely
inventory.unselect_all() #unselect item
extends "res://Item.gd"
# This script moves the player from the neighbor's balcony to the neighbor's room
signal exit
......
extends "res://Item.gd"
# This script moves the player from the hallway to Moxie's living room
signal enter
......
extends "res://Item.gd"
# This script moves the player from the balcony to the living room
signal exit
......
extends "res://Item.gd"
# This script moves the player from the hallway to the neighbor's room, if they've run the doorbell already
signal enter
onready var comeIn = false
onready var comeIn = false # whether or not the player has rung the doorbell yet
# Called when the node enters the scene tree for the first time.
func _ready():
......@@ -11,13 +12,13 @@ func passEvent(handler):
connect("enter", handler,"_hallway_to_neighbor")
func mouseInteraction():
if !comeIn:
if !comeIn: # if they haven't rung the doorbell yet
.mouseInteraction()
if flavorText == "What is Brodie doing in there?! That sound is really ticking me off... Should I go inside?":
flavorText = "I should ring the bell first, it's only polite" #placeholder
else:
else: # if they have
emit_signal("enter")
dialogueBox.text = ""
func ring():
func ring(): # is called when the doorbell is rung
comeIn = true
extends "res://Item.gd"
# This script brings the player to the hallway from the player
signal enter
onready var first = true
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
......@@ -12,7 +14,7 @@ func passEvent(handler):
func mouseInteraction():
emit_signal("enter")
if first:
if first: # generates this dialogue when the player goes to the hallway for the first time
dialogueBox.text = "What is that noise? Sounds like my neighbor's trying to break down their walls."
first = false
#maybe have it repeat until they remove the noise? or would that be repetitive
......
extends "res://Item.gd"
# This script moves the player from the neighbor's room to the hallway
signal enter
......
extends "res://Item.gd"
# This script moves the player from the neighbor's room to the neighbor's balcony
signal exit
......
extends "res://Item.gd"
signal returnCabinet
# This script returns the player to the kitchen, from the Inside Cabinet view
# Called when the node enters the scene tree for the first time.
func _ready():
......
extends "res://Item.gd"
#signal enter
# This script rings the neighbor's doorbell, allowing the player to enter
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
#func passEvent(handler):
#connect("enter", handler,"_hallway_to_neighbor")
# pass
func mouseInteraction():
get_parent().get_node("Door to neighbor").ring()
.mouseInteraction()
if flavorText == "Brodie: Just come in, the door's open!":
if flavorText == "Brodie: Just come in, the door's open!": # if they ring it a second time
flavorText = "They said to just come in, so"
pass
extends "res://Item.gd"
onready var dialogueArrow = get_parent().get_node("Dialogue arrow")
# This script initiates the dialogue sequence with the neighbor
# Called when the node enters the scene tree for the first time.
func _ready():
......
extends "res://Item.gd"
signal cleaned
# This script allows for the Trash Chute to accept and dispose of the trash when used on it
# Called when the node enters the scene tree for the first time.
func _ready():
......@@ -11,7 +12,7 @@ func passEvent(handler):
func objInteraction(selected):
var flavor = control.interaction(inventory.get_item_text(selected), self.get_name())
if inventory.get_item_text(selected) == "Trash":
if inventory.get_item_text(selected) == "Trash": # if it's the trash, remove it from the inventory
dialogueBox.text = "Good riddance."
inventory.remove_item(selected)
emit_signal("cleaned")
......
extends StaticBody2D
onready var opened
onready var animator = get_parent().get_node("AnimationPlayer")
# This script handles the animation of opening/closing the notepad UI
# Called when the node enters the scene tree for the first time.
func _ready():
opened = false
......@@ -11,14 +13,13 @@ func _input_event(viewport, event, shape_idx): # executes when clicked on
if event.button_index == BUTTON_LEFT and event.pressed:
_open_UI()
func _open_UI():
func _open_UI(): # expands the notepad to a larger size, and animates
if !opened:
animator.play("Notepad open")
opened = true
#x = 474.699
#y = 140.82
else:
else: # restores notebook to smaller size
animator.play_backwards("Notepad open")
opened = false
#x = 474.699
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment