mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-23 07:58:09 +00:00
added the game
This commit is contained in:
20
Scripts/Classes/Entities/Items/SpinningCoin.gd
Executable file
20
Scripts/Classes/Entities/Items/SpinningCoin.gd
Executable file
@@ -0,0 +1,20 @@
|
||||
extends Node2D
|
||||
const COIN_SPARKLE = preload("res://Scenes/Prefabs/Particles/CoinSparkle.tscn")
|
||||
var velocity := Vector2(0, -300)
|
||||
|
||||
func _ready() -> void:
|
||||
Global.coins += 1
|
||||
Global.score += 200
|
||||
AudioManager.play_sfx("coin", global_position)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
global_position += velocity * delta
|
||||
velocity.y += (15 / delta) * delta
|
||||
|
||||
func vanish() -> void:
|
||||
queue_free()
|
||||
|
||||
func summon_particle() -> void:
|
||||
var node = COIN_SPARKLE.instantiate()
|
||||
node.global_position = global_position
|
||||
add_sibling(node)
|
Reference in New Issue
Block a user