fix spawning
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
onready var age = 0
|
||||
|
||||
onready var tilesmap = $"/root/World/tilemap"
|
||||
|
||||
const MOVEMENT_VECTORS = [
|
||||
Vector2.UP,
|
||||
Vector2.RIGHT,
|
||||
@@ -8,6 +12,16 @@ const MOVEMENT_VECTORS = [
|
||||
]
|
||||
|
||||
func _physics_process(_delta):
|
||||
if position != null:
|
||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||
queue_free()
|
||||
if age > 2500:
|
||||
$"Romance".add_to_group("malegoblin")
|
||||
if age > 5000:
|
||||
queue_free()
|
||||
else:
|
||||
age = age + 1
|
||||
|
||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
||||
move_and_collide(movement * 2)
|
||||
|
||||
|
Reference in New Issue
Block a user