simplaudio birthday

This commit is contained in:
Bucket Of Chicken
2025-06-29 10:29:52 +02:00
parent dd3d64bdfb
commit 3093f6fb6b
2 changed files with 22 additions and 14 deletions
+9 -3
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=80 format=3 uid="uid://b2sygl55s6fng"] [gd_scene load_steps=81 format=3 uid="uid://b2sygl55s6fng"]
[ext_resource type="Script" path="res://main.gd" id="1_ubs1p"] [ext_resource type="Script" path="res://main.gd" id="1_ubs1p"]
[ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"] [ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"]
@@ -190,6 +190,10 @@ shadow_size = 4
shadow_color = Color(0.290196, 0.290196, 0.290196, 0.270588) shadow_color = Color(0.290196, 0.290196, 0.290196, 0.270588)
shadow_offset = Vector2(2, 3) shadow_offset = Vector2(2, 3)
[sub_resource type="Curve" id="Curve_ilc1k"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.257642, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="Curve" id="Curve_wqjqk"] [sub_resource type="Curve" id="Curve_wqjqk"]
_data = [Vector2(0, 0), 0.0, 16.8231, 0, 0, Vector2(0.119342, 1), 0.0, 0.0, 0, 0, Vector2(0.991769, 1), 8.04663e-07, 0.0, 0, 0] _data = [Vector2(0, 0), 0.0, 16.8231, 0, 0, Vector2(0.119342, 1), 0.0, 0.0, 0, 0, Vector2(0.991769, 1), 8.04663e-07, 0.0, 0, 0]
point_count = 3 point_count = 3
@@ -1284,6 +1288,7 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
script = ExtResource("38_pitc3") script = ExtResource("38_pitc3")
opacitycurve = SubResource("Curve_ilc1k")
[node name="BirthdayParticles" type="GPUParticles2D" parent="BirthdayContainer"] [node name="BirthdayParticles" type="GPUParticles2D" parent="BirthdayContainer"]
emitting = false emitting = false
@@ -1296,7 +1301,8 @@ visibility_rect = Rect2(-750, -750, 1500, 1000)
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="BirthdayContainer"] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="BirthdayContainer"]
stream = ExtResource("39_3er0p") stream = ExtResource("39_3er0p")
volume_db = -17.885 volume_db = -10.0
bus = &"Music"
[node name="BirthdayHappy" type="Label" parent="."] [node name="BirthdayHappy" type="Label" parent="."]
visible = false visible = false
@@ -1312,7 +1318,7 @@ offset_right = 62.5
offset_bottom = 11.5 offset_bottom = 11.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
text = "Happy Birthday!" text = "Happy Birthday Simplaudio!"
label_settings = SubResource("LabelSettings_f1d3e") label_settings = SubResource("LabelSettings_f1d3e")
[node name="PlayingNow" type="Window" parent="."] [node name="PlayingNow" type="Window" parent="."]
+13 -11
View File
@@ -3,6 +3,8 @@ extends Control
@onready var birthday_particles: GPUParticles2D = $BirthdayParticles @onready var birthday_particles: GPUParticles2D = $BirthdayParticles
@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer @onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
@onready var birthday_happy: Label = $"../BirthdayHappy" @onready var birthday_happy: Label = $"../BirthdayHappy"
@export var opacitycurve:Curve
var opacity:float = 1
var awaitingJumpscare:bool var awaitingJumpscare:bool
var IsFocused:bool var IsFocused:bool
@@ -11,12 +13,11 @@ func _ready() -> void:
birthday_happy.hide() birthday_happy.hide()
print("user: ",DiscordRPC.get_current_user().get("username")) print("user: ",DiscordRPC.get_current_user().get("username"))
var bday:bool var bday:bool
if owner.DiscordUsername == "woostudiosjohn": if Time.get_datetime_dict_from_system().day == 29:
if Time.get_datetime_dict_from_system().day == 5: if Time.get_datetime_dict_from_system().month == 6:
if Time.get_datetime_dict_from_system().month == 11: await get_tree().create_timer(0.2).timeout
await get_tree().create_timer(0.2).timeout awaitingJumpscare = true
awaitingJumpscare = true bday = true
bday = true
func _notification(what): func _notification(what):
if what == get_tree().NOTIFICATION_APPLICATION_FOCUS_IN: if what == get_tree().NOTIFICATION_APPLICATION_FOCUS_IN:
@@ -27,9 +28,10 @@ func _notification(what):
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
if awaitingJumpscare && IsFocused: if awaitingJumpscare && IsFocused:
birthday_happy.show() birthday_happy.show()
awaitingJumpscare = false awaitingJumpscare = false
birthday_particles.emitting = true birthday_particles.emitting = true
audio_stream_player.play() audio_stream_player.play()
if !awaitingJumpscare: if !awaitingJumpscare:
birthday_happy.modulate.a -= delta/5 opacity -= delta/5
birthday_happy.modulate.a = opacitycurve.sample_baked(opacity)