Commit fc6a18c3 authored by Julia Santos's avatar Julia Santos

Added inside of fridge, edited movement handling a bit

parent 8465ee8f
source_md5="0d3bfd8451d3ba07a3e13a1dc2aa2483"
dest_md5="425d6b9a8b5447289ad131e8c67e0176"
source_md5="13bdbb388fb0f22e0e13042f5c21f5ee"
dest_md5="ef329ebe9461d6519dd37230e390fe5c"
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func interaction(selected, clicked): #selected = item in inventory, clicked = item in environment
match clicked:
"Laundry door":
return "The groceries are still in the way."
"Groceries":
match selected:
"Stool":
return "This apartment was made for tall people. Sigh.\n(You put your groceries away on the shelf.)"
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
extends Node2D extends Node2D
#UI elements #UI elements
onready var quests = 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 right = get_parent().get_node("UI/Right")
onready var inventory = get_parent().get_node("UI/Inventory")
onready var deselect = get_parent().get_node("UI/Button")
#rooms #rooms
onready var bedroom = get_parent().get_node("Bedroom") onready var bedroom = get_parent().get_node("Bedroom")
onready var kitchen = get_parent().get_node("Kitchen") onready var kitchen = get_parent().get_node("Kitchen")
onready var laundryBasket = get_parent().get_node("Laundry basket") onready var laundryBasket = get_parent().get_node("Laundry basket")
onready var fridge = get_parent().get_node("Fridge")
#functioning stuff
onready var quests = notepad.get_node("Quests")
#items in the rooms that need access to the event handler #items in the rooms that need access to the event handler
export(Array, NodePath) onready var eventItems export(Array, NodePath) onready var eventItems
# Declare member variables here. Examples:
# var a = 2
# 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():
quests.hide() notepad.hide()
for item in eventItems: for item in eventItems:
get_node(item).passEvent(self) get_node(item).passEvent(self)
connect_stools() connect_stools()
func zoom_in():
moxie.hide()
inventory.hide()
left.hide()
right.hide()
deselect.hide()
func zoom_out():
moxie.show()
inventory.show()
get_parent().get_node("UI/Movement Handler").check_arrows()
deselect.show()
func _get_notebook(): func _get_notebook():
quests.show() notepad.show()
right.show()
_return_laundry()
quests.add("Eat")
quests.add("Put away groceries")
func _laundry_basket(): func _laundry_basket():
bedroom.hide() bedroom.hide()
laundryBasket.show() laundryBasket.show()
moxie.hide() zoom_in()
func _return_laundry(): func _return_laundry():
laundryBasket.hide() laundryBasket.hide()
bedroom.show() bedroom.show()
moxie.show() zoom_out()
func _return_fridge():
fridge.hide()
kitchen.show()
zoom_out()
func _open_fridge():
kitchen.hide()
fridge.show()
zoom_in()
notepad.hide()
func connect_stools(): func connect_stools():
get_parent().get_node("Laundry area/Stool").giveStool(get_parent().get_node("Kitchen/Stool")) get_parent().get_node("Laundry area/Stool").giveStool(get_parent().get_node("Kitchen/Stool"))
......
extends "res://Item.gd"
signal fridge_opened
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func mouseInteraction():
emit_signal("fridge_opened")
func passEvent(handler):
connect("fridge_opened", handler,"_open_fridge")
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
[gd_scene load_steps=14 format=2]
[ext_resource path="res://assets/Thesis Clickables/bread.png" type="Texture" id=1]
[ext_resource path="res://assets/Thesis Clickables/eggs.png" type="Texture" id=2]
[ext_resource path="res://assets/Placeholder BGs/ref inside.png" type="Texture" id=3]
[ext_resource path="res://Item.gd" type="Script" id=4]
[ext_resource path="res://assets/Thesis Clickables/Vienna sausage.png" type="Texture" id=5]
[ext_resource path="res://assets/Thesis Clickables/Granola bar.png" type="Texture" id=6]
[ext_resource path="res://Return_fridge.gd" type="Script" id=7]
[ext_resource path="res://Energy handler.gd" type="Script" id=8]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 14.2862, 14.7497 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 18.5502, 12.9308 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 9.26066, 9.03523 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 17.4279, 15.7667 )
[sub_resource type="StreamTexture" id=5]
flags = 4
load_path = "res://.import/return arrow.png-ba7c2fea6c5a220a249845f29bbe9177.stex"
[node name="Fridge" type="Node2D"]
[node name="ref inside" type="Sprite" parent="."]
position = Vector2( 500.359, 301.578 )
scale = Vector2( 0.82677, 0.826769 )
texture = ExtResource( 3 )
__meta__ = {
"_edit_lock_": true
}
[node name="Dialogue control" type="Control" parent="."]
margin_left = 902.817
margin_top = 254.199
margin_right = 942.817
margin_bottom = 294.199
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Energy handler" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Bread" type="StaticBody2D" parent="."]
position = Vector2( 902.817, 254.199 )
input_pickable = true
script = ExtResource( 4 )
__meta__ = {
"_edit_group_": true
}
interactable = true
flavorText = "Goes with anything. Almost as good as rice."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bread"]
position = Vector2( -0.433167, 2.2196 )
scale = Vector2( 5, 5 )
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Bread/CollisionShape2D"]
position = Vector2( 0.29126, 1.03033 )
scale = Vector2( 0.0327145, 0.0327145 )
texture = ExtResource( 1 )
[node name="Egg" type="StaticBody2D" parent="."]
position = Vector2( 649.603, 329.114 )
input_pickable = true
script = ExtResource( 4 )
__meta__ = {
"_edit_group_": true
}
interactable = true
flavorText = "Tastes egg-celent on its own or on a sandwich. Hehe."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Egg"]
position = Vector2( -0.433167, 2.2196 )
scale = Vector2( 5, 5 )
shape = SubResource( 2 )
[node name="Sprite" type="Sprite" parent="Egg/CollisionShape2D"]
position = Vector2( 0.59082, -0.168335 )
scale = Vector2( 0.0381084, 0.0381084 )
texture = ExtResource( 2 )
[node name="Granola bar" type="StaticBody2D" parent="."]
position = Vector2( 489.284, 336.606 )
input_pickable = true
script = ExtResource( 4 )
__meta__ = {
"_edit_group_": true
}
interactable = true
flavorText = "Crunchy. But not as filling. And very hard to open."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Granola bar"]
position = Vector2( -0.433167, 2.2196 )
scale = Vector2( 5, 5 )
shape = SubResource( 3 )
[node name="Sprite" type="Sprite" parent="Granola bar/CollisionShape2D"]
position = Vector2( 0.141357, -0.408264 )
scale = Vector2( 0.0905492, 0.088454 )
texture = ExtResource( 6 )
[node name="Vienna sausage" type="StaticBody2D" parent="."]
position = Vector2( 349.941, 321.623 )
input_pickable = true
script = ExtResource( 4 )
__meta__ = {
"_edit_group_": true
}
interactable = true
flavorText = "Ready-to-eat, but I prefer them fried."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Vienna sausage"]
position = Vector2( -0.433167, 2.2196 )
scale = Vector2( 5, 5 )
shape = SubResource( 3 )
[node name="Sprite" type="Sprite" parent="Vienna sausage/CollisionShape2D"]
position = Vector2( -0.158325, 0.281189 )
scale = Vector2( 0.129505, 0.126509 )
texture = ExtResource( 5 )
[node name="Return" type="StaticBody2D" parent="."]
position = Vector2( 90.831, 522.315 )
scale = Vector2( 0.8, 0.8 )
input_pickable = true
script = ExtResource( 7 )
__meta__ = {
"_edit_group_": true
}
interactable = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Return"]
position = Vector2( -2.31012, 0.749359 )
scale = Vector2( 5, 5 )
shape = SubResource( 4 )
[node name="Sprite" type="Sprite" parent="Return/CollisionShape2D"]
position = Vector2( -0.670166, 0.427979 )
scale = Vector2( 0.0395079, 0.0395079 )
texture = SubResource( 5 )
...@@ -6,80 +6,18 @@ ...@@ -6,80 +6,18 @@
[ext_resource path="res://Dialogue control - Kitchen.gd" type="Script" id=4] [ext_resource path="res://Dialogue control - Kitchen.gd" type="Script" id=4]
[ext_resource path="res://assets/Thesis Clickables/stool.png" type="Texture" id=5] [ext_resource path="res://assets/Thesis Clickables/stool.png" type="Texture" id=5]
[ext_resource path="res://Stool.gd" type="Script" id=6] [ext_resource path="res://Stool.gd" type="Script" id=6]
[ext_resource path="res://Fridge.gd" type="Script" id=7]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
[sub_resource type="GDScript" id=2] [sub_resource type="RectangleShape2D" id=2]
script/source = "extends StaticBody2D
#UI stuff
onready var dialogueBox
onready var inventory
onready var quests
#variables that are editable in the Inspector
export(bool) var retrievable # check if this item can be placed in the inventory
export(bool) var interactable # for environmental objects that are interactable but not retrievable
export(String) var flavorText # the flavor text that appears in the dialogue box when picked up
onready var control = get_parent().get_node(\"Dialogue control\")
#other variables
onready var texture = get_node(\"CollisionShape2D/Sprite\").get_texture()
# some references
# https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_exports.html
# https://padamthapa.com/blog/how-to-detect-click-inside-staticbody2d-in-godot/
func _ready():
pass
func passUI(inv, dia, que): #passes the inventory and dialogue box from the parent scene to the item in the instanced scene
inventory = inv
dialogueBox = dia
quests = que
print(\"Found \" + dialogueBox.get_name())
func _input_event(viewport, event, shape_idx): # executes when clicked on
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
#print(\"Clicked on \" + self.get_name() + \" with selected \" + str(inventory.is_anything_selected()))
if inventory.is_anything_selected() and interactable: # if the player has an item selected and they use it on something interactable
objInteraction(inventory.get_selected_items()[0])
elif inventory.is_anything_selected() and retrievable: # use object on something retrievable
objInteraction(inventory.get_selected_items()[0])
elif !inventory.is_anything_selected() and retrievable: # if they click on something retrievable w/ empty hands
pickup()
elif interactable: #for environment things that arent retrievable, and hands are empty
mouseInteraction()
func mouseInteraction(): # just clicked on it with nothing
dialogueBox.text = flavorText
func pickup(): # when it's picked up
dialogueBox.text = flavorText
inventory.add_item(self.get_name(), texture)
queue_free()
inventory.unselect_all()
func objInteraction(selected): # when an object is used on it
var flavor = control.interaction(inventory.get_item_text(selected), self.get_name())
if 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
"
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 28.2389, 45.0754 ) extents = Vector2( 28.2389, 45.0754 )
[sub_resource type="StreamTexture" id=4] [sub_resource type="StreamTexture" id=3]
flags = 4 flags = 4
load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex" load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex"
[sub_resource type="RectangleShape2D" id=5] [sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 15.4169, 13.9691 ) extents = Vector2( 15.4169, 13.9691 )
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
...@@ -117,23 +55,22 @@ texture = ExtResource( 2 ) ...@@ -117,23 +55,22 @@ texture = ExtResource( 2 )
position = Vector2( 744.289, 314.826 ) position = Vector2( 744.289, 314.826 )
scale = Vector2( 0.829244, 0.829244 ) scale = Vector2( 0.829244, 0.829244 )
input_pickable = true input_pickable = true
script = SubResource( 2 ) script = ExtResource( 7 )
__meta__ = { __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
interactable = true interactable = true
flavorText = "I'm gonna munch. I'm gonna crunch."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Fridge"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Fridge"]
position = Vector2( 1.25211, 0.295086 ) position = Vector2( 1.25211, 0.295086 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 3 ) shape = SubResource( 2 )
[node name="Sprite" type="Sprite" parent="Fridge/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Fridge/CollisionShape2D"]
visible = false visible = false
position = Vector2( -0.158181, -0.0184715 ) position = Vector2( -0.158181, -0.0184715 )
scale = Vector2( 0.101337, 0.101337 ) scale = Vector2( 0.101337, 0.101337 )
texture = SubResource( 4 ) texture = SubResource( 3 )
[node name="Stool" type="StaticBody2D" parent="."] [node name="Stool" type="StaticBody2D" parent="."]
position = Vector2( 112.641, 527.75 ) position = Vector2( 112.641, 527.75 )
...@@ -149,7 +86,7 @@ flavorText = "A sturdy stool." ...@@ -149,7 +86,7 @@ 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 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 5 ) shape = SubResource( 4 )
[node name="Sprite" type="Sprite" parent="Stool/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Stool/CollisionShape2D"]
visible = false visible = false
......
[gd_scene load_steps=10 format=2] [gd_scene load_steps=11 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://Stool.gd" type="Script" id=4] [ext_resource path="res://Stool.gd" type="Script" id=4]
[ext_resource path="res://Dialogue control - Laundry area.gd" type="Script" id=5]
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 32.8504, 48.713 ) extents = Vector2( 32.8504, 37.878 )
[sub_resource type="StreamTexture" id=3] [sub_resource type="StreamTexture" id=2]
flags = 4 flags = 4
load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex" load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex"
[sub_resource type="RectangleShape2D" id=5] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 16.7582, 15.6005 ) extents = Vector2( 16.7582, 15.6005 )
[sub_resource type="StreamTexture" id=6] [sub_resource type="StreamTexture" id=4]
flags = 4 flags = 4
load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex" load_path = "res://.import/placeholder item.png-cd6e4c1231156687d87915032ec4361d.stex"
[sub_resource type="RectangleShape2D" id=8] [sub_resource type="RectangleShape2D" id=5]
extents = Vector2( 15.4169, 13.9691 ) extents = Vector2( 15.4169, 13.9691 )
[node name="Laundry area" type="Node2D"] [node name="Laundry area" type="Node2D"]
...@@ -35,6 +36,7 @@ __meta__ = { ...@@ -35,6 +36,7 @@ __meta__ = {
[node name="Dialogue control" type="Control" parent="."] [node name="Dialogue control" type="Control" parent="."]
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
script = ExtResource( 5 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
...@@ -44,22 +46,19 @@ position = Vector2( 322.984, 296.426 ) ...@@ -44,22 +46,19 @@ position = Vector2( 322.984, 296.426 )
scale = Vector2( 0.829244, 0.829244 ) scale = Vector2( 0.829244, 0.829244 )
input_pickable = true input_pickable = true
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true
}
interactable = true interactable = true
flavorText = "I can't get in there. These bags are 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( 4.11099, 2.53656 ) position = Vector2( 5.63037, -53.6798 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 2 ) shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Laundry door/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Laundry door/CollisionShape2D"]
visible = false visible = false
position = Vector2( -0.186829, 0.46521 ) position = Vector2( -0.186829, 0.46521 )
scale = Vector2( 0.163649, 0.163649 ) scale = Vector2( 0.163649, 0.163649 )
texture = SubResource( 3 ) texture = SubResource( 2 )
[node name="Label" type="Label" parent="Laundry door"] [node name="Label" type="Label" parent="Laundry door"]
visible = false visible = false
...@@ -83,17 +82,17 @@ __meta__ = { ...@@ -83,17 +82,17 @@ __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
interactable = true interactable = true
flavorText = "Might trip on these." flavorText = "Might trip on these. 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 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 5 ) shape = SubResource( 3 )
[node name="Sprite" type="Sprite" parent="Groceries/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Groceries/CollisionShape2D"]
position = Vector2( -0.186829, 0.46521 ) position = Vector2( -0.186829, 0.46521 )
scale = Vector2( 0.163649, 0.163649 ) scale = Vector2( 0.163649, 0.163649 )
texture = SubResource( 6 ) texture = SubResource( 4 )
[node name="Label" type="Label" parent="Groceries"] [node name="Label" type="Label" parent="Groceries"]
margin_left = -74.0 margin_left = -74.0
...@@ -121,7 +120,7 @@ flavorText = "A sturdy stool." ...@@ -121,7 +120,7 @@ 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 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 8 ) shape = SubResource( 5 )
[node name="Sprite" type="Sprite" parent="Stool/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Stool/CollisionShape2D"]
visible = false visible = false
......
...@@ -48,7 +48,7 @@ scale = Vector2( 0.0395079, 0.0395079 ) ...@@ -48,7 +48,7 @@ scale = Vector2( 0.0395079, 0.0395079 )
texture = SubResource( 2 ) texture = SubResource( 2 )
[node name="Return" type="StaticBody2D" parent="."] [node name="Return" type="StaticBody2D" parent="."]
position = Vector2( 89.3327, 397.956 ) position = Vector2( 83.9933, 526.1 )
scale = Vector2( 0.8, 0.8 ) scale = Vector2( 0.8, 0.8 )
input_pickable = true input_pickable = true
script = ExtResource( 4 ) script = ExtResource( 4 )
......
...@@ -18,6 +18,7 @@ func _pressedRight(): # when right arrow is clicked, move to the next adjacent s ...@@ -18,6 +18,7 @@ func _pressedRight(): # when right arrow is clicked, move to the next adjacent s
right.hide() right.hide()
if current >= 1: if current >= 1:
left.show() left.show()
print("Currently in room " + str(current) + ": " + rooms[current].get_name())
func _pressedLeft(): # when left arrow is clicked, move to the next adjacent screen func _pressedLeft(): # when left arrow is clicked, move to the next adjacent screen
if(current != 0): if(current != 0):
...@@ -28,4 +29,10 @@ func _pressedLeft(): # when left arrow is clicked, move to the next adjacent scr ...@@ -28,4 +29,10 @@ func _pressedLeft(): # when left arrow is clicked, move to the next adjacent scr
left.hide() left.hide()
if current < rooms.size() - 1: if current < rooms.size() - 1:
right.show() right.show()
print("Currently in room " + str(current) + ": " + rooms[current].get_name())
func check_arrows():
if current < rooms.size() - 1:
right.show()
if current >= 1:
left.show()
[gd_scene load_steps=18 format=2] [gd_scene load_steps=22 format=2]
[ext_resource path="res://Test room 1.tscn" type="PackedScene" id=1] [ext_resource path="res://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,14 +14,20 @@ ...@@ -14,14 +14,20 @@
[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://Laundry basket.tscn" type="PackedScene" id=13] [ext_resource path="res://Laundry basket.tscn" type="PackedScene" id=13]
[ext_resource path="res://Laundry area.tscn" type="PackedScene" id=14] [ext_resource path="res://Laundry area.tscn" type="PackedScene" id=14]
[ext_resource path="res://To do UI.gd" type="Script" id=15]
[ext_resource path="res://To do hitbox.gd" type="Script" id=16]
[ext_resource path="res://Fridge.tscn" type="PackedScene" id=17]
[sub_resource type="StyleBoxFlat" id=3] [sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.984314, 0.847059, 0.435294, 1 ) bg_color = Color( 0.984314, 0.847059, 0.435294, 1 )
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 143.453, 196.701 )
[sub_resource type="StyleBoxFlat" id=3]
bg_color = Color( 0.466667, 0.631373, 0.168627, 1 ) bg_color = Color( 0.466667, 0.631373, 0.168627, 1 )
[sub_resource type="StyleBoxFlat" id=2] [sub_resource type="StyleBoxFlat" id=4]
bg_color = Color( 0.145098, 0.145098, 0.164706, 1 ) bg_color = Color( 0.145098, 0.145098, 0.164706, 1 )
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
...@@ -46,10 +52,15 @@ visible = false ...@@ -46,10 +52,15 @@ visible = false
script = ExtResource( 4 ) script = ExtResource( 4 )
items = [ NodePath("Laundry door"), NodePath("Groceries"), NodePath("Stool") ] items = [ NodePath("Laundry door"), NodePath("Groceries"), NodePath("Stool") ]
[node name="Fridge" parent="." instance=ExtResource( 17 )]
visible = false
script = ExtResource( 4 )
items = [ NodePath("Bread"), NodePath("Egg"), NodePath("Granola bar"), NodePath("Vienna sausage"), NodePath("Return") ]
[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") ] eventItems = [ NodePath("../Laundry basket/To do list"), NodePath("../Bedroom/Laundry basket"), NodePath("../Laundry basket/Return"), NodePath("../Fridge/Return"), NodePath("../Kitchen/Fridge") ]
[node name="Moxie" type="Sprite" parent="."] [node name="Moxie" type="Sprite" parent="."]
position = Vector2( 214.135, 386.725 ) position = Vector2( 214.135, 386.725 )
...@@ -71,15 +82,24 @@ __meta__ = { ...@@ -71,15 +82,24 @@ __meta__ = {
} }
[node name="To do" type="Panel" parent="UI"] [node name="To do" type="Panel" parent="UI"]
margin_left = 483.699 margin_left = 474.79
margin_top = 120.82 margin_top = 140.82
margin_right = 770.699 margin_right = 761.79
margin_bottom = 513.82 margin_bottom = 533.82
custom_styles/panel = SubResource( 3 ) custom_styles/panel = SubResource( 1 )
script = ExtResource( 15 )
__meta__ = { __meta__ = {
"_edit_group_": true,
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Hitbox" type="StaticBody2D" parent="UI/To do"]
script = ExtResource( 16 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="UI/To do/Hitbox"]
position = Vector2( 144.013, 197.335 )
shape = SubResource( 2 )
[node name="Title" type="RichTextLabel" parent="UI/To do"] [node name="Title" type="RichTextLabel" parent="UI/To do"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
...@@ -146,6 +166,7 @@ __meta__ = { ...@@ -146,6 +166,7 @@ __meta__ = {
} }
[node name="Right" type="TextureButton" parent="UI"] [node name="Right" type="TextureButton" parent="UI"]
visible = false
margin_left = 710.985 margin_left = 710.985
margin_top = -128.564 margin_top = -128.564
margin_right = 1710.99 margin_right = 1710.99
...@@ -158,6 +179,7 @@ __meta__ = { ...@@ -158,6 +179,7 @@ __meta__ = {
} }
[node name="Movement Handler" type="Control" parent="UI"] [node name="Movement Handler" type="Control" parent="UI"]
visible = false
margin_left = -200.963 margin_left = -200.963
margin_top = 107.275 margin_top = 107.275
margin_right = -160.963 margin_right = -160.963
...@@ -178,9 +200,9 @@ __meta__ = { ...@@ -178,9 +200,9 @@ __meta__ = {
} }
[node name="RichTextLabel" type="RichTextLabel" parent="UI/Dialogue Box"] [node name="RichTextLabel" type="RichTextLabel" parent="UI/Dialogue Box"]
margin_left = 21.4404 margin_left = 21.0
margin_top = 20.0 margin_top = 20.0
margin_right = 251.44 margin_right = 518.0
margin_bottom = 49.0 margin_bottom = 49.0
scroll_active = false scroll_active = false
__meta__ = { __meta__ = {
...@@ -192,8 +214,8 @@ margin_left = -197.122 ...@@ -192,8 +214,8 @@ margin_left = -197.122
margin_top = -367.765 margin_top = -367.765
margin_right = 235.878 margin_right = 235.878
margin_bottom = -325.765 margin_bottom = -325.765
custom_styles/fg = SubResource( 1 ) custom_styles/fg = SubResource( 3 )
custom_styles/bg = SubResource( 2 ) custom_styles/bg = SubResource( 4 )
value = 80.0 value = 80.0
percent_visible = false percent_visible = false
__meta__ = { __meta__ = {
...@@ -206,3 +228,4 @@ __meta__ = { ...@@ -206,3 +228,4 @@ __meta__ = {
[editable path="Kitchen"] [editable path="Kitchen"]
[editable path="Laundry basket"] [editable path="Laundry basket"]
[editable path="Laundry area"] [editable path="Laundry area"]
[editable path="Fridge"]
extends "res://Item.gd"
signal returnFridge
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func passEvent(handler):
print("clicked on return")
connect("returnFridge", handler, "_return_fridge")
func mouseInteraction():
emit_signal("returnFridge")
[gd_scene load_steps=21 format=2] [gd_scene load_steps=20 format=2]
[ext_resource path="res://assets/room zoom out.png" type="Texture" id=1] [ext_resource path="res://assets/room zoom out.png" type="Texture" id=1]
[ext_resource path="res://assets/placeholder item.png" type="Texture" id=2] [ext_resource path="res://assets/placeholder item.png" type="Texture" id=2]
...@@ -21,86 +21,23 @@ extents = Vector2( 16.2181, 10.3281 ) ...@@ -21,86 +21,23 @@ extents = Vector2( 16.2181, 10.3281 )
[sub_resource type="RectangleShape2D" id=4] [sub_resource type="RectangleShape2D" id=4]
[sub_resource type="GDScript" id=5] [sub_resource type="RectangleShape2D" id=5]
script/source = "extends StaticBody2D
#UI stuff
onready var dialogueBox
onready var inventory
onready var quests
#variables that are editable in the Inspector
export(bool) var retrievable # check if this item can be placed in the inventory
export(bool) var interactable # for environmental objects that are interactable but not retrievable
export(String) var flavorText # the flavor text that appears in the dialogue box when picked up
onready var control = get_parent().get_node(\"Dialogue control\")
#other variables
onready var texture = get_node(\"CollisionShape2D/Sprite\").get_texture()
# some references
# https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_exports.html
# https://padamthapa.com/blog/how-to-detect-click-inside-staticbody2d-in-godot/
func _ready():
pass
func passUI(inv, dia, que): #passes the inventory and dialogue box from the parent scene to the item in the instanced scene
inventory = inv
dialogueBox = dia
quests = que
print(\"Found \" + dialogueBox.get_name())
func _input_event(viewport, event, shape_idx): # executes when clicked on
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
#print(\"Clicked on \" + self.get_name() + \" with selected \" + str(inventory.is_anything_selected()))
if inventory.is_anything_selected() and interactable: # if the player has an item selected and they use it on something interactable
objInteraction(inventory.get_selected_items()[0])
elif inventory.is_anything_selected() and retrievable: # use object on something retrievable
objInteraction(inventory.get_selected_items()[0])
elif !inventory.is_anything_selected() and retrievable: # if they click on something retrievable w/ empty hands
pickup()
elif interactable: #for environment things that arent retrievable, and hands are empty
mouseInteraction()
func mouseInteraction(): # just clicked on it with nothing
dialogueBox.text = flavorText
func pickup(): # when it's picked up
dialogueBox.text = flavorText
inventory.add_item(self.get_name(), texture)
queue_free()
inventory.unselect_all()
func objInteraction(selected): # when an object is used on it
var flavor = control.interaction(inventory.get_item_text(selected), self.get_name())
if 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
"
[sub_resource type="RectangleShape2D" id=6]
extents = Vector2( 16.0423, 12.4535 ) extents = Vector2( 16.0423, 12.4535 )
[sub_resource type="StreamTexture" id=7] [sub_resource type="StreamTexture" id=6]
flags = 4 flags = 4
load_path = "res://.import/trail 3.png-9960f4c5b964f5aca36ca6c97e309a5d.stex" load_path = "res://.import/trail 3.png-9960f4c5b964f5aca36ca6c97e309a5d.stex"
[sub_resource type="RectangleShape2D" id=8] [sub_resource type="RectangleShape2D" id=7]
[sub_resource type="StreamTexture" id=9] [sub_resource type="StreamTexture" id=8]
flags = 4 flags = 4
load_path = "res://.import/trail 3.png-9960f4c5b964f5aca36ca6c97e309a5d.stex" load_path = "res://.import/trail 3.png-9960f4c5b964f5aca36ca6c97e309a5d.stex"
[sub_resource type="RectangleShape2D" id=10] [sub_resource type="RectangleShape2D" id=9]
extents = Vector2( 13.7803, 7.3572 ) extents = Vector2( 13.7803, 7.3572 )
[sub_resource type="StreamTexture" id=11] [sub_resource type="StreamTexture" id=10]
flags = 4 flags = 4
load_path = "res://.import/trail 4.png-981c4881d0d8d742f95645909a2023bf.stex" load_path = "res://.import/trail 4.png-981c4881d0d8d742f95645909a2023bf.stex"
...@@ -202,7 +139,7 @@ position = Vector2( -218.863, 261.728 ) ...@@ -202,7 +139,7 @@ position = Vector2( -218.863, 261.728 )
rotation = -0.445059 rotation = -0.445059
scale = Vector2( 0.9, 0.9 ) scale = Vector2( 0.9, 0.9 )
input_pickable = true input_pickable = true
script = SubResource( 5 ) script = ExtResource( 3 )
__meta__ = { __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
...@@ -212,13 +149,13 @@ flavorText = "Can't find anything with all these clothes." ...@@ -212,13 +149,13 @@ flavorText = "Can't find anything with all these clothes."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Laptop"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Laptop"]
position = Vector2( -16.4264, -2.27527 ) position = Vector2( -16.4264, -2.27527 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 6 ) shape = SubResource( 5 )
[node name="Sprite" type="Sprite" parent="Laptop/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Laptop/CollisionShape2D"]
visible = false visible = false
position = Vector2( -0.277301, -0.137165 ) position = Vector2( -0.277301, -0.137165 )
scale = Vector2( 0.0197574, 0.0197574 ) scale = Vector2( 0.0197574, 0.0197574 )
texture = SubResource( 7 ) texture = SubResource( 6 )
[node name="Sando" type="StaticBody2D" parent="."] [node name="Sando" type="StaticBody2D" parent="."]
position = Vector2( -217.74, 306.626 ) position = Vector2( -217.74, 306.626 )
...@@ -235,12 +172,12 @@ flavorText = "If I hide my work under my laundry, it'll disappear. Haha no." ...@@ -235,12 +172,12 @@ flavorText = "If I hide my work under my laundry, it'll disappear. Haha no."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sando"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Sando"]
position = Vector2( -3.5491, 1.06189 ) position = Vector2( -3.5491, 1.06189 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 8 ) shape = SubResource( 7 )
[node name="Sprite" type="Sprite" parent="Sando/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Sando/CollisionShape2D"]
position = Vector2( -0.277301, -0.137165 ) position = Vector2( -0.277301, -0.137165 )
scale = Vector2( 0.0197574, 0.0197574 ) scale = Vector2( 0.0197574, 0.0197574 )
texture = SubResource( 9 ) texture = SubResource( 8 )
[node name="Towel" type="StaticBody2D" parent="."] [node name="Towel" type="StaticBody2D" parent="."]
position = Vector2( 58.8578, 390.735 ) position = Vector2( 58.8578, 390.735 )
...@@ -256,12 +193,12 @@ flavorText = "Augh my back." ...@@ -256,12 +193,12 @@ flavorText = "Augh my back."
[node name="CollisionShape2D" type="CollisionShape2D" parent="Towel"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Towel"]
position = Vector2( -3.5491, 1.06189 ) position = Vector2( -3.5491, 1.06189 )
scale = Vector2( 5, 5 ) scale = Vector2( 5, 5 )
shape = SubResource( 10 ) shape = SubResource( 9 )
[node name="Sprite" type="Sprite" parent="Towel/CollisionShape2D"] [node name="Sprite" type="Sprite" parent="Towel/CollisionShape2D"]
position = Vector2( -0.218535, -1.57275 ) position = Vector2( -0.218535, -1.57275 )
scale = Vector2( 0.03, 0.03 ) scale = Vector2( 0.03, 0.03 )
texture = SubResource( 11 ) texture = SubResource( 10 )
[node name="Dialogue control" type="Control" parent="."] [node name="Dialogue control" type="Control" parent="."]
visible = false visible = false
......
extends Panel
onready var opened = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass
func _open_UI():
print("Clicked on to do list")
if opened:
set_position(Vector2(474.699,140.82))
opened = false
#x = 474.699
#y = 140.82
else:
set_position(Vector2(474.699,-150))
opened = true
#x = 474.699
#y = -150
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
extends StaticBody2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _input_event(viewport, event, shape_idx): # executes when clicked on
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
get_parent()._open_UI()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Granola bar.png-cef620d7191b1675ca638bd3ee9f9871.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Thesis Clickables/Granola bar.png"
dest_files=[ "res://.import/Granola bar.png-cef620d7191b1675ca638bd3ee9f9871.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Vienna sausage.png-a155048cf809c4d42aa39520b061c7e8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Thesis Clickables/Vienna sausage.png"
dest_files=[ "res://.import/Vienna sausage.png-a155048cf809c4d42aa39520b061c7e8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
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