Commit bddd80e3 authored by Julia Santos's avatar Julia Santos

Added pouring animation for plant notebook puzzle

parent 2d8740e0
[gd_scene load_steps=14 format=2] [gd_scene load_steps=16 format=2]
[ext_resource path="res://Item - Notepad.gd" type="Script" id=1] [ext_resource path="res://Item - Notepad.gd" type="Script" id=1]
[ext_resource path="res://Scripts/Dialogue control/Dialogue Contro - Living room notepad.gd" type="Script" id=2] [ext_resource path="res://Scripts/Dialogue control/Dialogue Contro - Living room notepad.gd" type="Script" id=2]
...@@ -6,9 +6,11 @@ ...@@ -6,9 +6,11 @@
[ext_resource path="res://assets/Thesis Clickables/plant (dirty).png" type="Texture" id=4] [ext_resource path="res://assets/Thesis Clickables/plant (dirty).png" type="Texture" id=4]
[ext_resource path="res://assets/Thesis Clickables/soil (sack).png" type="Texture" id=5] [ext_resource path="res://assets/Thesis Clickables/soil (sack).png" type="Texture" id=5]
[ext_resource path="res://assets/Thesis Clickables/tabo (with water).png" type="Texture" id=6] [ext_resource path="res://assets/Thesis Clickables/tabo (with water).png" type="Texture" id=6]
[ext_resource path="res://assets/Thesis Clickables/tabo (pour).png" type="Texture" id=8]
[ext_resource path="res://assets/Thesis Clickables/soil (pour).png" type="Texture" id=9]
[ext_resource path="res://assets/Thesis Clickables/pot.png" type="Texture" id=12] [ext_resource path="res://assets/Thesis Clickables/pot.png" type="Texture" id=12]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=7]
extents = Vector2( 26.4732, 26.6968 ) extents = Vector2( 26.4732, 26.6968 )
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
...@@ -39,8 +41,14 @@ __meta__ = { ...@@ -39,8 +41,14 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Soil Timer" type="Timer" parent="."]
one_shot = true
[node name="Water Timer" type="Timer" parent="."]
one_shot = true
[node name="Pot" type="StaticBody2D" parent="."] [node name="Pot" type="StaticBody2D" parent="."]
position = Vector2( 507.781, 421.656 ) position = Vector2( 403.429, 420.217 )
scale = Vector2( 0.6, 0.6 ) scale = Vector2( 0.6, 0.6 )
input_pickable = true input_pickable = true
script = ExtResource( 1 ) script = ExtResource( 1 )
...@@ -62,11 +70,11 @@ texture = ExtResource( 12 ) ...@@ -62,11 +70,11 @@ texture = ExtResource( 12 )
visible = false visible = false
position = Vector2( -16.8367, -2.11676 ) position = Vector2( -16.8367, -2.11676 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 1 ) shape = SubResource( 7 )
disabled = true disabled = true
[node name="Plant" type="StaticBody2D" parent="."] [node name="Plant" type="StaticBody2D" parent="."]
position = Vector2( 235.276, 191.611 ) position = Vector2( 151.95, 178.386 )
input_pickable = true input_pickable = true
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {
...@@ -91,13 +99,10 @@ shape = SubResource( 2 ) ...@@ -91,13 +99,10 @@ shape = SubResource( 2 )
disabled = true disabled = true
[node name="Soil" type="StaticBody2D" parent="."] [node name="Soil" type="StaticBody2D" parent="."]
position = Vector2( 717.488, 191.312 ) position = Vector2( 655.488, 194.312 )
scale = Vector2( 0.6, 0.6 ) scale = Vector2( 0.6, 0.6 )
input_pickable = true input_pickable = true
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
interactable = true interactable = true
flavorText = "Click soil" flavorText = "Click soil"
...@@ -116,14 +121,16 @@ polygon = PoolVector2Array( 322, -428.7, 322, -423.9, 351.3, -380, 407.5, -380, ...@@ -116,14 +121,16 @@ polygon = PoolVector2Array( 322, -428.7, 322, -423.9, 351.3, -380, 407.5, -380,
[node name="Sprite" type="Sprite" parent="Soil/Hitbox"] [node name="Sprite" type="Sprite" parent="Soil/Hitbox"]
texture = ExtResource( 5 ) texture = ExtResource( 5 )
[node name="Sprite2" type="Sprite" parent="Soil/Hitbox"]
visible = false
position = Vector2( -1280.71, 599.626 )
texture = ExtResource( 9 )
[node name="Water" type="StaticBody2D" parent="."] [node name="Water" type="StaticBody2D" parent="."]
position = Vector2( 840.953, 229.029 ) position = Vector2( 778.953, 232.029 )
scale = Vector2( 0.6, 0.6 ) scale = Vector2( 0.6, 0.6 )
input_pickable = true input_pickable = true
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
interactable = true interactable = true
flavorText = "Click water" flavorText = "Click water"
...@@ -142,6 +149,11 @@ polygon = PoolVector2Array( -36, -89.1, -36, -85.9, 45, -54.9, 45, -51.2, 76.2, ...@@ -142,6 +149,11 @@ polygon = PoolVector2Array( -36, -89.1, -36, -85.9, 45, -54.9, 45, -51.2, 76.2,
[node name="Sprite" type="Sprite" parent="Water/Hitbox"] [node name="Sprite" type="Sprite" parent="Water/Hitbox"]
texture = ExtResource( 6 ) texture = ExtResource( 6 )
[node name="Sprite2" type="Sprite" parent="Water/Hitbox"]
visible = false
position = Vector2( -1649.91, -578.146 )
texture = ExtResource( 8 )
[node name="Return" type="StaticBody2D" parent="."] [node name="Return" type="StaticBody2D" parent="."]
position = Vector2( 95.853, 523.599 ) position = Vector2( 95.853, 523.599 )
scale = Vector2( 0.829244, 0.829244 ) scale = Vector2( 0.829244, 0.829244 )
......
...@@ -133,7 +133,7 @@ polygon = PoolVector2Array( 116, -578.8, 116, -573.6, 171, -526.6, 171, -516, 17 ...@@ -133,7 +133,7 @@ polygon = PoolVector2Array( 116, -578.8, 116, -573.6, 171, -526.6, 171, -516, 17
texture = ExtResource( 2 ) texture = ExtResource( 2 )
[node name="Lab notes" type="StaticBody2D" parent="."] [node name="Lab notes" type="StaticBody2D" parent="."]
position = Vector2( 773.592, 486.021 ) position = Vector2( 766.25, 287.798 )
scale = Vector2( 0.829244, 0.829244 ) scale = Vector2( 0.829244, 0.829244 )
input_pickable = true input_pickable = true
script = ExtResource( 10 ) script = ExtResource( 10 )
...@@ -149,7 +149,6 @@ scale = Vector2( 0.09, 0.09 ) ...@@ -149,7 +149,6 @@ scale = Vector2( 0.09, 0.09 )
polygon = PoolVector2Array( 358.8, -395.2, 355.1, -385, 328, -198.3, 328, -176, 335.7, -20.7, 369.5, 120.6, 456, 295.7, 456, 304.2, 446.4, 325, 438.3, 325, -280, 527.2, -280, 515.3, -345, 385.4, -345, 381.4, -391, 235.5, -391, 230, -413, 97.8, -413, 85, -417.3, -68, -414.6, -68, -376.6, -317, -364.7, -317, 322.9, -415.2, 330.5, -418.8 ) polygon = PoolVector2Array( 358.8, -395.2, 355.1, -385, 328, -198.3, 328, -176, 335.7, -20.7, 369.5, 120.6, 456, 295.7, 456, 304.2, 446.4, 325, 438.3, 325, -280, 527.2, -280, 515.3, -345, 385.4, -345, 381.4, -391, 235.5, -391, 230, -413, 97.8, -413, 85, -417.3, -68, -414.6, -68, -376.6, -317, -364.7, -317, 322.9, -415.2, 330.5, -418.8 )
[node name="Sprite" type="Sprite" parent="Lab notes/Hitbox"] [node name="Sprite" type="Sprite" parent="Lab notes/Hitbox"]
scale = Vector2( 1, 1 )
texture = ExtResource( 6 ) texture = ExtResource( 6 )
[node name="h" type="CollisionShape2D" parent="Lab notes"] [node name="h" type="CollisionShape2D" parent="Lab notes"]
......
...@@ -11,6 +11,9 @@ onready var pot = get_parent().get_node("Pot/Hitbox/Sprite") ...@@ -11,6 +11,9 @@ onready var pot = get_parent().get_node("Pot/Hitbox/Sprite")
onready var soil = get_parent().get_node("Soil/Hitbox/Sprite") onready var soil = get_parent().get_node("Soil/Hitbox/Sprite")
onready var water = get_parent().get_node("Water/Hitbox/Sprite") onready var water = get_parent().get_node("Water/Hitbox/Sprite")
onready var soil_timer = get_parent().get_node("Soil Timer")
onready var water_timer = get_parent().get_node("Water Timer")
signal finished signal finished
# 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():
...@@ -24,10 +27,18 @@ func _ready(): ...@@ -24,10 +27,18 @@ func _ready():
#put more soil to hold pot in place #put more soil to hold pot in place
#water plant #water plant
func passEvent(handler): func passEvent(handler):
connect("finished", handler, "_plants_finished") connect("finished", handler, "_plants_finished")
soil_timer.connect("timeout", self, "_pour_soil")
water_timer.connect("timeout", self, "_pour_water")
func _pour_soil():
soil.get_parent().get_node("Sprite2").visible = false
soil.visible = true
func _pour_water():
water.get_parent().get_node("Sprite2").visible = false
water.visible = true
func interaction(selected, clicked): #selected = item in inventory, clicked = item in environment func interaction(selected, clicked): #selected = item in inventory, clicked = item in environment
match clicked: match clicked:
...@@ -68,6 +79,9 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it ...@@ -68,6 +79,9 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it
if potClean and soilIn and cleanRoots and soilCover and holding == "Water": if potClean and soilIn and cleanRoots and soilCover and holding == "Water":
emit_signal("finished") emit_signal("finished")
plant.set_texture(load("res://.import/plant (watered).png-1432f74ec050e030b17561d4d52275a6.stex")) plant.set_texture(load("res://.import/plant (watered).png-1432f74ec050e030b17561d4d52275a6.stex"))
water.get_parent().get_node("Sprite2").visible = true
water.visible = false
water_timer.start()
return "Hydration! Time to bring these outside for some sunlight." return "Hydration! Time to bring these outside for some sunlight."
elif holding == "Soil" and plantIn: elif holding == "Soil" and plantIn:
return "I need to put it in the pot, not on the leaves!" return "I need to put it in the pot, not on the leaves!"
...@@ -118,24 +132,31 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it ...@@ -118,24 +132,31 @@ func interaction(selected, clicked): #selected = item in inventory, clicked = it
soilIn = true soilIn = true
soil.position.y += 10 soil.position.y += 10
pot.set_texture(load("res://.import/pot (with soil).png-232052a26ec16c2b0ec251e8c34bb9fa.stex")) pot.set_texture(load("res://.import/pot (with soil).png-232052a26ec16c2b0ec251e8c34bb9fa.stex"))
soil.get_parent().get_node("Sprite2").visible = true
soil.visible = false
soil_timer.start()
return "Soil in pot, just need to cover it up now" return "Soil in pot, just need to cover it up now"
elif !potClean: # trying to put soil in dirty pot elif !potClean: # trying to put soil in dirty pot
return "I don't know what's in there" return "I don't know what's in there"
elif soilIn and !soilCover: elif soilIn and !soilCover and plantIn:
soilCover = true soilCover = true
plantIn = true #plantIn = true
holding = "" holding = ""
soil.position.y += 10 soil.position.y += 10
plant.set_texture(load("res://.import/plant (with soil).png-e034b9e1c0cc7dd66db5f2a9e2682c41.stex")) plant.set_texture(load("res://.import/plant (with soil).png-e034b9e1c0cc7dd66db5f2a9e2682c41.stex"))
soil.get_parent().get_node("Sprite2").visible = true
soil.visible = false
soil_timer.start()
return "Now that's nice and covered" return "Now that's nice and covered"
else: # putting soil in already-filled pot else: # putting soil in already-filled pot
return "That's enough soil" return "That's enough soil"
"Plant": "Plant":
if soilIn and cleanRoots: # putting plant in the new pot if soilIn and cleanRoots: # putting plant in the new pot
holding = "" holding = ""
get_parent().get_node("Plant").position = Vector2(520.994,255.829) get_parent().get_node("Plant").position = Vector2(412.459,251.065)
#original: (276.321, 282.901) #original: (276.321, 282.901)
#new: (523.994,255.829) #new: (412.459,251.065)
plantIn = true
return "Plant in pot" return "Plant in pot"
elif !cleanRoots: elif !cleanRoots:
return "I need to clean the roots!" return "I need to clean the roots!"
......
...@@ -179,10 +179,10 @@ scale = Vector2( 0.197539, 0.197539 ) ...@@ -179,10 +179,10 @@ scale = Vector2( 0.197539, 0.197539 )
polygon = PoolVector2Array( -79, -406.4, -79, -171, 453.4, -171, 469, -163.2, 469, -155, 471, 161, 460.2, 161, -79, 170.8, -79, 411.2, -122, 414.9, -122, 405.6, -447.7, 0.399994, -442.3, -11, -439.7, -11, -110, -414.5, -110, -418.5, -98.1, -423.8 ) polygon = PoolVector2Array( -79, -406.4, -79, -171, 453.4, -171, 469, -163.2, 469, -155, 471, 161, 460.2, 161, -79, 170.8, -79, 411.2, -122, 414.9, -122, 405.6, -447.7, 0.399994, -442.3, -11, -439.7, -11, -110, -414.5, -110, -418.5, -98.1, -423.8 )
[node name="Sprite" type="Sprite" parent="Return/Hitbox"] [node name="Sprite" type="Sprite" parent="Return/Hitbox"]
scale = Vector2( 1, 1 )
texture = SubResource( 5 ) texture = SubResource( 5 )
[node name="Cook" type="StaticBody2D" parent="."] [node name="Cook" type="StaticBody2D" parent="."]
visible = false
position = Vector2( 444.529, 412.172 ) position = Vector2( 444.529, 412.172 )
scale = Vector2( 0.8, 0.8 ) scale = Vector2( 0.8, 0.8 )
input_pickable = true input_pickable = true
...@@ -205,10 +205,10 @@ scale = Vector2( 0.197539, 0.197539 ) ...@@ -205,10 +205,10 @@ scale = Vector2( 0.197539, 0.197539 )
polygon = PoolVector2Array( 315, -270, 315, -260.9, 347, -173.8, 347, -167.9, 357.9, -43, 354.1, -43, 313, 142, 309.9, 142, 211.9, 320, -415, 320, -415, 310.7, -423.9, 284, -415, 284, -329, 125.4, -329, 123.5, -294, 10.3, -294, 5.60001, -286.3, -98.1, -321, -245.8, -321, -255.5, -311, -264.4, -311, -271 ) polygon = PoolVector2Array( 315, -270, 315, -260.9, 347, -173.8, 347, -167.9, 357.9, -43, 354.1, -43, 313, 142, 309.9, 142, 211.9, 320, -415, 320, -415, 310.7, -423.9, 284, -415, 284, -329, 125.4, -329, 123.5, -294, 10.3, -294, 5.60001, -286.3, -98.1, -321, -245.8, -321, -255.5, -311, -264.4, -311, -271 )
[node name="Sprite" type="Sprite" parent="Cook/Hitbox"] [node name="Sprite" type="Sprite" parent="Cook/Hitbox"]
scale = Vector2( 1, 1 )
texture = ExtResource( 11 ) texture = ExtResource( 11 )
[node name="Eat" type="StaticBody2D" parent="."] [node name="Eat" type="StaticBody2D" parent="."]
visible = false
position = Vector2( 554.764, 481.494 ) position = Vector2( 554.764, 481.494 )
scale = Vector2( 0.8, 0.8 ) scale = Vector2( 0.8, 0.8 )
input_pickable = true input_pickable = true
......
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