2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
extends KinematicBody2D
|
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
# Member variables
|
2015-03-09 05:34:56 +00:00
|
|
|
const ADVANCE_SPEED = 500.0
|
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
var advance_dir = Vector2(1, 0)
|
|
|
|
var hit = false
|
|
|
|
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
func _fixed_process(delta):
|
|
|
|
if (hit):
|
|
|
|
return
|
2015-11-21 15:13:43 +00:00
|
|
|
move(advance_dir*delta*ADVANCE_SPEED)
|
2015-03-09 05:34:56 +00:00
|
|
|
if (is_colliding()):
|
|
|
|
get_node("anim").play("explode")
|
2015-11-21 15:13:43 +00:00
|
|
|
hit = true
|
|
|
|
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
set_fixed_process(true)
|