Polish the gardens menu.

This commit is contained in:
Dylan Sarrazyn
2024-07-18 17:37:17 +02:00
parent 1371fa51d6
commit d5c8f09df7
21 changed files with 1173 additions and 513 deletions
+1
View File
@@ -43,6 +43,7 @@ gdscript/warnings/unsafe_call_argument=1
window/size/viewport_width=2560
window/size/viewport_height=1800
window/size/always_on_top=true
window/size/window_width_override=1280
window/size/window_height_override=900
window/stretch/mode="canvas_items"
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://djusd5bu6780j"]
[ext_resource type="Shader" path="res://resources/gardens/garden_flower.gdshader" id="1_n3pck"]
[resource]
shader = ExtResource("1_n3pck")
shader_parameter/speed = 1.0
shader_parameter/minStrength = 0.05
shader_parameter/maxStrength = 0.02
shader_parameter/strengthScale = 100.0
shader_parameter/interval = 5.0
shader_parameter/detail = 1.0
shader_parameter/distortion = 0.0
shader_parameter/heightOffset = 0.0
shader_parameter/offset = 0.0
+14 -24
View File
@@ -2,6 +2,10 @@
extends Control
class_name Garden
# Namespace
const GardenFlower: = preload("res://resources/gardens/garden_flower.gd")
const LessonButton: = preload("res://sources/lesson_screen/lesson_button.gd")
const flower_path_model: = "res://assets/gardens/flowers/Plant_%02d_%02d_%s.png"
const background_path_model: = "res://assets/gardens/gardens/garden_%02d_open.png"
@@ -19,24 +23,12 @@ const background_path_model: = "res://assets/gardens/gardens/garden_%02d_open.pn
%Flower5,
]
@onready var background: = %Background
@onready var lesson_button_controls: Array[TextureButton] = [
@onready var lesson_button_controls: Array[LessonButton] = [
%Button1,
%Button2,
%Button3,
%Button4,
]
@onready var lesson_button_centers: Array[TextureRect] = [
%Center1,
%Center2,
%Center3,
%Center4,
]
@onready var lesson_labels: Array[Label] = [
%LessonLabel1,
%LessonLabel2,
%LessonLabel3,
%LessonLabel4,
]
enum FlowerSizes{
NotStarted,
@@ -72,19 +64,17 @@ func set_flowers(p_flowers: Array[GardenLayout.Flower]) -> void:
func update_flowers() -> void:
for flower_control in flower_controls:
flower_control.texture = null
for i in flowers.size():
if i >= flower_controls.size():
break
var flower: = flowers[i]
var flower_control: = flower_controls[i]
var flower_scene: = flower_controls[i]
var flower_size: String = FlowerSizes.keys()[flowers_sizes[i]]
flower_control.texture = load(flower_path_model % [flower.color+1, flower.type+1, flower_size])
flower_control.position = flower.position
flower_control.size = flower_control.get_combined_minimum_size() * 3
flower_control.pivot_offset = flower_control.size / 2
flower_scene.texture = load(flower_path_model % [flower.color+1, flower.type+1, flower_size])
flower_scene.size = flower_scene.get_combined_minimum_size() * 3
flower_scene.pivot_offset = Vector2(flower_scene.size.x / 2, flower_scene.size.y)
flower_scene.position = Vector2(flower.position.x - flower_scene.size.x / 2, flower.position.y - flower_scene.size.y)
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.LessonButton]) -> void:
@@ -106,8 +96,8 @@ func set_background(p_color: int) -> void:
background.texture = load(background_path_model % [p_color+1])
color = garden_colors[p_color]
for button_center: TextureRect in lesson_button_centers:
button_center.modulate = color
for button in lesson_button_controls:
button.completed_color = color
func _ready() -> void:
@@ -115,8 +105,8 @@ func _ready() -> void:
func set_lesson_label(ind: int, text: String) -> void:
assert(ind < lesson_labels.size())
lesson_labels[ind].text = text
assert(ind < lesson_button_controls.size())
lesson_button_controls[ind].text = text
func pop_animation() -> void:
+25 -152
View File
@@ -1,13 +1,10 @@
[gd_scene load_steps=11 format=3 uid="uid://btg3qd8eld1mm"]
[gd_scene load_steps=8 format=3 uid="uid://btg3qd8eld1mm"]
[ext_resource type="Script" path="res://resources/gardens/garden.gd" id="1_5owem"]
[ext_resource type="Script" path="res://resources/gardens/garden_layout.gd" id="2_8g7o4"]
[ext_resource type="Texture2D" uid="uid://b5kildofgmthb" path="res://assets/gardens/gardens/garden_01_open.png" id="3_p7iv3"]
[ext_resource type="Texture2D" uid="uid://3iuuq06ovbos" path="res://assets/theme/button_normal_empty.svg" id="4_i8h63"]
[ext_resource type="Texture2D" uid="uid://j7sffldhbunj" path="res://assets/theme/button_pressed_empty.svg" id="5_5hg7e"]
[ext_resource type="Texture2D" uid="uid://be30a3cmy0w46" path="res://assets/theme/button_focused_empty.svg" id="6_voggw"]
[ext_resource type="Texture2D" uid="uid://c0rumwiaimvxy" path="res://assets/theme/button_disabled.svg" id="7_wct1x"]
[ext_resource type="Texture2D" uid="uid://dwk8xgv3xsmm0" path="res://assets/theme/button_center.svg" id="8_gpu52"]
[ext_resource type="PackedScene" uid="uid://delcgui3v0eek" path="res://sources/lesson_screen/lesson_button.tscn" id="4_epm30"]
[ext_resource type="Material" uid="uid://djusd5bu6780j" path="res://resources/gardens/flower_material.tres" id="5_76gol"]
[ext_resource type="Texture2D" uid="uid://dg4wcuidmagd8" path="res://assets/gardens/flowers/Plant_03_01_NotStarted.png" id="8_tdxbf"]
[sub_resource type="Resource" id="Resource_pwltf"]
@@ -58,166 +55,37 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Button1" type="TextureButton" parent="Buttons"]
[node name="Button1" parent="Buttons" instance=ExtResource("4_epm30")]
unique_name_in_owner = true
z_index = 1
layout_mode = 0
offset_right = 300.0
offset_bottom = 300.0
pivot_offset = Vector2(150, 150)
texture_normal = ExtResource("4_i8h63")
texture_pressed = ExtResource("5_5hg7e")
texture_hover = ExtResource("6_voggw")
texture_disabled = ExtResource("7_wct1x")
texture_focused = ExtResource("4_i8h63")
completed_color = Color(0.588235, 0.439216, 0.878431, 1)
[node name="Center1" type="TextureRect" parent="Buttons/Button1"]
unique_name_in_owner = true
modulate = Color(0.588235, 0.439216, 0.878431, 1)
show_behind_parent = true
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("8_gpu52")
[node name="LessonLabel1" type="Label" parent="Buttons/Button1"]
unique_name_in_owner = true
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 110
text = "Ga"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Button2" type="TextureButton" parent="Buttons"]
[node name="Button2" parent="Buttons" instance=ExtResource("4_epm30")]
unique_name_in_owner = true
visible = false
z_index = 1
layout_mode = 0
offset_left = -75.0
offset_top = -75.0
offset_right = 225.0
offset_bottom = 225.0
pivot_offset = Vector2(150, 150)
texture_normal = ExtResource("4_i8h63")
texture_pressed = ExtResource("5_5hg7e")
texture_hover = ExtResource("6_voggw")
texture_disabled = ExtResource("7_wct1x")
texture_focused = ExtResource("4_i8h63")
[node name="Center2" type="TextureRect" parent="Buttons/Button2"]
unique_name_in_owner = true
modulate = Color(0.588235, 0.439216, 0.878431, 1)
show_behind_parent = true
layout_mode = 0
offset_right = 300.0
offset_bottom = 300.0
texture = ExtResource("8_gpu52")
completed_color = Color(0.588235, 0.439216, 0.878431, 1)
[node name="LessonLabel2" type="Label" parent="Buttons/Button2"]
unique_name_in_owner = true
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 110
text = "Ga"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Button3" type="TextureButton" parent="Buttons"]
[node name="Button3" parent="Buttons" instance=ExtResource("4_epm30")]
unique_name_in_owner = true
visible = false
z_index = 1
layout_mode = 0
offset_left = -75.0
offset_top = -75.0
offset_right = 225.0
offset_bottom = 225.0
pivot_offset = Vector2(150, 150)
texture_normal = ExtResource("4_i8h63")
texture_pressed = ExtResource("5_5hg7e")
texture_hover = ExtResource("6_voggw")
texture_disabled = ExtResource("7_wct1x")
texture_focused = ExtResource("4_i8h63")
[node name="Center3" type="TextureRect" parent="Buttons/Button3"]
unique_name_in_owner = true
modulate = Color(0.588235, 0.439216, 0.878431, 1)
show_behind_parent = true
layout_mode = 0
offset_right = 300.0
offset_bottom = 300.0
texture = ExtResource("8_gpu52")
completed_color = Color(0.588235, 0.439216, 0.878431, 1)
[node name="LessonLabel3" type="Label" parent="Buttons/Button3"]
unique_name_in_owner = true
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 110
text = "Ga"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Button4" type="TextureButton" parent="Buttons"]
[node name="Button4" parent="Buttons" instance=ExtResource("4_epm30")]
unique_name_in_owner = true
visible = false
z_index = 1
layout_mode = 0
offset_left = -75.0
offset_top = -75.0
offset_right = 225.0
offset_bottom = 225.0
pivot_offset = Vector2(150, 150)
texture_normal = ExtResource("4_i8h63")
texture_pressed = ExtResource("5_5hg7e")
texture_hover = ExtResource("6_voggw")
texture_disabled = ExtResource("7_wct1x")
texture_focused = ExtResource("4_i8h63")
[node name="Center4" type="TextureRect" parent="Buttons/Button4"]
unique_name_in_owner = true
modulate = Color(0.588235, 0.439216, 0.878431, 1)
show_behind_parent = true
layout_mode = 0
offset_right = 300.0
offset_bottom = 300.0
texture = ExtResource("8_gpu52")
[node name="LessonLabel4" type="Label" parent="Buttons/Button4"]
unique_name_in_owner = true
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 110
text = "Ga"
horizontal_alignment = 1
vertical_alignment = 1
completed_color = Color(0.588235, 0.439216, 0.878431, 1)
[node name="Flowers" type="Control" parent="."]
layout_mode = 1
@@ -230,38 +98,43 @@ mouse_filter = 2
[node name="Flower1" type="TextureRect" parent="Flowers"]
unique_name_in_owner = true
z_index = 2
z_index = 1
material = ExtResource("5_76gol")
layout_mode = 0
offset_left = 500.0
offset_right = 647.0
offset_bottom = 90.0
pivot_offset = Vector2(73.5, 45)
offset_left = 426.5
offset_top = -90.0
offset_right = 573.5
pivot_offset = Vector2(73.5, 90)
texture = ExtResource("8_tdxbf")
[node name="Flower2" type="TextureRect" parent="Flowers"]
unique_name_in_owner = true
z_index = 2
z_index = 1
material = ExtResource("5_76gol")
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Flower3" type="TextureRect" parent="Flowers"]
unique_name_in_owner = true
z_index = 2
z_index = 1
material = ExtResource("5_76gol")
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Flower4" type="TextureRect" parent="Flowers"]
unique_name_in_owner = true
z_index = 2
z_index = 1
material = ExtResource("5_76gol")
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Flower5" type="TextureRect" parent="Flowers"]
unique_name_in_owner = true
z_index = 2
z_index = 1
material = ExtResource("5_76gol")
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
+24
View File
@@ -0,0 +1,24 @@
@tool
extends Node2D
@export var texture: Texture:
set = _set_texture
@onready var sprite: Sprite2D = %Sprite
func _ready():
if texture:
_set_texture(texture)
func _set_texture(p_texture: Texture) -> void:
texture = p_texture
sprite.texture = p_texture
sprite.position.y = -sprite.texture.get_height() / 2
func _on_area_2d_input_event(viewport, event, shape_idx):
if event.is_action_pressed("left_click"):
print("CLICKKKKK")
+28
View File
@@ -0,0 +1,28 @@
shader_type canvas_item;
render_mode blend_mix;
// Wind settings.
uniform float speed = 1.0;
uniform float minStrength : hint_range(0.0, 1.0) = 0.05;
uniform float maxStrength : hint_range(0.0, 1.0) = 0.01;
uniform float strengthScale = 100.0;
uniform float interval = 3.5;
uniform float detail = 1.0;
uniform float distortion : hint_range(0.0, 1.0);
uniform float heightOffset : hint_range(0.0, 1.0);
uniform float offset = 0;
float getWind(vec2 vertex, vec2 uv, float time){
float diff = pow(maxStrength - minStrength, 2.0);
float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale;
float wind = (sin(time) + cos(time * detail)) * strength * max(0.0, (1.0-uv.y) - heightOffset);
return wind;
}
void vertex() {
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
float time = TIME * speed + offset;
VERTEX.x += getWind(VERTEX.xy, UV, time);
}
+28
View File
@@ -0,0 +1,28 @@
[gd_scene load_steps=3 format=3 uid="uid://sjgk8i8m2lhn"]
[ext_resource type="Script" path="res://resources/gardens/garden_flower.gd" id="1_mimdi"]
[ext_resource type="Material" uid="uid://djusd5bu6780j" path="res://resources/gardens/flower_material.tres" id="3_xad8g"]
[node name="Flower" type="Node2D"]
script = ExtResource("1_mimdi")
[node name="Sprite" type="Sprite2D" parent="."]
unique_name_in_owner = true
material = ExtResource("3_xad8g")
[node name="Area2D" type="Area2D" parent="."]
top_level = true
z_index = 20
z_as_relative = false
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D"]
position = Vector2(250, 1546)
polygon = PackedVector2Array(1030, -1546, -250, -1546, -250, 254, 1030, 254, 774, 225, 630, 163, 449, 44, 264, -167, 163, -383, 125, -619, 158, -890, 251, -1101, 390, -1282, 563, -1416, 710, -1490, 838, -1522)
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Area2D"]
position = Vector2(2312, 1544)
rotation = -3.14159
scale = Vector2(1, -1)
polygon = PackedVector2Array(1030, -1546, -250, -1546, -250, 254, 1030, 254, 774, 225, 630, 163, 449, 44, 264, -167, 163, -383, 125, -619, 158, -890, 251, -1101, 390, -1282, 563, -1416, 710, -1490, 838, -1522)
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]
+67 -67
View File
@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="GardensLayout" load_steps=19 format=3 uid="uid://8v0g8bpx5mh0"]
[gd_resource type="Resource" script_class="GardensLayout" load_steps=19 format=3]
[ext_resource type="Script" path="res://resources/gardens/garden_layout.gd" id="1_gyv0f"]
[ext_resource type="Script" path="res://resources/gardens/gardens_layout.gd" id="2_w74ow"]
@@ -8,28 +8,28 @@ script = ExtResource("1_gyv0f")
color = 0
flowers_export = Array[Dictionary]([{
"color": 0,
"position": Vector2i(1464, 1092),
"position": Vector2i(1576, 1020),
"type": 4
}, {
"color": 0,
"position": Vector2i(512, 884),
"position": Vector2i(660, 1364),
"type": 0
}, {
"color": 0,
"position": Vector2i(340, 288),
"position": Vector2i(380, 452),
"type": 3
}, {
"color": 0,
"position": Vector2i(1072, 196),
"position": Vector2i(1248, 408),
"type": 1
}, {
"color": 0,
"position": Vector2i(1736, 196),
"position": Vector2i(1760, 344),
"type": 2
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(87, -281),
"position": Vector2i(121, 841)
"position": Vector2i(44, 864)
}, {
"path_out_position": Vector2i(399, 447),
"position": Vector2i(641, 309)
@@ -47,23 +47,23 @@ script = ExtResource("1_gyv0f")
color = 1
flowers_export = Array[Dictionary]([{
"color": 1,
"position": Vector2i(1494, 20),
"position": Vector2i(1444, 184),
"type": 0
}, {
"color": 1,
"position": Vector2i(1198, 256),
"position": Vector2i(1264, 812),
"type": 1
}, {
"color": 1,
"position": Vector2i(1477, 1260),
"position": Vector2i(1564, 1484),
"type": 2
}, {
"color": 1,
"position": Vector2i(223, 1064),
"position": Vector2i(140, 1164),
"type": 3
}, {
"color": 1,
"position": Vector2i(668, 736),
"position": Vector2i(264, 548),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -86,11 +86,11 @@ script = ExtResource("1_gyv0f")
color = 2
flowers_export = Array[Dictionary]([{
"color": 13,
"position": Vector2i(249, 220),
"position": Vector2i(492, 344),
"type": 0
}, {
"color": 13,
"position": Vector2i(1281, 20),
"position": Vector2i(1588, 152),
"type": 1
}, {
"color": 13,
@@ -98,7 +98,7 @@ flowers_export = Array[Dictionary]([{
"type": 2
}, {
"color": 13,
"position": Vector2i(557, 936),
"position": Vector2i(632, 976),
"type": 4
}, {
"color": 13,
@@ -125,15 +125,15 @@ script = ExtResource("1_gyv0f")
color = 3
flowers_export = Array[Dictionary]([{
"color": 3,
"position": Vector2i(320, 700),
"position": Vector2i(380, 912),
"type": 0
}, {
"color": 3,
"position": Vector2i(868, 316),
"position": Vector2i(1116, 352),
"type": 1
}, {
"color": 3,
"position": Vector2i(741, 912),
"position": Vector2i(788, 1476),
"type": 2
}, {
"color": 3,
@@ -164,23 +164,23 @@ script = ExtResource("1_gyv0f")
color = 4
flowers_export = Array[Dictionary]([{
"color": 8,
"position": Vector2i(333, 1100),
"position": Vector2i(308, 1328),
"type": 0
}, {
"color": 8,
"position": Vector2i(1249, 28),
"position": Vector2i(1416, 388),
"type": 1
}, {
"color": 8,
"position": Vector2i(1705, 532),
"position": Vector2i(1656, 1288),
"type": 2
}, {
"color": 8,
"position": Vector2i(985, 708),
"position": Vector2i(1104, 1028),
"type": 3
}, {
"color": 8,
"position": Vector2i(321, 184),
"position": Vector2i(368, 320),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -203,23 +203,23 @@ script = ExtResource("1_gyv0f")
color = 5
flowers_export = Array[Dictionary]([{
"color": 5,
"position": Vector2i(540, 388),
"position": Vector2i(440, 172),
"type": 0
}, {
"color": 5,
"position": Vector2i(1104, 1028),
"position": Vector2i(1080, 868),
"type": 1
}, {
"color": 5,
"position": Vector2i(210, 752),
"position": Vector2i(1612, 1540),
"type": 2
}, {
"color": 5,
"position": Vector2i(540, -24),
"position": Vector2i(1452, 168),
"type": 3
}, {
"color": 5,
"position": Vector2i(1704, 864),
"position": Vector2i(1012, 1352),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -242,23 +242,23 @@ script = ExtResource("1_gyv0f")
color = 6
flowers_export = Array[Dictionary]([{
"color": 6,
"position": Vector2i(1375, 980),
"position": Vector2i(1500, 1500),
"type": 0
}, {
"color": 6,
"position": Vector2i(231, 728),
"position": Vector2i(284, 304),
"type": 1
}, {
"color": 6,
"position": Vector2i(1035, 140),
"position": Vector2i(1288, 116),
"type": 2
}, {
"color": 6,
"position": Vector2i(1699, 152),
"position": Vector2i(1792, 324),
"type": 3
}, {
"color": 6,
"position": Vector2i(627, 644),
"position": Vector2i(440, 972),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -281,7 +281,7 @@ script = ExtResource("1_gyv0f")
color = 7
flowers_export = Array[Dictionary]([{
"color": 1,
"position": Vector2i(1366, -28),
"position": Vector2i(1868, 288),
"type": 0
}, {
"color": 1,
@@ -289,15 +289,15 @@ flowers_export = Array[Dictionary]([{
"type": 1
}, {
"color": 1,
"position": Vector2i(94, 896),
"position": Vector2i(380, 892),
"type": 2
}, {
"color": 1,
"position": Vector2i(1074, 164),
"position": Vector2i(1092, 480),
"type": 3
}, {
"color": 1,
"position": Vector2i(1538, 1036),
"position": Vector2i(1320, 1008),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -320,7 +320,7 @@ script = ExtResource("1_gyv0f")
color = 8
flowers_export = Array[Dictionary]([{
"color": 14,
"position": Vector2i(1231, 1012),
"position": Vector2i(932, 1168),
"type": 0
}, {
"color": 14,
@@ -332,7 +332,7 @@ flowers_export = Array[Dictionary]([{
"type": 2
}, {
"color": 14,
"position": Vector2i(1111, 44),
"position": Vector2i(1572, 192),
"type": 3
}, {
"color": 14,
@@ -359,15 +359,15 @@ script = ExtResource("1_gyv0f")
color = 9
flowers_export = Array[Dictionary]([{
"color": 9,
"position": Vector2i(629, 80),
"position": Vector2i(704, 252),
"type": 0
}, {
"color": 9,
"position": Vector2i(1200, 108),
"position": Vector2i(1684, 1364),
"type": 1
}, {
"color": 9,
"position": Vector2i(541, 896),
"position": Vector2i(604, 1500),
"type": 2
}, {
"color": 9,
@@ -375,7 +375,7 @@ flowers_export = Array[Dictionary]([{
"type": 3
}, {
"color": 9,
"position": Vector2i(1588, 452),
"position": Vector2i(1840, 848),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -398,15 +398,15 @@ script = ExtResource("1_gyv0f")
color = 10
flowers_export = Array[Dictionary]([{
"color": 10,
"position": Vector2i(950, 1144),
"position": Vector2i(1160, 968),
"type": 0
}, {
"color": 10,
"position": Vector2i(1826, 440),
"position": Vector2i(2028, 544),
"type": 1
}, {
"color": 10,
"position": Vector2i(926, 480),
"position": Vector2i(888, 1508),
"type": 2
}, {
"color": 10,
@@ -437,11 +437,11 @@ script = ExtResource("1_gyv0f")
color = 11
flowers_export = Array[Dictionary]([{
"color": 18,
"position": Vector2i(1039, 392),
"position": Vector2i(912, 276),
"type": 0
}, {
"color": 18,
"position": Vector2i(879, 1168),
"position": Vector2i(1132, 1428),
"type": 1
}, {
"color": 18,
@@ -449,11 +449,11 @@ flowers_export = Array[Dictionary]([{
"type": 2
}, {
"color": 18,
"position": Vector2i(1919, 236),
"position": Vector2i(1928, 536),
"type": 3
}, {
"color": 18,
"position": Vector2i(195, 1104),
"position": Vector2i(136, 1496),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -476,23 +476,23 @@ script = ExtResource("1_gyv0f")
color = 12
flowers_export = Array[Dictionary]([{
"color": 12,
"position": Vector2i(914, 500),
"position": Vector2i(944, 80),
"type": 0
}, {
"color": 12,
"position": Vector2i(1638, 736),
"position": Vector2i(1444, 1088),
"type": 1
}, {
"color": 12,
"position": Vector2i(1958, 248),
"position": Vector2i(2004, 500),
"type": 2
}, {
"color": 12,
"position": Vector2i(634, 800),
"position": Vector2i(672, 1168),
"type": 3
}, {
"color": 12,
"position": Vector2i(354, 732),
"position": Vector2i(272, 836),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -515,23 +515,23 @@ script = ExtResource("1_gyv0f")
color = 13
flowers_export = Array[Dictionary]([{
"color": 2,
"position": Vector2i(817, 388),
"position": Vector2i(868, 564),
"type": 0
}, {
"color": 2,
"position": Vector2i(558, 808),
"position": Vector2i(664, 1200),
"type": 1
}, {
"color": 2,
"position": Vector2i(1410, 752),
"position": Vector2i(1728, 972),
"type": 2
}, {
"color": 2,
"position": Vector2i(1442, 256),
"position": Vector2i(1456, 508),
"type": 3
}, {
"color": 2,
"position": Vector2i(1852, 368),
"position": Vector2i(1316, 1372),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
@@ -554,15 +554,15 @@ script = ExtResource("1_gyv0f")
color = 14
flowers_export = Array[Dictionary]([{
"color": 5,
"position": Vector2i(859, 728),
"position": Vector2i(1176, 416),
"type": 0
}, {
"color": 5,
"position": Vector2i(239, 208),
"position": Vector2i(256, 508),
"type": 1
}, {
"color": 5,
"position": Vector2i(943, 136),
"position": Vector2i(1420, 1496),
"type": 2
}, {
"color": 5,
@@ -593,7 +593,7 @@ script = ExtResource("1_gyv0f")
color = 15
flowers_export = Array[Dictionary]([{
"color": 17,
"position": Vector2i(1252, 1108),
"position": Vector2i(1048, 1260),
"type": 0
}, {
"color": 17,
@@ -601,15 +601,15 @@ flowers_export = Array[Dictionary]([{
"type": 1
}, {
"color": 17,
"position": Vector2i(2060, 940),
"position": Vector2i(2064, 1088),
"type": 2
}, {
"color": 17,
"position": Vector2i(992, -68),
"position": Vector2i(972, 140),
"type": 3
}, {
"color": 17,
"position": Vector2i(944, 640),
"position": Vector2i(1200, 432),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
+623
View File
@@ -0,0 +1,623 @@
[gd_resource type="Resource" script_class="GardensLayout" load_steps=19 format=3 uid="uid://8v0g8bpx5mh0"]
[ext_resource type="Script" path="res://resources/gardens/garden_layout.gd" id="1_gyv0f"]
[ext_resource type="Script" path="res://resources/gardens/gardens_layout.gd" id="2_w74ow"]
[sub_resource type="Resource" id="Resource_sb4fa"]
script = ExtResource("1_gyv0f")
color = 0
flowers_export = Array[Dictionary]([{
"color": 0,
"position": Vector2i(1464, 1092),
"type": 4
}, {
"color": 0,
"position": Vector2i(512, 884),
"type": 0
}, {
"color": 0,
"position": Vector2i(250, 288),
"type": 3
}, {
"color": 0,
"position": Vector2i(1072, 196),
"type": 1
}, {
"color": 0,
"position": Vector2i(1736, 196),
"type": 2
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(87, -281),
"position": Vector2i(121, 841)
}, {
"path_out_position": Vector2i(399, 447),
"position": Vector2i(641, 309)
}, {
"path_out_position": Vector2i(551, 227),
"position": Vector2i(1105, 1121)
}, {
"path_out_position": Vector2i(813, -897),
"position": Vector2i(1885, 977)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_vavwh"]
script = ExtResource("1_gyv0f")
color = 1
flowers_export = Array[Dictionary]([{
"color": 1,
"position": Vector2i(1494, 20),
"type": 0
}, {
"color": 1,
"position": Vector2i(1198, 256),
"type": 1
}, {
"color": 1,
"position": Vector2i(1525, 1260),
"type": 2
}, {
"color": 1,
"position": Vector2i(223, 1064),
"type": 3
}, {
"color": 1,
"position": Vector2i(668, 736),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(379, 379),
"position": Vector2i(675, 177)
}, {
"path_out_position": Vector2i(548, 220),
"position": Vector2i(359, 749)
}, {
"path_out_position": Vector2i(371, 55),
"position": Vector2i(1019, 1237)
}, {
"path_out_position": Vector2i(-93, -301),
"position": Vector2i(1631, 793)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_rabgc"]
script = ExtResource("1_gyv0f")
color = 2
flowers_export = Array[Dictionary]([{
"color": 13,
"position": Vector2i(400, 250),
"type": 0
}, {
"color": 13,
"position": Vector2i(1281, 20),
"type": 1
}, {
"color": 13,
"position": Vector2i(1925, 584),
"type": 2
}, {
"color": 13,
"position": Vector2i(557, 936),
"type": 4
}, {
"color": 13,
"position": Vector2i(1342, 1072),
"type": 3
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(349, 799),
"position": Vector2i(88, 325)
}, {
"path_out_position": Vector2i(83, -345),
"position": Vector2i(966, 1157)
}, {
"path_out_position": Vector2i(583, -269),
"position": Vector2i(806, 257)
}, {
"path_out_position": Vector2i(722, -757),
"position": Vector2i(1678, 1149)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_b5yea"]
script = ExtResource("1_gyv0f")
color = 3
flowers_export = Array[Dictionary]([{
"color": 3,
"position": Vector2i(320, 700),
"type": 0
}, {
"color": 3,
"position": Vector2i(868, 316),
"type": 1
}, {
"color": 3,
"position": Vector2i(741, 912),
"type": 2
}, {
"color": 3,
"position": Vector2i(1456, 1024),
"type": 3
}, {
"color": 3,
"position": Vector2i(1620, 604),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(463, 3),
"position": Vector2i(182, 125)
}, {
"path_out_position": Vector2i(-113, 883),
"position": Vector2i(702, 265)
}, {
"path_out_position": Vector2i(936, 19),
"position": Vector2i(1129, 1217)
}, {
"path_out_position": Vector2i(752, 471),
"position": Vector2i(1917, 385)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_fa44t"]
script = ExtResource("1_gyv0f")
color = 4
flowers_export = Array[Dictionary]([{
"color": 8,
"position": Vector2i(333, 1100),
"type": 0
}, {
"color": 8,
"position": Vector2i(1249, 28),
"type": 1
}, {
"color": 8,
"position": Vector2i(1705, 532),
"type": 2
}, {
"color": 8,
"position": Vector2i(985, 708),
"type": 3
}, {
"color": 8,
"position": Vector2i(321, 184),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(223, -213),
"position": Vector2i(494, 889)
}, {
"path_out_position": Vector2i(248, -256),
"position": Vector2i(862, 165)
}, {
"path_out_position": Vector2i(816, 755),
"position": Vector2i(1858, 197)
}, {
"path_out_position": Vector2i(-313, -197),
"position": Vector2i(2992, 969)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_5h4pi"]
script = ExtResource("1_gyv0f")
color = 5
flowers_export = Array[Dictionary]([{
"color": 5,
"position": Vector2i(540, 388),
"type": 0
}, {
"color": 5,
"position": Vector2i(1104, 1028),
"type": 1
}, {
"color": 5,
"position": Vector2i(210, 752),
"type": 2
}, {
"color": 5,
"position": Vector2i(540, -24),
"type": 3
}, {
"color": 5,
"position": Vector2i(1704, 864),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(595, 155),
"position": Vector2i(225, 393)
}, {
"path_out_position": Vector2i(483, 303),
"position": Vector2i(865, 129)
}, {
"path_out_position": Vector2i(299, -105),
"position": Vector2i(1433, 741)
}, {
"path_out_position": Vector2i(786, 1163),
"position": Vector2i(1845, 361)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_0s64a"]
script = ExtResource("1_gyv0f")
color = 6
flowers_export = Array[Dictionary]([{
"color": 6,
"position": Vector2i(1375, 980),
"type": 0
}, {
"color": 6,
"position": Vector2i(231, 728),
"type": 1
}, {
"color": 6,
"position": Vector2i(1035, 140),
"type": 2
}, {
"color": 6,
"position": Vector2i(1699, 152),
"type": 3
}, {
"color": 6,
"position": Vector2i(627, 644),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(459, -69),
"position": Vector2i(596, 1249)
}, {
"path_out_position": Vector2i(-461, -237),
"position": Vector2i(1156, 713)
}, {
"path_out_position": Vector2i(727, 235),
"position": Vector2i(628, 45)
}, {
"path_out_position": Vector2i(515, -293),
"position": Vector2i(1764, 813)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_s4fet"]
script = ExtResource("1_gyv0f")
color = 7
flowers_export = Array[Dictionary]([{
"color": 1,
"position": Vector2i(1366, -28),
"type": 0
}, {
"color": 1,
"position": Vector2i(390, 476),
"type": 1
}, {
"color": 1,
"position": Vector2i(94, 896),
"type": 2
}, {
"color": 1,
"position": Vector2i(1074, 164),
"type": 3
}, {
"color": 1,
"position": Vector2i(1538, 1036),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(631, 223),
"position": Vector2i(359, 1277)
}, {
"path_out_position": Vector2i(-449, -181),
"position": Vector2i(1251, 1309)
}, {
"path_out_position": Vector2i(775, 363),
"position": Vector2i(723, 13)
}, {
"path_out_position": Vector2i(1060, 223),
"position": Vector2i(1607, 737)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_r4707"]
script = ExtResource("1_gyv0f")
color = 8
flowers_export = Array[Dictionary]([{
"color": 14,
"position": Vector2i(1231, 1012),
"type": 0
}, {
"color": 14,
"position": Vector2i(331, 164),
"type": 1
}, {
"color": 14,
"position": Vector2i(563, 700),
"type": 2
}, {
"color": 14,
"position": Vector2i(1111, 44),
"type": 3
}, {
"color": 14,
"position": Vector2i(879, 328),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(491, 227),
"position": Vector2i(324, 1297)
}, {
"path_out_position": Vector2i(267, -165),
"position": Vector2i(992, 1401)
}, {
"path_out_position": Vector2i(391, -205),
"position": Vector2i(1304, 825)
}, {
"path_out_position": Vector2i(465, 235),
"position": Vector2i(1800, 453)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_tpy30"]
script = ExtResource("1_gyv0f")
color = 9
flowers_export = Array[Dictionary]([{
"color": 9,
"position": Vector2i(629, 80),
"type": 0
}, {
"color": 9,
"position": Vector2i(1200, 108),
"type": 1
}, {
"color": 9,
"position": Vector2i(541, 896),
"type": 2
}, {
"color": 9,
"position": Vector2i(1361, 968),
"type": 3
}, {
"color": 9,
"position": Vector2i(1588, 452),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(343, -277),
"position": Vector2i(90, 1113)
}, {
"path_out_position": Vector2i(419, 463),
"position": Vector2i(446, 613)
}, {
"path_out_position": Vector2i(194, -705),
"position": Vector2i(902, 1421)
}, {
"path_out_position": Vector2i(1772, 839),
"position": Vector2i(938, 77)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_pp244"]
script = ExtResource("1_gyv0f")
color = 10
flowers_export = Array[Dictionary]([{
"color": 10,
"position": Vector2i(950, 1144),
"type": 0
}, {
"color": 10,
"position": Vector2i(1826, 440),
"type": 1
}, {
"color": 10,
"position": Vector2i(926, 480),
"type": 2
}, {
"color": 10,
"position": Vector2i(574, 8),
"type": 3
}, {
"color": 10,
"position": Vector2i(187, 440),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(-409, -389),
"position": Vector2i(639, 661)
}, {
"path_out_position": Vector2i(202, -134),
"position": Vector2i(971, 165)
}, {
"path_out_position": Vector2i(358, 366),
"position": Vector2i(1511, 217)
}, {
"path_out_position": Vector2i(804, 168),
"position": Vector2i(1427, 973)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_ydxer"]
script = ExtResource("1_gyv0f")
color = 11
flowers_export = Array[Dictionary]([{
"color": 18,
"position": Vector2i(1039, 392),
"type": 0
}, {
"color": 18,
"position": Vector2i(879, 1168),
"type": 1
}, {
"color": 18,
"position": Vector2i(1523, 848),
"type": 2
}, {
"color": 18,
"position": Vector2i(1919, 236),
"type": 3
}, {
"color": 18,
"position": Vector2i(195, 1104),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(199, -133),
"position": Vector2i(132, 745)
}, {
"path_out_position": Vector2i(187, 459),
"position": Vector2i(420, 369)
}, {
"path_out_position": Vector2i(459, -345),
"position": Vector2i(512, 1333)
}, {
"path_out_position": Vector2i(535, -141),
"position": Vector2i(1136, 85)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_vifpe"]
script = ExtResource("1_gyv0f")
color = 12
flowers_export = Array[Dictionary]([{
"color": 12,
"position": Vector2i(914, 500),
"type": 0
}, {
"color": 12,
"position": Vector2i(1638, 736),
"type": 1
}, {
"color": 12,
"position": Vector2i(1958, 248),
"type": 2
}, {
"color": 12,
"position": Vector2i(634, 800),
"type": 3
}, {
"color": 12,
"position": Vector2i(354, 732),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(87, 679),
"position": Vector2i(535, 185)
}, {
"path_out_position": Vector2i(451, 343),
"position": Vector2i(127, 1269)
}, {
"path_out_position": Vector2i(-137, -821),
"position": Vector2i(927, 1249)
}, {
"path_out_position": Vector2i(894, 971),
"position": Vector2i(1163, 177)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_blfde"]
script = ExtResource("1_gyv0f")
color = 13
flowers_export = Array[Dictionary]([{
"color": 2,
"position": Vector2i(817, 388),
"type": 0
}, {
"color": 2,
"position": Vector2i(558, 808),
"type": 1
}, {
"color": 2,
"position": Vector2i(1410, 752),
"type": 2
}, {
"color": 2,
"position": Vector2i(1442, 256),
"type": 3
}, {
"color": 2,
"position": Vector2i(1852, 368),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(-93, -505),
"position": Vector2i(170, 1229)
}, {
"path_out_position": Vector2i(355, -301),
"position": Vector2i(378, 381)
}, {
"path_out_position": Vector2i(471, -129),
"position": Vector2i(1094, 141)
}, {
"path_out_position": Vector2i(1105, -145),
"position": Vector2i(1718, 209)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_ar07c"]
script = ExtResource("1_gyv0f")
color = 14
flowers_export = Array[Dictionary]([{
"color": 5,
"position": Vector2i(859, 728),
"type": 0
}, {
"color": 5,
"position": Vector2i(239, 208),
"type": 1
}, {
"color": 5,
"position": Vector2i(943, 136),
"type": 2
}, {
"color": 5,
"position": Vector2i(2007, 688),
"type": 3
}, {
"color": 5,
"position": Vector2i(747, 1012),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(575, 3),
"position": Vector2i(776, 141)
}, {
"path_out_position": Vector2i(-357, 591),
"position": Vector2i(1488, 253)
}, {
"path_out_position": Vector2i(79, 475),
"position": Vector2i(166, 817)
}, {
"path_out_position": Vector2i(2608, -837),
"position": Vector2i(412, 1449)
}])
is_first_or_last = 1
[sub_resource type="Resource" id="Resource_hkny7"]
script = ExtResource("1_gyv0f")
color = 15
flowers_export = Array[Dictionary]([{
"color": 17,
"position": Vector2i(1252, 1108),
"type": 0
}, {
"color": 17,
"position": Vector2i(192, 132),
"type": 1
}, {
"color": 17,
"position": Vector2i(2060, 940),
"type": 2
}, {
"color": 17,
"position": Vector2i(992, -68),
"type": 3
}, {
"color": 17,
"position": Vector2i(944, 640),
"type": 4
}])
lesson_buttons_export = Array[Dictionary]([{
"path_out_position": Vector2i(0, 0),
"position": Vector2i(1369, 753)
}])
is_first_or_last = 1
[resource]
script = ExtResource("2_w74ow")
gardens = Array[ExtResource("1_gyv0f")]([SubResource("Resource_sb4fa"), SubResource("Resource_vavwh"), SubResource("Resource_rabgc"), SubResource("Resource_b5yea"), SubResource("Resource_fa44t"), SubResource("Resource_5h4pi"), SubResource("Resource_0s64a"), SubResource("Resource_s4fet"), SubResource("Resource_r4707"), SubResource("Resource_tpy30"), SubResource("Resource_pp244"), SubResource("Resource_ydxer"), SubResource("Resource_vifpe"), SubResource("Resource_blfde"), SubResource("Resource_ar07c"), SubResource("Resource_hkny7")])
File diff suppressed because one or more lines are too long
+3
View File
@@ -41,6 +41,9 @@ func get_max_unlocked_lesson() -> int:
return max_unlocked_level
func is_lesson_completed(lesson_number: int) -> bool:
return unlocks[lesson_number]["look_and_learn"] == Status.Completed and unlocks[lesson_number]["games"][0] == Status.Completed and unlocks[lesson_number]["games"][1] == Status.Completed and unlocks[lesson_number]["games"][2] == Status.Completed
func look_and_learn_completed(lesson_number: int) -> void:
unlocks[lesson_number]["look_and_learn"] = Status.Completed
+33 -20
View File
@@ -1,5 +1,8 @@
extends Control
# Namespace
const LessonButton: = preload("res://sources/lesson_screen/lesson_button.gd")
const garden_scene: = preload("res://resources/gardens/garden.tscn")
const garden_size: = 2400
@@ -41,7 +44,7 @@ const minigame_button_scene: = preload("res://sources/lesson_screen/minigame_but
@onready var scroll_container: ScrollContainer = $ScrollContainer
@onready var parallax_background: = %ParallaxBackground
@onready var minigame_selection: Control = %MinigameSelection
@onready var lesson_button: TextureButton = %LessonButton
@onready var lesson_button: LessonButton = %LessonButton
@onready var back_button: TextureButton = %BackButton
@onready var right_audio_stream_player: AudioStreamPlayer = $RightAudioStreamPlayer
@onready var left_audio_stream_player: AudioStreamPlayer = $LeftAudioStreamPlayer
@@ -64,7 +67,7 @@ var in_minigame_selection: = false
var current_lesson_number: = -1
var current_garden: = -1
var current_button_global_position: = Vector2.ZERO
var current_button: TextureButton
var current_button: LessonButton
static var transition_data: Dictionary
@@ -81,6 +84,8 @@ func _ready() -> void:
_back_to_correct_spot()
await get_tree().process_frame
if UserDataManager.student_progression:
UserDataManager.student_progression.unlocks_changed.connect(_on_progression_unlocks_changed)
_on_progression_unlocks_changed()
@@ -95,6 +100,8 @@ func _ready() -> void:
for i in garden_control.lesson_button_controls.size():
if not lesson_ind in lessons:
break
if UserDataManager.student_progression:
var unlock: Dictionary = UserDataManager.student_progression.unlocks[lesson_ind]
var look_and_learn_unlocked: bool = unlock["look_and_learn"] == UserProgression.Status.Unlocked
var exercice_unlock_1: bool = unlock["games"][0] == UserProgression.Status.Unlocked
@@ -144,7 +151,7 @@ func _setup_minigame_selection() -> void:
var lesson_unlocks: Dictionary = UserDataManager.student_progression.unlocks[current_lesson_number]
lesson_button.text = lessons[current_lesson_number][0].grapheme
lesson_button.display_text = true
lesson_button.completed_color = garden_parent.get_child(current_garden).color
if lesson_unlocks["look_and_learn"] == UserProgression.Status.Locked:
lesson_button.disabled = true
else:
@@ -243,28 +250,26 @@ func set_up_path() -> void:
locked_line.points = curve.get_baked_points()
func _on_garden_lesson_button_pressed(button: TextureButton, lesson_ind: int, garden_ind: int, button_global_position: = Vector2.ZERO, tween_duration: = 0.25) -> void:
func _on_garden_lesson_button_pressed(button: LessonButton, lesson_ind: int, garden_ind: int, button_global_position: = Vector2.ZERO, tween_duration: = 0.25) -> void:
if in_minigame_selection:
return
if button:
button_global_position = button.global_position
current_button = button
current_button.visible = false
current_button.show_placeholder(true)
current_button_global_position = button_global_position
current_lesson_number = lesson_ind
current_garden = garden_ind
in_minigame_selection = true
_setup_minigame_selection()
minigame_selection.visible = true
back_button.disabled = true
#for other_button: TextureButton in garden_parent.get_child(current_garden).lesson_button_controls:
# other_button.disabled = true
back_button.visible = false
minigame_background.size = 300.0 * Vector2.ONE
minigame_background.global_position = current_button_global_position
minigame_background.visible = true
#minigame_background_center.modulate = garden_parent.get_child(garden_ind).color
var tween: = create_tween().set_parallel(true).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
tween.tween_property(minigame_background, "scale", (1800.0 / 300.0) * Vector2.ONE, tween_duration)
@@ -273,7 +278,7 @@ func _on_garden_lesson_button_pressed(button: TextureButton, lesson_ind: int, ga
await tween.finished
back_button.disabled = false
lesson_button.disabled = false
in_minigame_selection = true
func _on_lesson_button_pressed() -> void:
@@ -303,6 +308,9 @@ func _on_progression_unlocks_changed() -> void:
if not garden_parent:
return
if not UserDataManager.student_progression:
return
var lesson_ind: = 1
for garden_control in garden_parent.get_children():
if not lesson_ind in lessons:
@@ -327,6 +335,8 @@ func _on_progression_unlocks_changed() -> void:
garden_total_unlocks += 2.0
garden_control.lesson_button_controls[i].completed = UserDataManager.student_progression.is_lesson_completed(lesson_ind)
for k in range(3):
garden_total_unlocks += 2.0
match UserDataManager.student_progression.unlocks[lesson_ind]["games"][k]:
@@ -396,14 +406,19 @@ func _on_scroll_container_gui_input(event: InputEvent) -> void:
func _on_back_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/menus/brain/brain.tscn")
func _on_area_2d_input_event(viewport, event, shape_idx):
if event.is_action_pressed("left_click"):
if in_minigame_selection:
lesson_button.disabled = true
#lesson_button.disabled = true
var minigame_buttons: = minigame_container_1.get_children()
minigame_buttons.append_array(minigame_container_2.get_children())
minigame_buttons.append_array(minigame_container_3.get_children())
for minigame_button in minigame_buttons:
minigame_button.disabled = false
back_button.disabled = true
var tween: = create_tween().set_parallel(true).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
tween.tween_property(minigame_selection, "modulate:a", 0.0, 0.25)
@@ -413,15 +428,13 @@ func _on_back_button_pressed() -> void:
await tween.finished
if current_button:
current_button.visible = true
current_button.show_placeholder(false)
in_minigame_selection = false
minigame_selection.visible = false
minigame_background.visible = false
back_button.disabled = false
back_button.visible = true
# Handles lesson buttons
_on_progression_unlocks_changed()
else:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/menus/brain/brain.tscn")
in_minigame_selection = false
+41 -17
View File
@@ -15,7 +15,6 @@
[ext_resource type="Texture2D" uid="uid://cffuqacgb1jra" path="res://assets/lesson_screen/branches.png" id="7_axgdc"]
[ext_resource type="PackedScene" uid="uid://dl5wx8l0awoi0" path="res://sources/minigames/frog/frog_minigame.tscn" id="7_o1s4m"]
[ext_resource type="PackedScene" uid="uid://df5oba70wj13y" path="res://sources/minigames/ants/ants_minigame.tscn" id="8_g4mhc"]
[ext_resource type="PackedScene" uid="uid://bw820nbyowrqy" path="res://sources/lesson_screen/lesson_label_button.tscn" id="8_pehag"]
[ext_resource type="Texture2D" uid="uid://c3okdxpi317x5" path="res://assets/minigames/monkeys/graphic/gauge_icon_monkey_full.png" id="9_68su4"]
[ext_resource type="Texture2D" uid="uid://re7qgivb3n5w" path="res://assets/minigames/frog/graphics/gauge_icon_frog_full.png" id="10_5wvwc"]
[ext_resource type="Texture2D" uid="uid://nwbekpbuu472" path="res://assets/minigames/ants/graphics/gauge_icon_ant_full.png" id="12_ohgqx"]
@@ -27,6 +26,7 @@
[ext_resource type="Texture2D" uid="uid://dlnklpyefn0m2" path="res://assets/lesson_screen/big_button_center.png" id="21_r0a4h"]
[ext_resource type="Texture2D" uid="uid://dkomjpclxvmqf" path="res://assets/lesson_screen/top_left.png" id="23_p1d10"]
[ext_resource type="Texture2D" uid="uid://rux5delnabp5" path="res://assets/lesson_screen/top_right.png" id="24_30f83"]
[ext_resource type="PackedScene" uid="uid://delcgui3v0eek" path="res://sources/lesson_screen/lesson_button.tscn" id="25_0ruwb"]
[ext_resource type="Texture2D" uid="uid://cqhbpt3lk6f15" path="res://assets/lesson_screen/bottom.png" id="25_tyvq6"]
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_ey6av"]
@@ -61,6 +61,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_qlsw4")
syllable_minigames = Array[PackedScene]([ExtResource("3_vqohy"), ExtResource("4_cvoj1")])
syllable_minigames_icons = Array[Texture]([ExtResource("5_h8c5w"), ExtResource("6_p30hm")])
@@ -166,6 +167,9 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
mouse_filter = 2
texture = ExtResource("20_elp7t")
expand_mode = 1
stretch_mode = 5
@@ -179,14 +183,15 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("21_r0a4h")
expand_mode = 1
stretch_mode = 5
[node name="MinigameSelection" type="Control" parent="CanvasLayer"]
unique_name_in_owner = true
visible = false
modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(1800, 1800)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@@ -194,6 +199,7 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(1280, 900)
mouse_filter = 2
[node name="MinigameBackground1" type="TextureRect" parent="CanvasLayer/MinigameSelection"]
unique_name_in_owner = true
@@ -201,6 +207,7 @@ modulate = Color(0, 0, 0, 0)
layout_mode = 0
offset_right = 2560.0
offset_bottom = 1800.0
mouse_filter = 2
texture = ExtResource("23_p1d10")
[node name="MinigameBackground2" type="TextureRect" parent="CanvasLayer/MinigameSelection"]
@@ -209,6 +216,7 @@ modulate = Color(0, 0, 0, 0)
layout_mode = 0
offset_right = 2560.0
offset_bottom = 1800.0
mouse_filter = 2
texture = ExtResource("24_30f83")
[node name="MinigameBackground3" type="TextureRect" parent="CanvasLayer/MinigameSelection"]
@@ -217,6 +225,7 @@ modulate = Color(0, 0, 0, 0)
layout_mode = 0
offset_right = 2560.0
offset_bottom = 1800.0
mouse_filter = 2
texture = ExtResource("25_tyvq6")
[node name="Branches" type="TextureRect" parent="CanvasLayer/MinigameSelection"]
@@ -229,20 +238,20 @@ grow_vertical = 2
mouse_filter = 2
texture = ExtResource("7_axgdc")
[node name="LessonButton" parent="CanvasLayer/MinigameSelection" instance=ExtResource("8_pehag")]
[node name="LessonButton" parent="CanvasLayer/MinigameSelection" instance=ExtResource("25_0ruwb")]
unique_name_in_owner = true
layout_mode = 0
offset_left = 1088.0
offset_top = 708.0
offset_right = 1344.0
offset_bottom = 964.0
scale = Vector2(1.5, 1.5)
size_flags_horizontal = 1
size_flags_vertical = 1
disabled = true
[node name="Label" parent="CanvasLayer/MinigameSelection/LessonButton" index="1"]
theme_override_font_sizes/font_size = 92
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -192.0
offset_top = -192.0
offset_right = 192.0
offset_bottom = 192.0
grow_horizontal = 2
grow_vertical = 2
[node name="MinigameContainer1" type="HFlowContainer" parent="CanvasLayer/MinigameSelection"]
unique_name_in_owner = true
@@ -285,8 +294,23 @@ texture_normal = ExtResource("4_neut5")
texture_pressed = ExtResource("5_2yuxn")
texture_disabled = ExtResource("6_gs6gi")
[node name="Area2D" type="Area2D" parent="CanvasLayer"]
z_index = 20
z_as_relative = false
monitoring = false
monitorable = false
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="CanvasLayer/Area2D"]
position = Vector2(250, 1546)
polygon = PackedVector2Array(1030, -1546, -250, -1546, -250, 254, 1030, 254, 774, 225, 630, 163, 449, 44, 264, -167, 163, -383, 125, -619, 158, -890, 251, -1101, 390, -1282, 563, -1416, 710, -1490, 838, -1522)
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="CanvasLayer/Area2D"]
position = Vector2(2312, 1544)
rotation = -3.14159
scale = Vector2(1, -1)
polygon = PackedVector2Array(1030, -1546, -250, -1546, -250, 254, 1030, 254, 774, 225, 630, 163, 449, 44, 264, -167, 163, -383, 125, -619, 158, -890, 251, -1101, 390, -1282, 563, -1416, 710, -1490, 838, -1522)
[connection signal="gui_input" from="ScrollContainer" to="." method="_on_scroll_container_gui_input"]
[connection signal="pressed" from="CanvasLayer/MinigameSelection/LessonButton" to="." method="_on_lesson_button_pressed"]
[connection signal="pressed" from="CanvasLayer/BackButton" to="." method="_on_back_button_pressed"]
[editable path="CanvasLayer/MinigameSelection/LessonButton"]
[connection signal="input_event" from="CanvasLayer/Area2D" to="." method="_on_area_2d_input_event"]
+82 -78
View File
@@ -2,7 +2,7 @@ extends "res://sources/gardens/gardens.gd"
const garden_textures_nb: = 20
const flower_types_nb: = 5
const gardens_layout_resource_path: = "user://gardens_layout.tres"
const gardens_layout_resource_path: = "res://resources/gardens/gardens_layout.tres"
var dragging_element
@@ -48,6 +48,87 @@ func set_up_click_detection() -> void:
lesson_button_control.gui_input.connect(_on_lesson_button_gui_input.bind(garden_control_ind, lesson_button_ind, lesson_button_control))
func _process(delta: float) -> void:
super(delta)
if dragging_element != null:
if dragging_element is Control:
dragging_element.position = _correct_position(dragging_element, dragging_element.get_parent().get_local_mouse_position())
if drag_data.type == "lesson_button":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.lesson_button_ind].position = dragging_element.position
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
garden_parent.get_child(drag_data.garden_ind).set_lesson_buttons(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons)
set_up_path()
elif drag_data.type == "path_middle":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.sub_ind].path_out_position = garden_parent.get_child(drag_data.garden_ind).get_local_mouse_position() - Vector2(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.sub_ind].position)
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
garden_parent.get_child(drag_data.garden_ind).set_lesson_buttons(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons)
set_up_path()
func _input(event: InputEvent) -> void:
if dragging_element == null:
return
if event.is_action_released("left_click"):
if drag_data.type == "flower":
dragging_element.z_index = 2
gardens_layout.gardens[drag_data.garden_ind].flowers[drag_data.flower_ind].position = dragging_element.get_parent().get_local_mouse_position()
gardens_layout.gardens[drag_data.garden_ind].flowers = gardens_layout.gardens[drag_data.garden_ind].flowers
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
elif drag_data.type == "lesson_button":
dragging_element.z_index = 1
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.lesson_button_ind].position = dragging_element.get_parent().get_local_mouse_position()
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
elif drag_data.type == "path_middle":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
dragging_element = null
#func _unhandled_input(event: InputEvent) -> void:
# if event.is_action_pressed("left_click"):
# if curve.get_closest_point(line.get_local_mouse_position()).distance_to(line.get_local_mouse_position()) < line.width:
# dragging_element = get_previous_point_on_curve()
# var a: = get_garden_and_sub_ind_from_ind(dragging_element)
# drag_data = {
# type = "path_middle",
# garden_ind = a[0],
# sub_ind = a[1],
# }
#func get_previous_point_on_curve() -> int:
# var offset: = curve.get_closest_offset(line.get_local_mouse_position())
# for i in curve.point_count:
# var point_offset = curve.get_closest_offset(curve.get_point_position(i))
# if point_offset > offset:
# return i - 1
# return curve.point_count
func get_garden_and_sub_ind_from_ind(ind: int) -> Array[int]:
var count: = 0
for garden_control_ind in garden_parent.get_child_count():
var garden_control: Control = garden_parent.get_child(garden_control_ind)
for lesson_button_ind in garden_control.lesson_button_controls.size():
if count == ind:
return [garden_control_ind, lesson_button_ind]
count += 1
return [-1, -1]
func get_best_showing_garden() -> int:
for garden_ind in garden_parent.get_child_count():
var garden_control: Control = garden_parent.get_child(garden_ind)
if abs(garden_control.global_position.x) < garden_control.size.x / 2:
return garden_ind
return -1
func _correct_position(element: Control, pos: Vector2) -> Vector2:
return Vector2(pos.x - element.size.x/2, pos.y - element.size.y)
func _on_flower_gui_input(event: InputEvent, garden_control_ind: int, flower_ind: int, flower_control: Control) -> void:
if event.is_action_pressed("left_click"):
dragging_element = flower_control
@@ -80,83 +161,6 @@ func _on_lesson_button_gui_input(event: InputEvent, garden_control_ind: int, les
get_viewport().set_input_as_handled()
func _process(delta: float) -> void:
super(delta)
if dragging_element != null:
if dragging_element is Control:
dragging_element.position = dragging_element.get_parent().get_local_mouse_position()
if drag_data.type == "lesson_button":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.lesson_button_ind].position = dragging_element.position
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
garden_parent.get_child(drag_data.garden_ind).set_lesson_buttons(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons)
set_up_path()
elif drag_data.type == "path_middle":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.sub_ind].path_out_position = garden_parent.get_child(drag_data.garden_ind).get_local_mouse_position() - Vector2(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.sub_ind].position)
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
garden_parent.get_child(drag_data.garden_ind).set_lesson_buttons(gardens_layout.gardens[drag_data.garden_ind].lesson_buttons)
set_up_path()
func _input(event: InputEvent) -> void:
if dragging_element == null:
return
if event.is_action_released("left_click"):
if drag_data.type == "flower":
dragging_element.z_index = 2
gardens_layout.gardens[drag_data.garden_ind].flowers[drag_data.flower_ind].position = dragging_element.position
gardens_layout.gardens[drag_data.garden_ind].flowers = gardens_layout.gardens[drag_data.garden_ind].flowers
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
elif drag_data.type == "lesson_button":
dragging_element.z_index = 1
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons[drag_data.lesson_button_ind].position = dragging_element.position
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
elif drag_data.type == "path_middle":
gardens_layout.gardens[drag_data.garden_ind].lesson_buttons = gardens_layout.gardens[drag_data.garden_ind].lesson_buttons
ResourceSaver.save(gardens_layout, gardens_layout.resource_path)
dragging_element = null
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("left_click"):
if curve.get_closest_point(line.get_local_mouse_position()).distance_to(line.get_local_mouse_position()) < line.width:
dragging_element = get_previous_point_on_curve()
var a: = get_garden_and_sub_ind_from_ind(dragging_element)
drag_data = {
type = "path_middle",
garden_ind = a[0],
sub_ind = a[1],
}
func get_previous_point_on_curve() -> int:
var offset: = curve.get_closest_offset(line.get_local_mouse_position())
for i in curve.point_count:
var point_offset = curve.get_closest_offset(curve.get_point_position(i))
if point_offset > offset:
return i - 1
return curve.point_count
func get_garden_and_sub_ind_from_ind(ind: int) -> Array[int]:
var count: = 0
for garden_control_ind in garden_parent.get_child_count():
var garden_control: Control = garden_parent.get_child(garden_control_ind)
for lesson_button_ind in garden_control.lesson_button_controls.size():
if count == ind:
return [garden_control_ind, lesson_button_ind]
count += 1
return [-1, -1]
func get_best_showing_garden() -> int:
for garden_ind in garden_parent.get_child_count():
var garden_control: Control = garden_parent.get_child(garden_ind)
if abs(garden_control.global_position.x) < garden_control.size.x / 2:
return garden_ind
return -1
func _on_change_flower_color_button_pressed() -> void:
var garden_ind: = get_best_showing_garden()
var flowers: = gardens_layout.gardens[garden_ind].flowers
+4 -4
View File
@@ -19,16 +19,16 @@ mouse_filter = 2
[node name="Control2" parent="ScrollContainer/HBoxContainer" index="2"]
mouse_filter = 2
[node name="HBoxContainer" type="HBoxContainer" parent="." index="1"]
[node name="HBoxContainer" type="HBoxContainer" parent="." index="5"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -623.0
offset_top = -140.0
offset_right = 623.0
offset_left = -914.0
offset_top = -143.0
offset_right = 914.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/separation = 20
+38 -9
View File
@@ -1,21 +1,50 @@
extends TextureButton
@export_color_no_alpha var base_color: Color:
set = _set_base_color
@export_color_no_alpha var completed_color: Color:
set = _set_completed_color
@export var text: String:
set = _set_text
@export var completed: = false:
set = _set_completed
const completed_up: = preload("res://assets/lesson_screen/button_completed_up.png")
const completed_down: = preload("res://assets/lesson_screen/button_completed_down.png")
@onready var center: TextureRect = %Center
@onready var label: Label = %Label
@onready var placeholder: TextureRect = %Placeholder
const progress_up: = preload("res://assets/lesson_screen/button_progress_up.png")
const progress_down: = preload("res://assets/lesson_screen/button_progress_down.png")
func _ready():
_set_base_color(base_color)
_set_completed_color(completed_color)
_set_text(text)
func show_placeholder(is_shown: bool) -> void:
placeholder.visible = is_shown
label.visible = !is_shown
func _set_base_color(color: Color) -> void:
base_color = color
if center and not completed:
center.modulate = color
func _set_completed_color(color: Color) -> void:
completed_color = color
if center and completed:
center.modulate = color
func _set_text(value: String) -> void:
text = value
if label:
label.text = text
func _set_completed(value: bool) -> void:
completed = value
if completed:
texture_normal = completed_up
texture_pressed = completed_down
center.modulate = completed_color
else:
texture_normal = progress_up
texture_pressed = progress_down
center.modulate = base_color
+54 -8
View File
@@ -1,17 +1,63 @@
[gd_scene load_steps=5 format=3 uid="uid://delcgui3v0eek"]
[gd_scene load_steps=7 format=3 uid="uid://delcgui3v0eek"]
[ext_resource type="Texture2D" uid="uid://s2plf17ct78u" path="res://assets/lesson_screen/button_progress_up.png" id="1_wosm1"]
[ext_resource type="Texture2D" uid="uid://3yhvm8k8kabq" path="res://assets/lesson_screen/button_progress_down.png" id="2_jd62s"]
[ext_resource type="Texture2D" uid="uid://u805kusykekd" path="res://assets/lesson_screen/button_locked.png" id="3_06y7k"]
[ext_resource type="Texture2D" uid="uid://3iuuq06ovbos" path="res://assets/theme/button_normal_empty.svg" id="1_pdrhc"]
[ext_resource type="Texture2D" uid="uid://j7sffldhbunj" path="res://assets/theme/button_pressed_empty.svg" id="2_2g676"]
[ext_resource type="Texture2D" uid="uid://be30a3cmy0w46" path="res://assets/theme/button_focused_empty.svg" id="3_fksie"]
[ext_resource type="Texture2D" uid="uid://c0rumwiaimvxy" path="res://assets/theme/button_disabled.svg" id="4_4vg60"]
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_button.gd" id="4_mbltp"]
[ext_resource type="Texture2D" uid="uid://dwk8xgv3xsmm0" path="res://assets/theme/button_center.svg" id="6_o0qkw"]
[node name="LessonButton" type="TextureButton"]
z_index = 1
offset_right = 256.0
offset_bottom = 256.0
size_flags_horizontal = 4
size_flags_vertical = 4
texture_normal = ExtResource("1_wosm1")
texture_pressed = ExtResource("2_jd62s")
texture_disabled = ExtResource("3_06y7k")
stretch_mode = 3
texture_normal = ExtResource("1_pdrhc")
texture_pressed = ExtResource("2_2g676")
texture_hover = ExtResource("3_fksie")
texture_disabled = ExtResource("4_4vg60")
texture_focused = ExtResource("1_pdrhc")
stretch_mode = 0
script = ExtResource("4_mbltp")
base_color = Color(0.109804, 0.14902, 0.384314, 1)
completed_color = Color(0.109804, 0.14902, 0.384314, 1)
[node name="Center" type="TextureRect" parent="."]
unique_name_in_owner = true
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("6_o0qkw")
[node name="Label" type="Label" parent="."]
unique_name_in_owner = true
z_index = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 110
horizontal_alignment = 1
vertical_alignment = 1
[node name="Placeholder" type="TextureRect" parent="."]
unique_name_in_owner = true
visible = false
modulate = Color(0.775063, 0.775063, 0.775063, 1)
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("6_o0qkw")
@@ -1,43 +0,0 @@
extends "res://sources/lesson_screen/lesson_button.gd"
@export var images: Array[Texture]
@export var text: String:
set = _set_text
@export var display_text: bool = false:
set = _set_display_text
@onready var images_container: HBoxContainer = $MarginContainer/ImagesContainer
@onready var label: Label = $Label
func _ready() -> void:
load_images()
_set_text(text)
_set_display_text(display_text)
func load_images() -> void:
for image in images_container.get_children():
image.queue_free()
for image in images:
var texture_rect: = TextureRect.new()
texture_rect.texture = image
texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture_rect.size_flags_horizontal = Control.SIZE_EXPAND_FILL
images_container.add_child(texture_rect)
func _set_text(value: String) -> void:
text = value
if label:
label.text = text
func _set_display_text(value: bool) -> void:
display_text = value
if label:
label.visible = display_text
@@ -1,39 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://bw820nbyowrqy"]
[ext_resource type="PackedScene" uid="uid://delcgui3v0eek" path="res://sources/lesson_screen/lesson_button.tscn" id="1_ngos0"]
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_label_button.gd" id="2_vgde5"]
[node name="LessonLabelButton" instance=ExtResource("1_ngos0")]
script = ExtResource("2_vgde5")
images = Array[Texture]([])
text = ""
display_text = false
[node name="MarginContainer" type="MarginContainer" parent="." index="0"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="ImagesContainer" type="HBoxContainer" parent="MarginContainer" index="0"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="MarginContainer/ImagesContainer" index="0"]
layout_mode = 2
[node name="Label" type="Label" parent="." index="1"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 50
horizontal_alignment = 1
vertical_alignment = 1
@@ -0,0 +1,35 @@
shader_type canvas_item;
uniform bool rainbow = false; //Activate the rainbow or select you color
uniform vec4 line_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);//color line
uniform float line_scale : hint_range(0, 20) = 1.2; // thickness of the line
uniform float frequency : hint_range(0.0, 2.0) = 0.5; // frequency of the rainbow
uniform float light_offset : hint_range(0.00001, 1.0) = 0.5; // this offsets all color channels;
uniform float alpha : hint_range(0.0, 1.0) = 1.0;
void fragment() {
vec2 size = TEXTURE_PIXEL_SIZE * line_scale;
float outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a;
outline += texture(TEXTURE, UV + vec2(0, size.y)).a;
outline += texture(TEXTURE, UV + vec2(size.x, 0)).a;
outline += texture(TEXTURE, UV + vec2(0, -size.y)).a;
outline += texture(TEXTURE, UV + vec2(-size.x, size.y)).a;
outline += texture(TEXTURE, UV + vec2(size.x, size.y)).a;
outline += texture(TEXTURE, UV + vec2(-size.x, -size.y)).a;
outline += texture(TEXTURE, UV + vec2(size.x, -size.y)).a;
outline = min(outline, 1.0);
vec4 animated_line_color = vec4(light_offset + sin(2.0*3.14*frequency*TIME),
light_offset + sin(2.0*3.14*frequency*TIME + radians(120.0)),
light_offset + sin(2.0*3.14*frequency*TIME + radians(240.0)),
alpha);
vec4 color = texture(TEXTURE, UV);
if (rainbow == true){//if rainbow is activated
COLOR = mix(color, animated_line_color, outline - color.a);
}
if (rainbow == false){//if rainbow not is activated and you pick a color
COLOR = mix(color, line_color , outline - color.a);
}
}
+15 -9
View File
@@ -1,24 +1,30 @@
[gd_scene load_steps=3 format=3 uid="uid://iphc7htj7gg2"]
[gd_scene load_steps=5 format=3 uid="uid://iphc7htj7gg2"]
[ext_resource type="Texture2D" uid="uid://bwjpxp5irgt7h" path="res://assets/lesson_screen/minigame_button_background.png" id="1_bh3jb"]
[ext_resource type="Script" path="res://sources/lesson_screen/minigame_button.gd" id="1_l1kme"]
[ext_resource type="Shader" path="res://sources/lesson_screen/minigame_button.gdshader" id="3_g38nl"]
[ext_resource type="Texture2D" uid="uid://rnqme2j272qf" path="res://assets/minigames/turtles/graphic/gauge_icon_turtle_full.png" id="4_m6kib"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_b8c5w"]
shader = ExtResource("3_g38nl")
shader_parameter/rainbow = false
shader_parameter/line_color = Color(1, 1, 1, 1)
shader_parameter/line_scale = 0.5
shader_parameter/frequency = 0.5
shader_parameter/light_offset = 0.5
shader_parameter/alpha = 1.0
[node name="MinigameButton" type="MarginContainer"]
custom_minimum_size = Vector2(200, 200)
offset_right = 200.0
offset_bottom = 200.0
mouse_filter = 2
script = ExtResource("1_l1kme")
[node name="TextureRect" type="TextureRect" parent="."]
modulate = Color(1, 1, 1, 0.501961)
layout_mode = 2
mouse_filter = 2
texture = ExtResource("1_bh3jb")
stretch_mode = 5
[node name="TextureButton" type="TextureButton" parent="."]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_b8c5w")
layout_mode = 2
texture_normal = ExtResource("4_m6kib")
stretch_mode = 5
[connection signal="pressed" from="TextureButton" to="." method="_on_texture_button_pressed"]