mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
added the game
This commit is contained in:
18
Scripts/Classes/Entities/Items/KeyItem.gd
Normal file
18
Scripts/Classes/Entities/Items/KeyItem.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name KeyItem
|
||||
extends Node2D
|
||||
|
||||
static var total_collected := 0
|
||||
const SMOKE_PARTICLE = preload("uid://d08nv4qtfouv1")
|
||||
func _ready() -> void:
|
||||
$AnimationPlayer.play("Float")
|
||||
|
||||
func collected() -> void:
|
||||
total_collected += 1
|
||||
AudioManager.play_sfx("key_collect", global_position)
|
||||
summon_smoke_particle()
|
||||
queue_free()
|
||||
|
||||
func summon_smoke_particle() -> void:
|
||||
var node = SMOKE_PARTICLE.instantiate()
|
||||
node.global_position = global_position
|
||||
add_sibling(node)
|
Reference in New Issue
Block a user