Commit 1b8cac91 authored by Julia Santos's avatar Julia Santos

Notepad now opens and closes when clicked on

parent ed49caab
[gd_scene load_steps=33 format=2] [gd_scene load_steps=34 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]
...@@ -28,18 +28,34 @@ ...@@ -28,18 +28,34 @@
[ext_resource path="res://Desk.tscn" type="PackedScene" id=26] [ext_resource path="res://Desk.tscn" type="PackedScene" id=26]
[ext_resource path="res://Living room.tscn" type="PackedScene" id=27] [ext_resource path="res://Living room.tscn" type="PackedScene" id=27]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="Animation" id=1]
resource_name = "Notepad open"
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("To do:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.4, 0.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 474.699, 104.779 ), Vector2( 474.699, 90.9202 ), Vector2( 474.699, 116.119 ), Vector2( 474.699, -64.0501 ), Vector2( 474.699, -72.8696 ) ]
}
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.984314, 0.847059, 0.435294, 1 ) bg_color = Color( 0.984314, 0.847059, 0.435294, 1 )
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="StyleBoxEmpty" id=4]
extents = Vector2( 143.453, 196.701 )
[sub_resource type="StyleBoxEmpty" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 143.453, 196.701 )
[sub_resource type="StyleBoxFlat" id=4] [sub_resource type="StyleBoxFlat" id=5]
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=5] [sub_resource type="StyleBoxFlat" id=6]
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"]
...@@ -130,44 +146,45 @@ scale = Vector2( 2.86111, 2.86111 ) ...@@ -130,44 +146,45 @@ scale = Vector2( 2.86111, 2.86111 )
current = true current = true
[node name="UI" type="Control" parent="."] [node name="UI" type="Control" parent="."]
margin_left = 214.135 margin_left = 214.0
margin_top = 386.725 margin_top = 387.0
margin_right = 254.135 margin_right = 1031.0
margin_bottom = 426.725 margin_bottom = 872.0
mouse_filter = 2
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="To do" type="Panel" parent="UI"] [node name="AnimationPlayer" type="AnimationPlayer" parent="UI"]
margin_left = 474.699 "anims/Notepad open" = SubResource( 1 )
margin_top = 140.82
margin_right = 761.699 [node name="To do" type="StaticBody2D" parent="UI"]
margin_bottom = 533.82 position = Vector2( 474.699, 104.779 )
custom_styles/panel = SubResource( 1 ) input_pickable = true
script = ExtResource( 16 )
[node name="Panel" type="Panel" parent="UI/To do"]
margin_right = 287.0
margin_bottom = 393.0
mouse_filter = 2
custom_styles/panel = SubResource( 2 )
script = ExtResource( 15 ) 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
margin_left = 13.0 margin_left = 13.0
margin_top = 16.0 margin_top = 16.0
margin_right = -213.0 margin_right = 113.0
margin_bottom = -362.0 margin_bottom = 116.0
mouse_filter = 2
custom_colors/default_color = Color( 0, 0, 0, 1 ) custom_colors/default_color = Color( 0, 0, 0, 1 )
text = "To Do:" text = "To Do:"
__meta__ = { __meta__ = {
"_edit_use_anchors_": true "_edit_use_anchors_": false
} }
[node name="Quests" type="RichTextLabel" parent="UI/To do"] [node name="Quests" type="RichTextLabel" parent="UI/To do"]
...@@ -175,6 +192,7 @@ margin_left = 14.7614 ...@@ -175,6 +192,7 @@ margin_left = 14.7614
margin_top = 39.8421 margin_top = 39.8421
margin_right = 272.761 margin_right = 272.761
margin_bottom = 256.842 margin_bottom = 256.842
mouse_filter = 2
custom_colors/default_color = Color( 0, 0, 0, 1 ) custom_colors/default_color = Color( 0, 0, 0, 1 )
script = ExtResource( 11 ) script = ExtResource( 11 )
__meta__ = { __meta__ = {
...@@ -184,12 +202,13 @@ quests = PoolStringArray( "Do laundry" ) ...@@ -184,12 +202,13 @@ quests = PoolStringArray( "Do laundry" )
[node name="Words" type="ItemList" parent="UI/To do"] [node name="Words" type="ItemList" parent="UI/To do"]
anchor_right = 0.267 anchor_right = 0.267
margin_left = 58.0 margin_left = 32.8016
margin_top = 47.0 margin_top = 48.2599
margin_right = 165.371 margin_right = 252.802
margin_bottom = 154.0 margin_bottom = 155.26
rect_clip_content = false rect_clip_content = false
custom_styles/bg = SubResource( 3 ) mouse_filter = 2
custom_styles/bg = SubResource( 4 )
custom_colors/font_color_selected = Color( 0, 0, 0, 1 ) custom_colors/font_color_selected = Color( 0, 0, 0, 1 )
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_constants/vseparation = 10 custom_constants/vseparation = 10
...@@ -199,6 +218,10 @@ __meta__ = { ...@@ -199,6 +218,10 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="CollisionShape2D" type="CollisionShape2D" parent="UI/To do"]
position = Vector2( 144.013, 197.335 )
shape = SubResource( 3 )
[node name="Inventory" type="ItemList" parent="UI"] [node name="Inventory" type="ItemList" parent="UI"]
margin_left = -201.361 margin_left = -201.361
margin_top = 128.912 margin_top = 128.912
...@@ -288,8 +311,8 @@ margin_left = -197.122 ...@@ -288,8 +311,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( 4 ) custom_styles/fg = SubResource( 5 )
custom_styles/bg = SubResource( 5 ) custom_styles/bg = SubResource( 6 )
value = 50.0 value = 50.0
percent_visible = false percent_visible = false
__meta__ = { __meta__ = {
......
extends Panel extends Panel
onready var opened = false onready var opened = false
#onready var animator = get_parent().get_node("AnimationPlayer")
# 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 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. # Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): #func _process(delta):
......
extends StaticBody2D extends StaticBody2D
onready var opened
onready var animator = get_parent().get_node("AnimationPlayer")
# 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():
opened = false
pass # Replace with function body. pass # Replace with function body.
func _input_event(viewport, event, shape_idx): # executes when clicked on func _input_event(viewport, event, shape_idx): # executes when clicked on
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed: if event.button_index == BUTTON_LEFT and event.pressed:
get_parent()._open_UI() _open_UI()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass func _open_UI():
if !opened:
animator.play("Notepad open")
opened = true
#x = 474.699
#y = 140.82
else:
animator.play_backwards("Notepad open")
opened = false
#x = 474.699
#y = -150
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