feat: tatoebaspil m kiva hammasbaksu au andrjoku
This commit is contained in:
parent
b2d5ab61d2
commit
050e8f9e22
104 changed files with 3017 additions and 27 deletions
20
scripts/Items/apple_pickup.gd
Normal file
20
scripts/Items/apple_pickup.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
extends Area2D
|
||||
|
||||
@onready var sprite: Sprite2D = %Sprite2D
|
||||
@onready var pickup_sound_player = %PickupSoundPlayer
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
|
||||
# Update DataBusSingleton
|
||||
DataBusSingleton.apples_collected += 1
|
||||
|
||||
# Disable the collision and visuals for the apple
|
||||
monitoring = false
|
||||
sprite.visible = false
|
||||
pickup_sound_player.play()
|
||||
|
||||
# Wait for a bit so the sound plays fully
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
|
||||
queue_free()
|
||||
1
scripts/Items/apple_pickup.gd.uid
Normal file
1
scripts/Items/apple_pickup.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bj6chufeyeibu
|
||||
17
scripts/Items/finish.gd
Normal file
17
scripts/Items/finish.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Area2D
|
||||
|
||||
@export var ending_delay:float = 3.0
|
||||
@onready var victory_sound_player = %VictorySound
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
_victory()
|
||||
|
||||
func _victory():
|
||||
victory_sound_player.play()
|
||||
|
||||
# Wait for a bit so the sound plays fully
|
||||
await get_tree().create_timer(ending_delay).timeout
|
||||
|
||||
# Change scene to main menu
|
||||
get_tree().change_scene_to_file("res://Scenes/main_menu.tscn")
|
||||
1
scripts/Items/finish.gd.uid
Normal file
1
scripts/Items/finish.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d18eis4okksih
|
||||
Loading…
Add table
Add a link
Reference in a new issue