Commit 4c0f341d authored by Julia Santos's avatar Julia Santos

Cutscene now plays if player doesnt use notebook on laundry puzzle

parent 4129c688
extends StaticBody2D
onready var sceneProgress = 0
onready var dialogueBox = get_parent().get_node("Dialogue")
onready var tracking = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input(event): # executes when clicked on
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print("Clicked")
if tracking:
dialogueBox.text = getDialogue()
func getDialogue():
match sceneProgress:
0:
sceneProgress += 1
return "Dialogue 2"
1:
sceneProgress += 1
return "Dialogue 3"
2:
sceneProgress += 1
return "Dialogue 4"
3:
sceneProgress = 0
get_parent().hide()
tracking = false
return "Dialogue 1"
func start():
tracking = true
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Cutscenes/Cutscene 1.gd" type="Script" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 515.38, 299.307 )
[node name="Node2D" type="Node2D"]
[node name="Panel" type="Panel" parent="."]
margin_left = -15.0
margin_top = -13.0
margin_right = 1047.0
margin_bottom = 628.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
margin_left = 101.975
margin_top = 61.2005
margin_right = 238.975
margin_bottom = 143.2
rect_scale = Vector2( 6, 6 )
text = "Cutscene 1"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Dialogue" type="Label" parent="."]
margin_left = 293.916
margin_top = 382.225
margin_right = 430.916
margin_bottom = 464.225
rect_scale = Vector2( 3, 3 )
text = "Dialogue 1"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Scene control" type="StaticBody2D" parent="."]
input_pickable = true
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Scene control"]
position = Vector2( 511.03, 299.848 )
shape = SubResource( 1 )
...@@ -14,6 +14,8 @@ onready var energy = get_parent().get_node("UI/Energy bar") ...@@ -14,6 +14,8 @@ 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") # not a UI element, just the node that handles the left/right movement between rooms 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
onready var cutsceneHandler = get_parent().get_node("Cutscenes") # node that has all the cutscenes under it
#rooms #rooms
onready var bedroom = get_parent().get_node("Bedroom") onready var bedroom = get_parent().get_node("Bedroom")
onready var bathroom = get_parent().get_node("Bathroom") onready var bathroom = get_parent().get_node("Bathroom")
...@@ -121,7 +123,15 @@ func getClean(): # returns the number of objects that have been cleaned ...@@ -121,7 +123,15 @@ func getClean(): # returns the number of objects that have been cleaned
func _foundBanana(): # keeps track that Banana has been spotted on the balcony func _foundBanana(): # keeps track that Banana has been spotted on the balcony
foundBanana = true foundBanana = true
# ----------------- Cutscene initiators -----------------
func _start_cutscene_1():
cutsceneHandler.get_node("1").show()
cutsceneHandler.get_node("1/Scene control").start()
# ----------------- Notebook puzzle events ----------------- # ----------------- Notebook puzzle events -----------------
func getGroceries():
return groceries
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"):
return "Let me let the washing machine do its thing." return "Let me let the washing machine do its thing."
......
[gd_scene load_steps=11 format=2] [gd_scene load_steps=12 format=2]
[ext_resource path="res://assets/Placeholder BGs/laundry area.png" type="Texture" id=1] [ext_resource path="res://assets/Placeholder BGs/laundry area.png" type="Texture" id=1]
[ext_resource path="res://Item.gd" type="Script" id=2] [ext_resource path="res://Item.gd" type="Script" id=2]
[ext_resource path="res://assets/Thesis Clickables/stool.png" type="Texture" id=3] [ext_resource path="res://assets/Thesis Clickables/stool.png" type="Texture" id=3]
[ext_resource path="res://Scripts/Laundry door.gd" type="Script" id=4]
[ext_resource path="res://Scripts/Dialogue control/Dialogue control - Laundry area.gd" type="Script" id=5] [ext_resource path="res://Scripts/Dialogue control/Dialogue control - Laundry area.gd" type="Script" id=5]
[ext_resource path="res://Scripts/Groceries.gd" type="Script" id=6] [ext_resource path="res://Scripts/Groceries.gd" type="Script" id=6]
...@@ -46,9 +47,9 @@ __meta__ = { ...@@ -46,9 +47,9 @@ __meta__ = {
position = Vector2( 344.39, 310.696 ) position = Vector2( 344.39, 310.696 )
scale = Vector2( 0.829244, 0.829244 ) scale = Vector2( 0.829244, 0.829244 )
input_pickable = true input_pickable = true
script = ExtResource( 2 ) script = ExtResource( 4 )
interactable = true interactable = true
flavorText = "Something's in the way." flavorText = "I can't get in there. These bags are in the way..."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Laundry door"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Laundry door"]
position = Vector2( 5.806, -53.2112 ) position = Vector2( 5.806, -53.2112 )
......
[gd_scene load_steps=33 format=2] [gd_scene load_steps=34 format=2]
[ext_resource path="res://Main rooms/Test room 1.tscn" type="PackedScene" id=1] [ext_resource path="res://Main rooms/Test room 1.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/189066690_228150108704696_3850052974465333899_n.png" type="Texture" id=2] [ext_resource path="res://assets/189066690_228150108704696_3850052974465333899_n.png" type="Texture" id=2]
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
[ext_resource path="res://Event Handler.gd" type="Script" id=12] [ext_resource path="res://Event Handler.gd" type="Script" id=12]
[ext_resource path="res://Special views/Laundry basket.tscn" type="PackedScene" id=13] [ext_resource path="res://Special views/Laundry basket.tscn" type="PackedScene" id=13]
[ext_resource path="res://Main rooms/Laundry area.tscn" type="PackedScene" id=14] [ext_resource path="res://Main rooms/Laundry area.tscn" type="PackedScene" id=14]
[ext_resource path="res://Cutscenes/Cutscene 1.tscn" type="PackedScene" id=15]
[ext_resource path="res://To do hitbox.gd" type="Script" id=16] [ext_resource path="res://To do hitbox.gd" type="Script" id=16]
[ext_resource path="res://Special views/Fridge.tscn" type="PackedScene" id=17] [ext_resource path="res://Special views/Fridge.tscn" type="PackedScene" id=17]
[ext_resource path="res://Laundry - Notepad.tscn" type="PackedScene" id=18] [ext_resource path="res://Laundry - Notepad.tscn" type="PackedScene" id=18]
...@@ -135,7 +136,7 @@ items = [ NodePath("Nana from afar"), NodePath("Other balcony"), NodePath("Balco ...@@ -135,7 +136,7 @@ items = [ NodePath("Nana from afar"), NodePath("Other balcony"), NodePath("Balco
[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"), NodePath("../Laundry - Notepad/Dialogue control"), NodePath("../Bedroom/Bathroom door"), NodePath("../Bathroom/Door - to Bedroom"), NodePath("../Living room/Balcony door"), NodePath("../Balcony/Door to living room"), NodePath("../Living room/Front door"), NodePath("../Hallway/Door to Moxie"), NodePath("../Hallway/Door to neighbor"), NodePath("../Neighbor\'s room/Neighbor to hallway"), NodePath("../Neighbor\'s balcony/Balcony to neighbor\'s room"), NodePath("../Neighbor\'s room/Neighbor to balcony"), NodePath("../Bedroom/Laptop"), NodePath("../Desk/Return"), NodePath("../Inside cabinet/Return"), NodePath("../Kitchen/Cabinet"), NodePath("../Desk/Laptop"), NodePath("../Bedroom/Terrarium"), NodePath("../Bathroom/Lab Note - Bathroom"), NodePath("../Inside cabinet/Lab notes"), NodePath("../Living room/Lab notes"), NodePath("../Bedroom/Pants"), NodePath("../Bedroom/Shirt"), NodePath("../Bedroom/Sando"), NodePath("../Bedroom/Towel"), NodePath("../Bathroom/Sink"), NodePath("../Bathroom/Toilet"), NodePath("../Bathroom/Mirror"), NodePath("../Bathroom/Mess on floor"), NodePath("../Hallway/Trash chute") ] 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/Laundry door"), NodePath("../Laundry - Notepad/Return"), NodePath("../Laundry - Notepad/Dialogue control"), NodePath("../Bedroom/Bathroom door"), NodePath("../Bathroom/Door - to Bedroom"), NodePath("../Living room/Balcony door"), NodePath("../Balcony/Door to living room"), NodePath("../Living room/Front door"), NodePath("../Hallway/Door to Moxie"), NodePath("../Hallway/Door to neighbor"), NodePath("../Neighbor\'s room/Neighbor to hallway"), NodePath("../Neighbor\'s balcony/Balcony to neighbor\'s room"), NodePath("../Neighbor\'s room/Neighbor to balcony"), NodePath("../Bedroom/Laptop"), NodePath("../Desk/Return"), NodePath("../Inside cabinet/Return"), NodePath("../Kitchen/Cabinet"), NodePath("../Desk/Laptop"), NodePath("../Bedroom/Terrarium"), NodePath("../Bathroom/Lab Note - Bathroom"), NodePath("../Inside cabinet/Lab notes"), NodePath("../Living room/Lab notes"), NodePath("../Bedroom/Pants"), NodePath("../Bedroom/Shirt"), NodePath("../Bedroom/Sando"), NodePath("../Bedroom/Towel"), NodePath("../Bathroom/Sink"), NodePath("../Bathroom/Toilet"), NodePath("../Bathroom/Mirror"), NodePath("../Bathroom/Mess on floor"), NodePath("../Hallway/Trash chute") ]
[node name="Moxie" type="Sprite" parent="."] [node name="Moxie" type="Sprite" parent="."]
position = Vector2( 214.135, 386.725 ) position = Vector2( 214.135, 386.725 )
...@@ -324,6 +325,12 @@ __meta__ = { ...@@ -324,6 +325,12 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Cutscenes" type="Node2D" parent="."]
z_index = 2
[node name="1" parent="Cutscenes" instance=ExtResource( 15 )]
visible = false
[connection signal="pressed" from="UI/Button" to="UI/Inventory" method="_on_Button_pressed"] [connection signal="pressed" from="UI/Button" to="UI/Inventory" method="_on_Button_pressed"]
[editable path="Bedroom"] [editable path="Bedroom"]
......
...@@ -9,11 +9,11 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it ...@@ -9,11 +9,11 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it
match clicked: match clicked:
"Laundry door": "Laundry door":
match selected: match selected:
"To do list": #"To do list":
#emit_signal("notebook_laundry") #emit_signal("notebook_laundry")
return eventHandler._enter_notebook_laundry() #return eventHandler._enter_notebook_laundry()
"Towel", "Shirt", "Pants", "Sando": "Dirty clothes", "Laundry detergent":
return "I'm not sure how to start this." return "I'm not sure how to start this. What did my therapist say again..?"
_: _:
"The groceries are still in the way." "The groceries are still in the way."
"Groceries": "Groceries":
......
extends StaticBody2D extends "res://Item.gd"
signal notebook_puzzle
signal cutscene
# Declare member variables here. Examples: onready var start = true
# var a = 2 onready var eventHandler
# var b = "text"
# 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("notebook_puzzle", handler,"_enter_notebook_laundry")
connect("cutscene",handler,"_start_cutscene_1")
eventHandler = handler
func mouseInteraction():
if start and eventHandler.get_clothes() == 4 and eventHandler.getGroceries():
emit_signal("cutscene")
start = false
elif eventHandler.get_clothes() != 4 and eventHandler.getGroceries():
dialogueBox.text = "I still need to get all my clothes!"
else:
.mouseInteraction()
func objInteraction(selected): # when an object is used on it
var flavor = control.interaction(inventory.get_item_text(selected), self.get_name())
if inventory.get_item_text(selected) == "To do list":
emit_signal("notebook_puzzle")
elif inventory.get_item_text(selected) == "Dirty clothes" or inventory.get_item_text(selected) == "Laundry detergent":
# if they try using the dirty clothes or the laundry detergent when engaging for the first time
if start and eventHandler.get_clothes() == 4 and eventHandler.getGroceries(): # play cutscene if it hasnt yet & they have all the clothes
emit_signal("cutscene")
start = false
else: # if its either not the start or they dont have enough clothes
if eventHandler.get_clothes() !=4: # if its bc they dont have enough clothes
dialogueBox.text = "I still need to get all my clothes!"
elif !eventHandler.getGroceries(): # if its bc the groceries are still there
dialogueBox.text = "There's something in the way."
else: # if its bc they already saw the cutscene
dialogueBox.text = flavor
elif typeof(flavor) != 0: #checks if there's coded flavor text for this interaction
dialogueBox.text = flavor
else:
dialogueBox.text = "No flavor text found" #can replace this later!
inventory.unselect_all() #unselect item
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
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