Skip to content

Commit c28fde8

Browse files
committed
Door to cat minigame now works
1 parent ac36fec commit c28fde8

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

scenes/room.tscn

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=18 format=3 uid="uid://bomyo23b5yead"]
1+
[gd_scene load_steps=19 format=3 uid="uid://bomyo23b5yead"]
22

33
[ext_resource type="PackedScene" uid="uid://ds2er2baig65x" path="res://scenes/funny_hubert.tscn" id="2_nj3n7"]
44
[ext_resource type="Texture2D" uid="uid://djdyxn44vgp3j" path="res://assets/textures/room.png" id="3_nggxw"]
@@ -11,6 +11,7 @@
1111
[ext_resource type="PackedScene" uid="uid://blrow0klriehp" path="res://scenes/baseobject.tscn" id="10_kf21y"]
1212
[ext_resource type="Texture2D" uid="uid://k2eocvy6b05o" path="res://assets/textures/objects/hubert.png" id="11_8wv3o"]
1313
[ext_resource type="Script" path="res://scripts/Border.gd" id="12_rgis5"]
14+
[ext_resource type="PackedScene" uid="uid://d3ba2vx8uqe8c" path="res://scenes/scene_change_interact_area.tscn" id="12_vrsm6"]
1415

1516
[sub_resource type="RectangleShape2D" id="RectangleShape2D_m3x2g"]
1617
size = Vector2(108, 32)
@@ -247,8 +248,7 @@ text = ":D"
247248
[node name="TextInteractArea2" parent="." instance=ExtResource("8_qnajo")]
248249
position = Vector2(168, 20)
249250
alert_type = 2
250-
textlist = Array[String](["v1.1.0 Dev Build
251-
(TODO: Change this text on release)"])
251+
textlist = Array[String](["v1.1.0-alpha.1", "cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat cat ca"])
252252

253253
[node name="Border" type="StaticBody2D" parent="."]
254254
position = Vector2(12, 144)
@@ -269,6 +269,10 @@ position = Vector2(-136, 430)
269269
alert_type = 0
270270
textlist = Array[String](["You don't recognise the individual in the photo", "So why do they look so familiar?"])
271271

272+
[node name="SceneChangeInteractArea" parent="." instance=ExtResource("12_vrsm6")]
273+
position = Vector2(120, 351)
274+
scene_path = "res://scenes/catsim/cat_sim.tscn"
275+
272276
[connection signal="body_entered" from="SpoopyArea" to="M" method="_on_spoopy_area_body_entered" flags=18]
273277
[connection signal="body_exited" from="SpoopyArea" to="M" method="_on_spoopy_area_body_exited" flags=18]
274278

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[gd_scene load_steps=4 format=3 uid="uid://d3ba2vx8uqe8c"]
2+
3+
[ext_resource type="Script" path="res://scripts/change_scene.gd" id="1_hxjvu"]
4+
[ext_resource type="Texture2D" uid="uid://dgf38h33cdpxs" path="res://assets/textures/alerts/exclamation_mark.png" id="2_eamvv"]
5+
6+
[sub_resource type="CircleShape2D" id="CircleShape2D_ve8uh"]
7+
radius = 16.0
8+
9+
[node name="SceneChangeInteractArea" type="Area2D"]
10+
monitorable = false
11+
script = ExtResource("1_hxjvu")
12+
alert_type = 0
13+
scene_path = "res://scenes/funny_hubert.tscn"
14+
15+
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
16+
shape = SubResource("CircleShape2D_ve8uh")
17+
18+
[node name="Alert" type="Sprite2D" parent="."]
19+
z_index = 10
20+
position = Vector2(0, -41)
21+
texture = ExtResource("2_eamvv")
22+
23+
[connection signal="body_entered" from="." to="." method="_on_body_entered" flags=18]
24+
[connection signal="body_exited" from="." to="." method="_on_body_exited" flags=18]

scripts/change_scene.gd

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
class_name SceneChangeInteractArea
2+
extends Area2D
3+
4+
enum alert {
5+
EXCLAMATION_MARK,
6+
QUESTION_MARK,
7+
NONE
8+
}
9+
10+
@onready var alert_node = $Alert
11+
12+
@export var alert_type: alert = alert.QUESTION_MARK
13+
@export_file("*.tscn") var scene_path
14+
15+
var exclamation_alert_tex = preload("res://assets/textures/alerts/exclamation_mark.png")
16+
var question_alert_tex = preload("res://assets/textures/alerts/question_mark.png")
17+
18+
var inrange = false
19+
20+
21+
# Called every frame. 'delta' is the elapsed time since the previous frame.
22+
func _process(_delta):
23+
if inrange and Input.is_action_just_pressed("interact"):
24+
var scene_instance = load(scene_path).instantiate()
25+
get_node("/root").add_child(scene_instance)
26+
get_parent().queue_free()
27+
28+
29+
30+
func _on_body_entered(body):
31+
if body.name != "M":
32+
return
33+
inrange = true
34+
if alert_type != alert.NONE:
35+
alert_node.show()
36+
match alert_type:
37+
alert.EXCLAMATION_MARK:
38+
alert_node.texture = exclamation_alert_tex
39+
alert.QUESTION_MARK:
40+
alert_node.texture = question_alert_tex
41+
42+
43+
func _on_body_exited(body):
44+
if body.name != "M":
45+
return
46+
inrange = false
47+
alert_node.hide()

0 commit comments

Comments
 (0)