Files
Super-Mario-Bros.-Remastere…/Scripts/Classes/Entities/Items/SpinningCoin.gd
KirbyKidJ 6d23f9dcd4 Added Coin Sparkle Effects (#350)
* Just the Coin Sparkle stuff

FYI, if a property in the json is formatted like `exa.exb` then it reads `exa` as another object and `exb` as a property in `exa` assuming the root `property_node` contains this object.
Also primarily for Resource Packs to change how the particles work and should explain how I got there with my personal SMAS skin.

* Added Coin Sparkle Texture to Scene

Of course I broke it in some form.
2025-09-28 11:30:45 +01:00

28 lines
672 B
GDScript
Executable File

extends Node2D
const COIN_SPARKLE = preload("res://Scenes/Prefabs/Particles/CoinSparkle.tscn")
var velocity := Vector2(0, -300)
var can_spawn_particles := true
func _ready() -> void:
Global.coins += 1
Global.score += 200
AudioManager.play_sfx("coin", global_position)
func _physics_process(delta: float) -> void:
if get_node_or_null("Sprite") != null:
global_position += velocity * delta
velocity.y += (15 / delta) * delta
func vanish() -> void:
if can_spawn_particles:
summon_particle()
$Sprite.queue_free()
else:
queue_free()
func summon_particle() -> void:
var node = COIN_SPARKLE.instantiate()
node.finished.connect(queue_free)
add_child(node)