Houses ~8.5 m; chimps capped ~0.85 m with safer axis fitting. Large GLB/PBR packs stay local until Git LFS (Forgejo HTTP 413). Co-authored-by: Cursor <cursoragent@cursor.com>
98 lines
3 KiB
GDScript
98 lines
3 KiB
GDScript
extends Control
|
||
## Title: pixel rain, Pay2Win, loud music, Burger-Cham, first-run language.
|
||
|
||
@onready var subtitle: Label = $Subtitle
|
||
@onready var bubble: Label = $Bubble
|
||
@onready var start_btn: Button = $StartButton
|
||
@onready var rain: Node2D = $Rain
|
||
@onready var lang_panel: PanelContainer = $LangPanel
|
||
@onready var music_hint: Label = $MusicHint
|
||
|
||
var _rain_sprites: Array[Sprite2D] = []
|
||
|
||
func _ready() -> void:
|
||
GameState.current_scene_id = "title_screen"
|
||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||
AudioDirector.burger_cham_enabled = true
|
||
AudioDirector.play_title_music()
|
||
# Lyrics belong in the sung track — not on-screen (DESIGN.md §1).
|
||
if music_hint:
|
||
music_hint.visible = false
|
||
_refresh()
|
||
Locale.locale_changed.connect(_refresh)
|
||
_spawn_rain()
|
||
_spawn_disturbed()
|
||
lang_panel.visible = Settings.needs_language_picker()
|
||
start_btn.visible = not lang_panel.visible
|
||
|
||
func _spawn_disturbed() -> void:
|
||
## Bottom-left disturbed human (DESIGN.md §1)
|
||
var s := Sprite2D.new()
|
||
s.name = "DisturbedHuman"
|
||
s.texture = load("res://assets/sprites/placeholders/disturbed.png")
|
||
s.position = Vector2(90, 640)
|
||
s.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||
SpriteFit.apply_sprite2d(s, 96.0)
|
||
add_child(s)
|
||
# Hide ColorRect placeholder if present
|
||
var old := get_node_or_null("Disturbed")
|
||
if old:
|
||
old.visible = false
|
||
|
||
func _refresh() -> void:
|
||
if not is_inside_tree():
|
||
return
|
||
subtitle.text = Locale.tr_key("title_pay2win")
|
||
bubble.text = Locale.tr_key("title_bubble")
|
||
start_btn.text = Locale.tr_key("menu_start")
|
||
if music_hint:
|
||
music_hint.visible = false
|
||
$LangPanel/Margin/VBox/Title.text = Locale.tr_key("lang_pick_title")
|
||
$LangPanel/Margin/VBox/BtnDE.text = Locale.tr_key("lang_de")
|
||
$LangPanel/Margin/VBox/BtnEN.text = Locale.tr_key("lang_en")
|
||
$LangPanel/Margin/VBox/BtnBY.text = Locale.tr_key("lang_by")
|
||
|
||
func _spawn_rain() -> void:
|
||
var paths = [
|
||
"res://assets/sprites/placeholders/mario.png",
|
||
"res://assets/sprites/placeholders/sonic.png",
|
||
"res://assets/sprites/placeholders/burger.png",
|
||
]
|
||
for i in range(28):
|
||
var s := Sprite2D.new()
|
||
s.texture = load(paths[i % paths.size()])
|
||
s.position = Vector2(randf() * 1280.0, randf() * -720.0)
|
||
# Fit longest side to ~48px — works for 16×16 and 2k burger art alike.
|
||
SpriteFit.apply_sprite2d(s, SpriteFit.UI_RAIN_PX)
|
||
s.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||
rain.add_child(s)
|
||
_rain_sprites.append(s)
|
||
|
||
func _process(delta: float) -> void:
|
||
for s in _rain_sprites:
|
||
s.position.y += (90.0 + s.get_index() * 2.5) * delta
|
||
if s.position.y > 760.0:
|
||
s.position.y = -40.0
|
||
s.position.x = randf() * 1280.0
|
||
|
||
func _pick_lang(lang: String) -> void:
|
||
Settings.set_language(lang)
|
||
lang_panel.visible = false
|
||
start_btn.visible = true
|
||
_refresh()
|
||
|
||
func _on_lang_de() -> void:
|
||
_pick_lang("de")
|
||
|
||
func _on_lang_en() -> void:
|
||
_pick_lang("en")
|
||
|
||
func _on_lang_by() -> void:
|
||
_pick_lang("by")
|
||
|
||
func _on_start_pressed() -> void:
|
||
if Settings.needs_language_picker():
|
||
lang_panel.visible = true
|
||
return
|
||
AudioDirector.burger_cham_enabled = false
|
||
GameState.start_new_game()
|