bloodstain improvements. work during pause for player, vastly more efficient
This commit is contained in:
parent
686b57f798
commit
6f6c5d06e1
9 changed files with 59 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
extends RigidBody2D
|
||||
extends Area2D
|
||||
|
||||
|
||||
const BloodStain := preload("res://objects/environment/blood/blood_stain.tscn")
|
||||
|
@ -7,6 +7,9 @@ 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
|
||||
|
||||
|
||||
|
@ -15,15 +18,17 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
sprite.global_rotation = linear_velocity.angle()
|
||||
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.color = color
|
||||
stain.modulate = color
|
||||
stain.global_position = global_position
|
||||
body.add_child(stain)
|
||||
StainLayer.add_stain(stain)
|
||||
queue_free()
|
||||
elif body is TileMap:
|
||||
queue_free()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue