mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
24 lines
467 B
GDScript
24 lines
467 B
GDScript
extends KinematicBody2D
|
|
|
|
var direction = Vector2()
|
|
export(float) var speed = 1000.0
|
|
|
|
onready var root = get_tree().root
|
|
|
|
func _ready():
|
|
set_as_toplevel(true)
|
|
|
|
|
|
func _physics_process(delta):
|
|
if not root.get_visible_rect().has_point(position):
|
|
queue_free()
|
|
|
|
var motion = direction * speed * delta
|
|
var collision_info = move_and_collide(motion)
|
|
if collision_info:
|
|
queue_free()
|
|
|
|
|
|
func _draw():
|
|
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
|