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" 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 onready var sceneProgress = 0
......
extends Node2D 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 #UI elements
onready var notepad = get_parent().get_node("UI/To do") onready var notepad = get_parent().get_node("UI/To do")
onready var moxie = get_parent().get_node("Moxie") onready var moxie = get_parent().get_node("Moxie")
onready var left = get_parent().get_node("UI/Left") onready var left = get_parent().get_node("UI/Left") # left arrow
onready var right = get_parent().get_node("UI/Right") onready var right = get_parent().get_node("UI/Right") # right arrow
onready var inventory = get_parent().get_node("UI/Inventory") onready var inventory = get_parent().get_node("UI/Inventory")
onready var deselect = get_parent().get_node("UI/Button") onready var deselect = get_parent().get_node("UI/Button")
onready var energy = get_parent().get_node("UI/Energy bar") onready var energy = get_parent().get_node("UI/Energy bar")
onready var dialogue = get_parent().get_node("UI/Dialogue Box/RichTextLabel") 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 #rooms
onready var bedroom = get_parent().get_node("Bedroom") onready var bedroom = get_parent().get_node("Bedroom")
...@@ -27,16 +31,16 @@ onready var neighborsRoom = get_parent().get_node("Neighbor's room") ...@@ -27,16 +31,16 @@ onready var neighborsRoom = get_parent().get_node("Neighbor's room")
onready var neighborsBalcony = get_parent().get_node("Neighbor's balcony") onready var neighborsBalcony = get_parent().get_node("Neighbor's balcony")
#functioning stuff #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 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 lockedNotepad #if ur locked from certain areas bc u havent gotten the notebook yet
onready var labNotes = 0 onready var labNotes = 0 # how many lab notes have been collected
onready var clothes = 0 onready var clothes = 0 # how many pieces of clothing have been collected in the bedroom
onready var bathroomClean = 0 onready var bathroomClean = 0 # how much of the bathroom has been cleaned
onready var cleaningMaterials = 0 onready var cleaningMaterials = 0 # how many times the cleaning materials have been successfully used
onready var canFrontDoor = false 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 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 #items in the rooms that need access to the event handler
...@@ -45,10 +49,9 @@ export(Array, NodePath) onready var eventItems ...@@ -45,10 +49,9 @@ export(Array, NodePath) onready var eventItems
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
notepad.hide() 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) get_node(item).passEvent(self)
#connect_stools() lockedNotepad = true # ensures that certain areas are locked before the player retrieves the notebook
lockedNotepad = true
right.hide() right.hide()
left.hide() left.hide()
...@@ -84,12 +87,10 @@ func _start_lab(): # trying the lab the first time, adds the new quests ...@@ -84,12 +87,10 @@ func _start_lab(): # trying the lab the first time, adds the new quests
#change sprite for terrarium #change sprite for terrarium
bedroom.get_node("Terrarium").flavorText = "OMG! Where did Banana go??" bedroom.get_node("Terrarium").flavorText = "OMG! Where did Banana go??"
func _add_quest(questName): func _add_quest(questName): # adding a quest to the quest list
print("Added "+questName)
quests.add(questName) quests.add(questName)
func _remove_quest(questName): func _remove_quest(questName): # removing a quest from the quest list
print("Removed "+ questName)
quests.finishQuest(questName) quests.finishQuest(questName)
func _add_lab_note(): # when a new lab note is retrieved 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 ...@@ -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 func get_lab_notes(): # returns how many lab notes the player has found
return labNotes return labNotes
func _add_clothes(): func _add_clothes(): # adds to the number of pieces of clothing that have been collected
clothes = clothes + 1 clothes = clothes + 1
func get_clothes(): func get_clothes(): # returns the number of pieces of clothing that have been collected
return clothes 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 bathroomClean = bathroomClean + 1
print("Cleaned " + str(bathroomClean))
if toolUsed == "Cleaning mat": if toolUsed == "Cleaning mat":
cleaningMaterials += 1 cleaningMaterials += 1
if bathroomClean == 5: if cleaningMaterials == 3: # if the cleaning materials have cleaned 3 objects (sink, mirror, and floor), remove it
quests.finishQuest("Clean bathroom")
if cleaningMaterials == 3:
inventory.remove_item_name("Cleaning mat") 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 return bathroomClean
func _foundBanana(): func _foundBanana(): # keeps track that Banana has been spotted on the balcony
#quests.finishQuest("Find Banana")
foundBanana = true foundBanana = true
# ----------------- Notebook puzzle events ----------------- # ----------------- Notebook puzzle events -----------------
func _enter_notebook_laundry(): # trying to engage in the notebook puzzle for doing laundry func _enter_notebook_laundry(): # trying to engage in the notebook puzzle for doing laundry
if !quests.hasQuest("Do laundry"): if !quests.hasQuest("Do laundry"):
...@@ -148,7 +148,6 @@ func _enter_notebook_laundry(): # trying to engage in the notebook puzzle for do ...@@ -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." return "The groceries are still in the way."
func _laundry_finished(): # finishing notebook puzzle for laundry func _laundry_finished(): # finishing notebook puzzle for laundry
print("Finished laundry")
quests.finishQuest("Do laundry") quests.finishQuest("Do laundry")
inventory.remove_item_name("Dirty clothes") inventory.remove_item_name("Dirty clothes")
inventory.remove_item_name("Laundry detergent") inventory.remove_item_name("Laundry detergent")
...@@ -174,19 +173,19 @@ func _bathroom_exit(): # exiting bathroom ...@@ -174,19 +173,19 @@ func _bathroom_exit(): # exiting bathroom
bedroom.show() bedroom.show()
movementHandle.enableMovement() movementHandle.enableMovement()
func _balcony_enter(): func _balcony_enter(): # entering balcony
movementHandle.disableMovement() movementHandle.disableMovement()
balcony.show() balcony.show()
livingRoom.hide() livingRoom.hide()
func _balcony_exit(): func _balcony_exit(): # exiting balcony
movementHandle.enableMovement() movementHandle.enableMovement()
balcony.hide() balcony.hide()
livingRoom.show() livingRoom.show()
func _living_to_hallway(): func _living_to_hallway(): # moving from living room to hallway, if there's a reason to
if ((inventory.hasItem("Trash") != -1) || foundBanana): if ((inventory.hasItem("Trash") != -1) || foundBanana): # either Moxie has to take out the trash or has to look for Banana
canFrontDoor = true canFrontDoor = true # leaving the apartment is now permanently enabled
if canFrontDoor: if canFrontDoor:
movementHandle.disableMovement() movementHandle.disableMovement()
...@@ -196,26 +195,26 @@ func _living_to_hallway(): ...@@ -196,26 +195,26 @@ func _living_to_hallway():
else: else:
dialogue.text = "You know, my philosophy has always been, 'If there's no reason to leave my apartment, why leave?'" 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() movementHandle.enableMovement()
hallway.hide() hallway.hide()
livingRoom.show() livingRoom.show()
func _hallway_to_neighbor(): func _hallway_to_neighbor(): # moving from hallway to neighbor's living room
movementHandle.disableMovement() movementHandle.disableMovement()
hallway.hide() hallway.hide()
neighborsRoom.show() neighborsRoom.show()
func _neighbor_to_hallway(): func _neighbor_to_hallway(): # moving from neighbor's living room to the hallway
hallway.show() hallway.show()
neighborsRoom.hide() neighborsRoom.hide()
func _neighbor_to_balcony(): func _neighbor_to_balcony(): # moving from neighbor's living room to their balcony
movementHandle.disableMovement() movementHandle.disableMovement()
neighborsRoom.hide() neighborsRoom.hide()
neighborsBalcony.show() neighborsBalcony.show()
func _balcony_to_neighbor(): func _balcony_to_neighbor(): # moving from neighbor's balcony to their living room
neighborsRoom.show() neighborsRoom.show()
neighborsBalcony.hide() neighborsBalcony.hide()
...@@ -232,7 +231,6 @@ func zoom_out(): # for returning from close up perspectives ...@@ -232,7 +231,6 @@ func zoom_out(): # for returning from close up perspectives
moxie.show() moxie.show()
inventory.show() inventory.show()
if !lockedNotepad: if !lockedNotepad:
print("Notepad isnt locked")
#get_parent().get_node("UI/Movement Handler").check_arrows() # show arrows depending on situation #get_parent().get_node("UI/Movement Handler").check_arrows() # show arrows depending on situation
movementHandle.enableMovement() movementHandle.enableMovement()
deselect.show() deselect.show()
...@@ -262,25 +260,25 @@ func _return_fridge(): # returning from fridge view ...@@ -262,25 +260,25 @@ func _return_fridge(): # returning from fridge view
zoom_out() zoom_out()
notepad.show() notepad.show()
func _open_cabinet(): func _open_cabinet(): # looking inside kitchen cabinet
zoom_in() zoom_in()
inventory.show() inventory.show()
kitchen.hide() kitchen.hide()
insideCabinet.show() insideCabinet.show()
func _close_cabinet(): func _close_cabinet(): # leaving kitchen cabinet
zoom_out() zoom_out()
kitchen.show() kitchen.show()
insideCabinet.hide() insideCabinet.hide()
func _in_desk(): func _in_desk(): # looking at desk
if !lockedNotepad: if !lockedNotepad: # only if notepad has been retrieved
zoom_in() zoom_in()
inventory.show() inventory.show()
desk.show() desk.show()
bedroom.hide() bedroom.hide()
func _out_desk(): func _out_desk(): # leaving desk
zoom_out() zoom_out()
desk.hide() desk.hide()
bedroom.show() bedroom.show()
......
extends RichTextLabel extends RichTextLabel
# This script handles the list of quests that the player must accomplish, and displays it
# variables editable in the Inspector # variables editable in the Inspector
export(PoolStringArray) onready var quests # array of all the current quests 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. func _ready(): # Called when the node enters the scene tree for the first time.
showQuests() showQuests()
pass pass
func add(q): func add(q): # adds a quest to the list
quests.append(q) quests.append(q)
showQuests() showQuests()
func finishQuest(q): func finishQuest(q): # removes a quest from the list
var index = 0 var index = 0
var found = false var found = false
print("trying to find quest to remove " + q) #print("trying to find quest to remove " + q)
for quest in quests: for quest in quests:
if quest == q: if quest == q:
quests.remove(index) quests.remove(index)
print("Quest found, will remove") #print("Quest found, will remove")
showQuests() showQuests()
found = true found = true
index += 1 index += 1
...@@ -28,14 +27,13 @@ func finishQuest(q): ...@@ -28,14 +27,13 @@ func finishQuest(q):
print("Unable to delete quest") 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: if quests.size() > 0:
text = "- " + quests.join("\n- ") # prints all quests on the notepad text = "- " + quests.join("\n- ") # prints all quests on the notepad
else: else:
text = "" 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 var has = false
for quest in quests: for quest in quests:
if quest == questInq: if quest == questInq:
......
...@@ -2,7 +2,7 @@ extends "res://Item.gd" ...@@ -2,7 +2,7 @@ extends "res://Item.gd"
onready var unlocked = false onready var unlocked = false
signal enter signal enter
signal foundBanana 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
...@@ -12,7 +12,7 @@ func passEvent(handler): ...@@ -12,7 +12,7 @@ func passEvent(handler):
connect("enter", handler,"_balcony_enter") connect("enter", handler,"_balcony_enter")
connect("foundBanana", handler,"_foundBanana") 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?": if flavorText == "BANANA?? How did you even get out there?":
.mouseInteraction() .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!" 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 ...@@ -30,7 +30,6 @@ func objInteraction(selected): # when an object is used on it
dialogueBox.text = "No flavor text found" #can replace this later! 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 if inventory.get_item_text(selected) == "Bobby pins": # unlocking the door with a bobby pin
dialogueBox.text = "I can't believe that actually worked?!" dialogueBox.text = "I can't believe that actually worked?!"
emit_signal("enter") unlocked = true # can now go through the balcony door freely
unlocked = true
inventory.unselect_all() #unselect item inventory.unselect_all() #unselect item
extends "res://Item.gd" extends "res://Item.gd"
# This script moves the player from the neighbor's balcony to the neighbor's room
signal exit signal exit
......
extends "res://Item.gd" extends "res://Item.gd"
# This script moves the player from the hallway to Moxie's living room
signal enter signal enter
......
extends "res://Item.gd" extends "res://Item.gd"
# This script moves the player from the balcony to the living room
signal exit signal exit
......
extends "res://Item.gd" 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 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
...@@ -11,13 +12,13 @@ func passEvent(handler): ...@@ -11,13 +12,13 @@ func passEvent(handler):
connect("enter", handler,"_hallway_to_neighbor") connect("enter", handler,"_hallway_to_neighbor")
func mouseInteraction(): func mouseInteraction():
if !comeIn: if !comeIn: # if they haven't rung the doorbell yet
.mouseInteraction() .mouseInteraction()
if flavorText == "What is Brodie doing in there?! That sound is really ticking me off... Should I go inside?": 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 flavorText = "I should ring the bell first, it's only polite" #placeholder
else: else: # if they have
emit_signal("enter") emit_signal("enter")
dialogueBox.text = "" dialogueBox.text = ""
func ring(): func ring(): # is called when the doorbell is rung
comeIn = true comeIn = true
extends "res://Item.gd" extends "res://Item.gd"
# This script brings the player to the hallway from the player
signal enter signal enter
onready var first = true onready var first = true
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.
...@@ -12,7 +14,7 @@ func passEvent(handler): ...@@ -12,7 +14,7 @@ func passEvent(handler):
func mouseInteraction(): func mouseInteraction():
emit_signal("enter") 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." dialogueBox.text = "What is that noise? Sounds like my neighbor's trying to break down their walls."
first = false first = false
#maybe have it repeat until they remove the noise? or would that be repetitive #maybe have it repeat until they remove the noise? or would that be repetitive
......
extends "res://Item.gd" extends "res://Item.gd"
# This script moves the player from the neighbor's room to the hallway
signal enter signal enter
......
extends "res://Item.gd" extends "res://Item.gd"
# This script moves the player from the neighbor's room to the neighbor's balcony
signal exit signal exit
......
extends "res://Item.gd" extends "res://Item.gd"
signal returnCabinet 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
......
extends "res://Item.gd" extends "res://Item.gd"
# This script rings the neighbor's doorbell, allowing the player to enter
#signal enter
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.
#func passEvent(handler):
#connect("enter", handler,"_hallway_to_neighbor")
# pass
func mouseInteraction(): func mouseInteraction():
get_parent().get_node("Door to neighbor").ring() get_parent().get_node("Door to neighbor").ring()
.mouseInteraction() .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" flavorText = "They said to just come in, so"
pass
extends "res://Item.gd" extends "res://Item.gd"
onready var dialogueArrow = get_parent().get_node("Dialogue arrow") 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
......
extends "res://Item.gd" extends "res://Item.gd"
signal cleaned 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
...@@ -11,7 +12,7 @@ func passEvent(handler): ...@@ -11,7 +12,7 @@ func passEvent(handler):
func objInteraction(selected): func objInteraction(selected):
var flavor = control.interaction(inventory.get_item_text(selected), self.get_name()) 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." dialogueBox.text = "Good riddance."
inventory.remove_item(selected) inventory.remove_item(selected)
emit_signal("cleaned") emit_signal("cleaned")
......
extends StaticBody2D extends StaticBody2D
onready var opened onready var opened
onready var animator = get_parent().get_node("AnimationPlayer") 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
opened = false opened = false
...@@ -11,14 +13,13 @@ func _input_event(viewport, event, shape_idx): # executes when clicked on ...@@ -11,14 +13,13 @@ func _input_event(viewport, event, shape_idx): # executes when clicked on
if event.button_index == BUTTON_LEFT and event.pressed: if event.button_index == BUTTON_LEFT and event.pressed:
_open_UI() _open_UI()
func _open_UI(): # expands the notepad to a larger size, and animates
func _open_UI():
if !opened: if !opened:
animator.play("Notepad open") animator.play("Notepad open")
opened = true opened = true
#x = 474.699 #x = 474.699
#y = 140.82 #y = 140.82
else: else: # restores notebook to smaller size
animator.play_backwards("Notepad open") animator.play_backwards("Notepad open")
opened = false opened = false
#x = 474.699 #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