From 25f7ec021602df635d36fd31490ce30343bf349d Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sun, 1 Oct 2023 15:02:06 +0900 Subject: [PATCH] Add title to game --- PlayerCharacterBody2D.gd | 11 +++++++++++ player.tscn | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/PlayerCharacterBody2D.gd b/PlayerCharacterBody2D.gd index 20c2205..5cb9324 100644 --- a/PlayerCharacterBody2D.gd +++ b/PlayerCharacterBody2D.gd @@ -32,11 +32,22 @@ var particle = preload("res://circleParticle.tscn") @onready var hit_sfx = $HitSFX @onready var jump_sfx = $JumpSFX +@onready var title_text = $GameTitleText +var title_timer = 5.0 + func _ready(): self_sprite.self_modulate = DEFAULT_COLOR health_label.add_text(health_text_format % health) + title_text.add_theme_font_size_override("normal_font_size", 40) + title_text.add_text("LD54 - Box Survival\nBy: BurnedKirby\nMade in Godot") func _physics_process(delta): + if title_timer > 0.0: + title_timer -= delta + if title_timer < 0.0: + title_timer = 0.0 + title_text.get_parent().remove_child(title_text) + if health <= 0: return diff --git a/player.tscn b/player.tscn index 4b8d430..40b6ef6 100644 --- a/player.tscn +++ b/player.tscn @@ -41,3 +41,9 @@ stream = ExtResource("2_ix2ut") [node name="HitSFX" type="AudioStreamPlayer" parent="."] stream = ExtResource("3_gq63f") + +[node name="GameTitleText" type="RichTextLabel" parent="."] +offset_left = -137.0 +offset_top = 74.0 +offset_right = 336.0 +offset_bottom = 293.0