Skip to content

Commit

Permalink
fix: body variable names :(
Browse files Browse the repository at this point in the history
  • Loading branch information
KTools2202 authored and KTools2202 committed Jul 6, 2024
1 parent ff77c05 commit b23f262
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
10 changes: 7 additions & 3 deletions scenes/stages/stage1.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://dgdhq7qt34stf"]
[gd_scene load_steps=16 format=3 uid="uid://dgdhq7qt34stf"]

[ext_resource type="Script" path="res://scripts/Player.gd" id="1_4dh24"]
[ext_resource type="Texture2D" uid="uid://dlynbhoi58b3e" path="res://sprites/Astronaut Sprite 1.png" id="2_gthq2"]
Expand All @@ -7,6 +7,7 @@
[ext_resource type="Script" path="res://scripts/Stage1/Clue3.gd" id="5_2j6ve"]
[ext_resource type="Script" path="res://scripts/Stage1/Clue4.gd" id="6_dfxqv"]
[ext_resource type="Script" path="res://scripts/Stage1/Clue5.gd" id="7_s042v"]
[ext_resource type="Script" path="res://scripts/Stage1/AnswerGUI.gd" id="8_yubbe"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_3myi4"]
size = Vector2(116, 127)
Expand All @@ -27,7 +28,7 @@ radius = 35.5106
radius = 39.4588

[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmj16"]
size = Vector2(42, 100)
size = Vector2(42, 648)

[node name="Node2D" type="Node2D"]

Expand Down Expand Up @@ -111,9 +112,10 @@ offset_bottom = 95.0

[node name="answer" type="Area2D" parent="."]
position = Vector2(37, 240)
script = ExtResource("8_yubbe")

[node name="CollisionShape2D" type="CollisionShape2D" parent="answer"]
position = Vector2(-37, 66)
position = Vector2(-16, 84)
shape = SubResource("RectangleShape2D_wmj16")

[node name="Panel" type="Panel" parent="answer"]
Expand Down Expand Up @@ -182,3 +184,5 @@ tooltip_text = "Click to close this menu."
[connection signal="body_exited" from="Clue4" to="Clue4" method="_on_body_exited"]
[connection signal="body_entered" from="Clue5" to="Clue5" method="_on_body_entered"]
[connection signal="body_exited" from="Clue5" to="Clue5" method="_on_body_exited"]
[connection signal="body_entered" from="answer" to="answer" method="_on_body_entered"]
[connection signal="body_exited" from="answer" to="answer" method="_on_body_exited"]
4 changes: 2 additions & 2 deletions scenes/start_button.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://ij081mw11vmd"]

[ext_resource type="Script" path="res://scripts/scene_transition.gd" id="1_0qwew"]
[ext_resource type="Texture2D" uid="uid://c4tao2repn1js" path="res://sprites/Start button unclicked.png" id="1_u3ucj"]
[ext_resource type="Texture2D" uid="uid://dns1ypi8jewkx" path="res://sprites/Start button clicked.png" id="2_32y8s"]
[ext_resource type="Texture2D" uid="uid://dv8rqv5yof8nd" path="res://sprites/Start button unclicked.png" id="1_u3ucj"]
[ext_resource type="Texture2D" uid="uid://g0prqcwksx5u" path="res://sprites/Start button clicked.png" id="2_32y8s"]

[node name="Control" type="Control"]
layout_mode = 3
Expand Down
24 changes: 19 additions & 5 deletions scripts/Stage1/AnswerGUI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,40 @@ extends Area2D

@onready var panel = $Panel
@onready var heading = $Panel/Label
@onready var body = $Panel/Body
@onready var middle = $Panel/Body
@onready var Ans1 = $Panel/Ans1
@onready var Ans2 = $Panel/Ans2
@onready var Ans3 = $Panel/Ans3
@onready var Ans4 = $Panel/Ans4

func _ready():
heading.text = "QUIZ!"
body.text = "Which star are you on?"
middle.text = "Which star are you on?"
panel.visible = false
heading.visible_characters = 0
body.visible_characters = 0
middle.visible_characters = 0
Ans1.visible = false
Ans2.visible = false
Ans3.visible = false
Ans4.visible = false

# Showing text when the player enters the area
func _on_body_entered(body):
if body.is_in_group("player"): # The player-character is in a group called "player"
panel.visible = true
heading.visible_characters = -1
body.visible_characters = -1
middle.visible_characters = -1
Ans1.visible = true
Ans2.visible = true
Ans3.visible = true
Ans4.visible = true

# Hiding text when the player exits the area
func _on_body_exited(body):
if body.is_in_group("player"):
heading.visible_characters = 0
body.visible_characters = 0
middle.visible_characters = 0
Ans1.visible = false
Ans2.visible = false
Ans3.visible = false
Ans4.visible = false

0 comments on commit b23f262

Please sign in to comment.