reverting void card handling to cut down unneded performance overhead
This commit is contained in:
parent
68cc589bff
commit
8d22485bdf
|
|
@ -19,8 +19,6 @@ var scale_tween
|
||||||
if !Engine.is_editor_hint():
|
if !Engine.is_editor_hint():
|
||||||
wiggle_pos = float(text.hash() % 100)
|
wiggle_pos = float(text.hash() % 100)
|
||||||
_handle_wiggle(0)
|
_handle_wiggle(0)
|
||||||
if get_children() != [] and !Engine.is_editor_hint():
|
|
||||||
$BackgroundSprite.void_active = text == ""
|
|
||||||
@export var wiggle_strength: float = 0.2
|
@export var wiggle_strength: float = 0.2
|
||||||
@export var wiggle_speed: float = 5
|
@export var wiggle_speed: float = 5
|
||||||
@export_range(1, 2) var scale_bump: float = 1.05
|
@export_range(1, 2) var scale_bump: float = 1.05
|
||||||
|
|
@ -81,7 +79,6 @@ func _ready():
|
||||||
|
|
||||||
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
||||||
$Label.text = self.text
|
$Label.text = self.text
|
||||||
if not Engine.is_editor_hint(): $BackgroundSprite.void_active = text == ""
|
|
||||||
|
|
||||||
wiggle_pos = float(text.hash() % 100)
|
wiggle_pos = float(text.hash() % 100)
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
[gd_scene load_steps=21 format=3 uid="uid://dy5rd437h5hsw"]
|
[gd_scene load_steps=11 format=3 uid="uid://dy5rd437h5hsw"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/card.gd" id="1_emip0"]
|
[ext_resource type="Script" path="res://logic-scenes/board/card.gd" id="1_emip0"]
|
||||||
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_ioijn"]
|
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_ioijn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://kpmk21d8rlso" path="res://logic-scenes/board/particle_textures/star.png" id="3_bwtbh"]
|
|
||||||
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_rktsa"]
|
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_rktsa"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bqilajx05t0eb" path="res://logic-scenes/board/particle_textures/void_nomotion.png" id="4_fwm1k"]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"]
|
||||||
radius = 110.0
|
radius = 110.0
|
||||||
|
|
@ -53,105 +51,6 @@ animations = [{
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_8bs16"]
|
|
||||||
script/source = "extends AnimatedSprite2D
|
|
||||||
|
|
||||||
@onready var particles = $GPUParticles2D
|
|
||||||
@onready var initial_position = position
|
|
||||||
var noise_position = randf()
|
|
||||||
var noise: Noise = FastNoiseLite.new()
|
|
||||||
var void_active:
|
|
||||||
set(become_void):
|
|
||||||
if not (void_active == become_void):
|
|
||||||
if is_inside_tree():
|
|
||||||
$GPUParticles2D.is_void = become_void
|
|
||||||
$GPUParticles2D.emitting = become_void
|
|
||||||
$Sprite2D.is_void = become_void
|
|
||||||
void_active = become_void
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
|
|
||||||
if void_active != $GPUParticles2D.is_void:
|
|
||||||
$GPUParticles2D.is_void = void_active
|
|
||||||
$GPUParticles2D.emitting = void_active
|
|
||||||
$Sprite2D.is_void = void_active
|
|
||||||
|
|
||||||
if void_active and not State.reduce_motion:
|
|
||||||
|
|
||||||
noise_position += delta * 10
|
|
||||||
|
|
||||||
var random_position = Vector2(noise.get_noise_1d(noise_position*2), noise.get_noise_1d(-noise_position))
|
|
||||||
|
|
||||||
random_position = random_position.normalized() * pow(random_position.length()*2, 3) * 5
|
|
||||||
|
|
||||||
position = initial_position - random_position
|
|
||||||
|
|
||||||
rotation = noise.get_noise_1d(noise_position*10) * random_position.length() * 0.01
|
|
||||||
|
|
||||||
particles.position = random_position
|
|
||||||
|
|
||||||
else: position = initial_position
|
|
||||||
"
|
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_v70nd"]
|
|
||||||
interpolation_mode = 2
|
|
||||||
offsets = PackedFloat32Array(0, 0.0529197, 0.191606, 1)
|
|
||||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0.491329, 1, 1, 1, 0)
|
|
||||||
|
|
||||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_xxq8p"]
|
|
||||||
gradient = SubResource("Gradient_v70nd")
|
|
||||||
|
|
||||||
[sub_resource type="Curve" id="Curve_q6cmf"]
|
|
||||||
_data = [Vector2(0, 0), 0.0, 3.16529, 0, 0, Vector2(0.241056, 0.191336), 0.132446, 0.132446, 0, 0, Vector2(1, 1), 3.94797, 0.0, 0, 0]
|
|
||||||
point_count = 3
|
|
||||||
|
|
||||||
[sub_resource type="CurveTexture" id="CurveTexture_cg0w1"]
|
|
||||||
curve = SubResource("Curve_q6cmf")
|
|
||||||
|
|
||||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_by44l"]
|
|
||||||
emission_shape = 6
|
|
||||||
emission_ring_axis = Vector3(0, 0, 1)
|
|
||||||
emission_ring_height = 0.0
|
|
||||||
emission_ring_radius = 180.0
|
|
||||||
emission_ring_inner_radius = 185.0
|
|
||||||
particle_flag_disable_z = true
|
|
||||||
spread = 180.0
|
|
||||||
gravity = Vector3(0, 0, 0)
|
|
||||||
initial_velocity_min = -10.0
|
|
||||||
initial_velocity_max = 10.0
|
|
||||||
angular_velocity_min = -150.0
|
|
||||||
angular_velocity_max = -150.0
|
|
||||||
orbit_velocity_min = 0.0
|
|
||||||
orbit_velocity_max = 0.0
|
|
||||||
radial_accel_min = -20.0
|
|
||||||
radial_accel_max = -5.0
|
|
||||||
tangential_accel_min = 20.0
|
|
||||||
tangential_accel_max = 30.0
|
|
||||||
scale_min = 3.0
|
|
||||||
scale_max = 5.0
|
|
||||||
scale_curve = SubResource("CurveTexture_cg0w1")
|
|
||||||
color_ramp = SubResource("GradientTexture1D_xxq8p")
|
|
||||||
turbulence_noise_strength = 0.1
|
|
||||||
attractor_interaction_enabled = false
|
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_vjwk7"]
|
|
||||||
script/source = "extends GPUParticles2D
|
|
||||||
|
|
||||||
var is_void:bool = false
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
self.visible = !State.reduce_motion and is_void
|
|
||||||
"
|
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_tgc0b"]
|
|
||||||
script/source = "extends Sprite2D
|
|
||||||
|
|
||||||
var is_void:bool = false
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
self.visible = State.reduce_motion and is_void
|
|
||||||
"
|
|
||||||
|
|
||||||
[node name="card" type="Area2D"]
|
[node name="card" type="Area2D"]
|
||||||
script = ExtResource("1_emip0")
|
script = ExtResource("1_emip0")
|
||||||
metadata/type = "card"
|
metadata/type = "card"
|
||||||
|
|
@ -166,25 +65,6 @@ clip_children = 2
|
||||||
scale = Vector2(0.6, 0.6)
|
scale = Vector2(0.6, 0.6)
|
||||||
sprite_frames = SubResource("SpriteFrames_ckivt")
|
sprite_frames = SubResource("SpriteFrames_ckivt")
|
||||||
frame = 1
|
frame = 1
|
||||||
script = SubResource("GDScript_8bs16")
|
|
||||||
|
|
||||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]
|
|
||||||
visible = false
|
|
||||||
amount = 500
|
|
||||||
process_material = SubResource("ParticleProcessMaterial_by44l")
|
|
||||||
texture = ExtResource("3_bwtbh")
|
|
||||||
lifetime = 2.5
|
|
||||||
speed_scale = 1.3
|
|
||||||
explosiveness = 0.2
|
|
||||||
randomness = 0.14
|
|
||||||
local_coords = true
|
|
||||||
script = SubResource("GDScript_vjwk7")
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="BackgroundSprite"]
|
|
||||||
visible = false
|
|
||||||
scale = Vector2(0.4, 0.4)
|
|
||||||
texture = ExtResource("4_fwm1k")
|
|
||||||
script = SubResource("GDScript_tgc0b")
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=20 format=3 uid="uid://dp4eps03igd3w"]
|
[gd_scene load_steps=21 format=3 uid="uid://dp4eps03igd3w"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/card.gd" id="1_6ceun"]
|
[ext_resource type="Script" path="res://logic-scenes/board/card.gd" id="1_6ceun"]
|
||||||
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_buevv"]
|
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_buevv"]
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_mi4ah"]
|
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_mi4ah"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bqilajx05t0eb" path="res://logic-scenes/board/particle_textures/void_nomotion.png" id="4_jam8u"]
|
[ext_resource type="Texture2D" uid="uid://bqilajx05t0eb" path="res://logic-scenes/board/particle_textures/void_nomotion.png" id="4_jam8u"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"]
|
||||||
|
radius = 110.0
|
||||||
|
height = 336.0
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ykk13"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ykk13"]
|
||||||
atlas = ExtResource("2_buevv")
|
atlas = ExtResource("2_buevv")
|
||||||
region = Rect2(0, 0, 600, 440)
|
region = Rect2(0, 0, 600, 440)
|
||||||
|
|
@ -56,17 +60,11 @@ script/source = "extends AnimatedSprite2D
|
||||||
@onready var initial_position = position
|
@onready var initial_position = position
|
||||||
var noise_position = randf()
|
var noise_position = randf()
|
||||||
var noise: Noise = FastNoiseLite.new()
|
var noise: Noise = FastNoiseLite.new()
|
||||||
var void_active:
|
|
||||||
set(become_void):
|
|
||||||
if not (void_active == become_void):
|
|
||||||
if is_inside_tree():
|
|
||||||
$GPUParticles2D.is_void = become_void
|
|
||||||
$GPUParticles2D.emitting = become_void
|
|
||||||
$Sprite2D.is_void = become_void
|
|
||||||
void_active = become_void
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if void_active and not State.reduce_motion:
|
|
||||||
|
if not State.reduce_motion:
|
||||||
|
|
||||||
noise_position += delta * 10
|
noise_position += delta * 10
|
||||||
|
|
||||||
var random_position = Vector2(noise.get_noise_1d(noise_position*2), noise.get_noise_1d(-noise_position))
|
var random_position = Vector2(noise.get_noise_1d(noise_position*2), noise.get_noise_1d(-noise_position))
|
||||||
|
|
@ -116,8 +114,8 @@ radial_accel_min = -20.0
|
||||||
radial_accel_max = -5.0
|
radial_accel_max = -5.0
|
||||||
tangential_accel_min = 20.0
|
tangential_accel_min = 20.0
|
||||||
tangential_accel_max = 30.0
|
tangential_accel_max = 30.0
|
||||||
scale_min = 1.5
|
scale_min = 3.0
|
||||||
scale_max = 3.0
|
scale_max = 5.0
|
||||||
scale_curve = SubResource("CurveTexture_cg0w1")
|
scale_curve = SubResource("CurveTexture_cg0w1")
|
||||||
color_ramp = SubResource("GradientTexture1D_xxq8p")
|
color_ramp = SubResource("GradientTexture1D_xxq8p")
|
||||||
turbulence_noise_strength = 0.1
|
turbulence_noise_strength = 0.1
|
||||||
|
|
@ -126,37 +124,31 @@ attractor_interaction_enabled = false
|
||||||
[sub_resource type="GDScript" id="GDScript_vjwk7"]
|
[sub_resource type="GDScript" id="GDScript_vjwk7"]
|
||||||
script/source = "extends GPUParticles2D
|
script/source = "extends GPUParticles2D
|
||||||
|
|
||||||
var is_void:bool = false
|
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
self.visible = !State.reduce_motion and is_void
|
self.visible = !State.reduce_motion
|
||||||
"
|
"
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_tgc0b"]
|
[sub_resource type="GDScript" id="GDScript_tgc0b"]
|
||||||
script/source = "extends Sprite2D
|
script/source = "extends Sprite2D
|
||||||
|
|
||||||
var is_void:bool = false
|
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
self.visible = State.reduce_motion and is_void
|
self.visible = State.reduce_motion
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="card" type="Control"]
|
[node name="card" type="Area2D"]
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 0
|
|
||||||
offset_left = -150.0
|
|
||||||
offset_top = -110.0
|
|
||||||
offset_right = 150.0
|
|
||||||
offset_bottom = 110.0
|
|
||||||
focus_mode = 2
|
|
||||||
script = ExtResource("1_6ceun")
|
script = ExtResource("1_6ceun")
|
||||||
|
metadata/type = "card"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(-0.0713516, 0.997451)
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource("CapsuleShape2D_foovg")
|
||||||
|
|
||||||
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="."]
|
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="."]
|
||||||
clip_children = 2
|
clip_children = 2
|
||||||
position = Vector2(150, 110)
|
|
||||||
scale = Vector2(0.6, 0.6)
|
scale = Vector2(0.6, 0.6)
|
||||||
sprite_frames = SubResource("SpriteFrames_ckivt")
|
sprite_frames = SubResource("SpriteFrames_ckivt")
|
||||||
frame = 2
|
frame = 1
|
||||||
script = SubResource("GDScript_8bs16")
|
script = SubResource("GDScript_8bs16")
|
||||||
|
|
||||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]
|
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]
|
||||||
|
|
@ -167,6 +159,7 @@ lifetime = 2.5
|
||||||
speed_scale = 1.3
|
speed_scale = 1.3
|
||||||
explosiveness = 0.2
|
explosiveness = 0.2
|
||||||
randomness = 0.14
|
randomness = 0.14
|
||||||
|
local_coords = true
|
||||||
script = SubResource("GDScript_vjwk7")
|
script = SubResource("GDScript_vjwk7")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="BackgroundSprite"]
|
[node name="Sprite2D" type="Sprite2D" parent="BackgroundSprite"]
|
||||||
|
|
@ -176,7 +169,6 @@ texture = ExtResource("4_jam8u")
|
||||||
script = SubResource("GDScript_tgc0b")
|
script = SubResource("GDScript_tgc0b")
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
|
|
@ -192,13 +184,9 @@ theme = ExtResource("3_mi4ah")
|
||||||
theme_type_variation = &"card_text"
|
theme_type_variation = &"card_text"
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
[node name="postit anchor" type="Control" parent="."]
|
[node name="postit anchor" type="Node2D" parent="."]
|
||||||
anchors_preset = 0
|
position = Vector2(-65.6478, 60.3852)
|
||||||
offset_left = 100.0
|
|
||||||
offset_top = 148.0
|
|
||||||
offset_right = 140.0
|
|
||||||
offset_bottom = 188.0
|
|
||||||
|
|
||||||
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="focus_exited" from="." to="." method="_on_focus_exited"]
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
[connection signal="focus_entered" from="postit anchor" to="." method="_on_postit_anchor_focus_entered"]
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue