29 lines
596 B
GDScript
29 lines
596 B
GDScript
extends RigidBody2D
|
|
|
|
|
|
const BloodStain := preload("res://objects/environment/blood/blood_stain.tscn")
|
|
|
|
|
|
export var color: Color = Color(0xf53342ff)
|
|
|
|
|
|
onready var sprite: Sprite = $Sprite
|
|
|
|
|
|
func _ready() -> void:
|
|
sprite.self_modulate = color
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
sprite.global_rotation = linear_velocity.angle()
|
|
|
|
|
|
func _on_body_entered(body: Node) -> void:
|
|
if body.is_in_group("can_stain"):
|
|
var stain = BloodStain.instance()
|
|
stain.color = color
|
|
stain.global_position = global_position
|
|
body.add_child(stain)
|
|
queue_free()
|
|
elif body is TileMap:
|
|
queue_free()
|