15 lines
527 B
GDScript
15 lines
527 B
GDScript
extends RigidBody2D
|
|
|
|
@export var Particles: PackedScene
|
|
|
|
func _on_body_entered(body: Node) -> void:
|
|
if abs(linear_velocity.x) > 200 or abs(linear_velocity.y) > 200:
|
|
%AudioStreamPlayer.play()
|
|
|
|
func _on_area_2d_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
|
|
if event.pressed:
|
|
var particles = Particles.instantiate()
|
|
particles.global_position = global_position
|
|
get_parent().add_child(particles)
|
|
queue_free()
|