34 lines
682 B
GDScript
34 lines
682 B
GDScript
extends Area2D
|
|
|
|
|
|
const BloodStain := preload("res://objects/environment/blood/blood_stain.tscn")
|
|
|
|
|
|
export var color: Color = Color(0xf53342ff)
|
|
|
|
|
|
var velocity := Vector2.ZERO
|
|
|
|
|
|
onready var sprite: Sprite = $Sprite
|
|
|
|
|
|
func _ready() -> void:
|
|
sprite.self_modulate = color
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
velocity.y += 98.0 * delta
|
|
position += velocity * delta
|
|
sprite.global_rotation = velocity.angle()
|
|
|
|
|
|
func _on_body_entered(body: Node) -> void:
|
|
if body.is_in_group("can_stain"):
|
|
var stain = BloodStain.instance()
|
|
stain.modulate = color
|
|
stain.global_position = global_position
|
|
StainLayer.add_stain(stain)
|
|
queue_free()
|
|
elif body is TileMap:
|
|
queue_free()
|