Commit 73b2eaca authored by Julia Santos's avatar Julia Santos

Added quest success to laundry and eating food

parent 4d56fd84
...@@ -12,14 +12,15 @@ func _ready(): ...@@ -12,14 +12,15 @@ func _ready():
func checkWin(): func checkWin():
print("Checked win") print("Checked win")
if clothes_in and soap and !drawer and !door: if clothes_in and soap and !drawer and !door:
emit_signal("laundry_finished")
print("Should win") print("Should win")
return "For my next trick, I will make this pile of laundry disappear! I think that's good for now." return "For my next trick, I will make this pile of laundry disappear! I think that's good for now."
emit_signal("laundry_finished")
else: else:
print("Should continue") print("Should continue")
return "Closed" return "Closed"
func passEvent(handler): func passEvent(handler):
print("Handler laundry passed")
connect("laundry_finished", handler, "_laundry_finished") connect("laundry_finished", handler, "_laundry_finished")
func interaction(selected, clicked): #selected = item in inventory, clicked = item in environment func interaction(selected, clicked): #selected = item in inventory, clicked = item in environment
......
extends Control extends Control
signal eaten
#UI elements #UI elements
onready var dialogue onready var dialogue
onready var energy_bar onready var energy_bar
...@@ -24,6 +26,7 @@ func giveUI(dia): #passes dialogue box node ...@@ -24,6 +26,7 @@ func giveUI(dia): #passes dialogue box node
func passEvent(handler): # retrieves energy bar from event handler func passEvent(handler): # retrieves energy bar from event handler
energy_bar = handler.give_energy_bar() energy_bar = handler.give_energy_bar()
connect("eaten",handler,"_eaten")
func _selected_ing(ingredient): # when an ingredient is selected func _selected_ing(ingredient): # when an ingredient is selected
ingredients.append(ingredient) ingredients.append(ingredient)
...@@ -98,6 +101,7 @@ func cook(): ...@@ -98,6 +101,7 @@ func cook():
energy_bar.value += 14 energy_bar.value += 14
3: 3:
energy_bar.value += 20 energy_bar.value += 20
emit_signal("eaten")
clearFridge() clearFridge()
cook.hide() cook.hide()
...@@ -109,4 +113,5 @@ func eat(): ...@@ -109,4 +113,5 @@ func eat():
energy_bar.value += 8 energy_bar.value += 8
"Granola bar": "Granola bar":
energy_bar.value += 10 energy_bar.value += 10
emit_signal("eaten")
clearFridge() clearFridge()
...@@ -104,7 +104,8 @@ func _enter_notebook_laundry(): ...@@ -104,7 +104,8 @@ func _enter_notebook_laundry():
dialogue.text = "The groceries are still in the way." dialogue.text = "The groceries are still in the way."
func _laundry_finished(): func _laundry_finished():
quests.remove(quests.find("Do laundry")) print("Finished laundry")
quests.finishQuest("Do laundry")
func _return_laundry_notepad(): func _return_laundry_notepad():
zoom_out() zoom_out()
...@@ -115,3 +116,6 @@ func _return_laundry_notepad(): ...@@ -115,3 +116,6 @@ func _return_laundry_notepad():
notepad.get_node("Title").text = "To do" notepad.get_node("Title").text = "To do"
notepad.get_node("Words").hide() notepad.get_node("Words").hide()
notepad.get_node("Words").clear() notepad.get_node("Words").clear()
func _eaten():
quests.finishQuest("Eat")
...@@ -51,6 +51,7 @@ __meta__ = { ...@@ -51,6 +51,7 @@ __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
interactable = true interactable = true
flavorText = "Something's in the way."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Laundry door"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Laundry door"]
position = Vector2( 5.63037, -53.6798 ) position = Vector2( 5.63037, -53.6798 )
...@@ -85,6 +86,7 @@ __meta__ = { ...@@ -85,6 +86,7 @@ __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
interactable = true interactable = true
flavorText = "Gotta put these away before they go bad or I trip on them. But legs... Too short... Can't reach pantry shelves... Why did I put them so high up anyway?"
[node name="CollisionShape2D" type="CollisionShape2D" parent="Groceries"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Groceries"]
position = Vector2( 4.11099, 2.53656 ) position = Vector2( 4.11099, 2.53656 )
...@@ -117,6 +119,7 @@ __meta__ = { ...@@ -117,6 +119,7 @@ __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
retrievable = true retrievable = true
flavorText = "A sturdy stool."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Stool"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Stool"]
position = Vector2( 1.25211, 0.295086 ) position = Vector2( 1.25211, 0.295086 )
......
...@@ -40,6 +40,9 @@ bg_color = Color( 0.145098, 0.145098, 0.164706, 1 ) ...@@ -40,6 +40,9 @@ bg_color = Color( 0.145098, 0.145098, 0.164706, 1 )
script = ExtResource( 4 ) script = ExtResource( 4 )
items = [ NodePath("Pants"), NodePath("Shirt"), NodePath("Sando"), NodePath("Towel"), NodePath("Laundry basket"), NodePath("Laptop"), NodePath("Pile of clothes") ] items = [ NodePath("Pants"), NodePath("Shirt"), NodePath("Sando"), NodePath("Towel"), NodePath("Laundry basket"), NodePath("Laptop"), NodePath("Pile of clothes") ]
[node name="Laundry basket" parent="Bedroom" index="1"]
position = Vector2( 492.444, 254.362 )
[node name="Kitchen" parent="." instance=ExtResource( 8 )] [node name="Kitchen" parent="." instance=ExtResource( 8 )]
visible = false visible = false
script = ExtResource( 4 ) script = ExtResource( 4 )
...@@ -69,7 +72,7 @@ items = [ NodePath("Washing machine door"), NodePath("Drawer"), NodePath("Soap") ...@@ -69,7 +72,7 @@ items = [ NodePath("Washing machine door"), NodePath("Drawer"), NodePath("Soap")
[node name="Event Handler" type="Node2D" parent="."] [node name="Event Handler" type="Node2D" parent="."]
position = Vector2( 460.602, 18.6417 ) position = Vector2( 460.602, 18.6417 )
script = ExtResource( 12 ) script = ExtResource( 12 )
eventItems = [ NodePath("../Laundry basket/To do list"), NodePath("../Bedroom/Laundry basket"), NodePath("../Laundry basket/Return"), NodePath("../Fridge/Return"), NodePath("../Kitchen/Fridge"), NodePath("../Laundry area/Groceries"), NodePath("../Fridge/Energy handler"), NodePath("../Laundry area/Dialogue control"), NodePath("../Laundry - Notepad/Return") ] eventItems = [ NodePath("../Laundry basket/To do list"), NodePath("../Bedroom/Laundry basket"), NodePath("../Laundry basket/Return"), NodePath("../Fridge/Return"), NodePath("../Kitchen/Fridge"), NodePath("../Laundry area/Groceries"), NodePath("../Fridge/Energy handler"), NodePath("../Laundry area/Dialogue control"), NodePath("../Laundry - Notepad/Return"), NodePath("../Laundry - Notepad/Dialogue control") ]
[node name="Moxie" type="Sprite" parent="."] [node name="Moxie" type="Sprite" parent="."]
position = Vector2( 214.135, 386.725 ) position = Vector2( 214.135, 386.725 )
......
...@@ -13,5 +13,16 @@ func add(q): ...@@ -13,5 +13,16 @@ func add(q):
quests.append(q) quests.append(q)
showQuests() showQuests()
func finishQuest(q):
var index = 0
print("trying to find quest to remove " + q)
for quest in quests:
if quest == q:
quests.remove(index)
print("Quest found, will remove")
showQuests()
index += 1
func showQuests(): func showQuests():
text = "- " + quests.join("\n- ") # prints all quests on the notepad text = "- " + quests.join("\n- ") # prints all quests on the notepad
#print(quests.join("\n- "))
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