godot-steering-ai-framework/project/demos/Quickstart/Bullet.gd
Francois Belair e95e3bf386
Quick start and reference guides (#7)
Add quickstart guide and quickstart demo

Authored by Razoric and edited by Nathan and Johnny.
The purpose of the guide is simply to give an overview of what the
behaviors are there for, and a quick look at how to actually make use
of them in the basis of this toolkit, with some explanatory comments.
The actual user's manual will be built out of the API reference.
2020-01-27 11:39:06 -05:00

35 lines
558 B
GDScript

extends KinematicBody2D
export var speed := 1500.0
var velocity := Vector2.ZERO
var player: Node
onready var timer := $Lifetime
func _ready() -> void:
timer.connect("timeout", self, "_on_Lifetime_timeout")
timer.start()
func _physics_process(delta: float) -> void:
var collision := move_and_collide(velocity * delta)
if collision:
timer.stop()
clear()
collision.collider.damage(10)
func start(direction: Vector2) -> void:
velocity = direction * speed
func clear() -> void:
queue_free()
func _on_Lifetime_timeout() -> void:
clear()