fix spawning
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
onready var immunity = 5
|
||||
onready var immunity = 50
|
||||
onready var tilesmap = $"/root/World/tilemap"
|
||||
onready var rootnode = get_node("/root/World")
|
||||
|
||||
const MOVEMENT_VECTORS = [
|
||||
Vector2.UP,
|
||||
@@ -10,6 +12,9 @@ const MOVEMENT_VECTORS = [
|
||||
]
|
||||
|
||||
func _physics_process(_delta):
|
||||
if position != null:
|
||||
if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0:
|
||||
queue_free()
|
||||
if immunity > 0:
|
||||
immunity = immunity - 1
|
||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
||||
@@ -27,6 +32,6 @@ func _on_Hitbox_area_entered(_area):
|
||||
var ooze = load("res://NPCs/ooze.tscn")
|
||||
var instance = ooze.instance()
|
||||
instance.position = position
|
||||
get_parent().add_child(instance)
|
||||
rootnode.add_child(instance)
|
||||
queue_free()
|
||||
|
||||
|
Reference in New Issue
Block a user