mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-22 12:44:20 +00:00
🔧 Allow BulletMovement
to detect collisions
This commit is contained in:
parent
edc036941f
commit
625631a0f0
1 changed files with 6 additions and 2 deletions
|
@ -4,7 +4,11 @@ onready var target: KinematicBody2D = get_parent()
|
||||||
export var movement_per_second: float = 400.0
|
export var movement_per_second: float = 400.0
|
||||||
|
|
||||||
|
|
||||||
|
signal hit(collision)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
var direction = Vector2(cos(target.rotation), sin(target.rotation))
|
var direction = Vector2(cos(target.rotation), sin(target.rotation))
|
||||||
# TODO: Maybe bullets shouldn't slide but collide
|
var collision: KinematicCollision2D = target.move_and_collide(direction * movement_per_second)
|
||||||
var _motion: Vector2 = target.move_and_slide(direction * movement_per_second)
|
if collision != null:
|
||||||
|
emit_signal("hit", collision)
|
||||||
|
|
Loading…
Reference in a new issue