add spawning
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
onready var immunity = 500
|
||||
|
||||
const MOVEMENT_VECTORS = [
|
||||
Vector2.UP,
|
||||
@@ -12,20 +9,30 @@ const MOVEMENT_VECTORS = [
|
||||
Vector2.LEFT
|
||||
]
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(_delta):
|
||||
if immunity > 0:
|
||||
immunity = immunity - 1
|
||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
||||
move_and_collide(movement * 2)
|
||||
pass
|
||||
|
||||
func _on_Hurtbox_area_entered(_area):
|
||||
$Hurtbox/death.play()
|
||||
pass # Replace with function body.
|
||||
if immunity == 0:
|
||||
$Hurtbox/death.play()
|
||||
|
||||
func _on_death_finished():
|
||||
var smallooze = load("res://NPCs/smallooze.tscn")
|
||||
var instance1 = smallooze.instance()
|
||||
var instance2 = smallooze.instance()
|
||||
instance1.position = position
|
||||
instance2.position = position
|
||||
get_parent().add_child(instance1)
|
||||
get_parent().add_child(instance2)
|
||||
queue_free()
|
||||
|
||||
func _on_Hitbox_area_entered(_area):
|
||||
yield(get_tree().create_timer(2.0),"timeout")
|
||||
var bigooze = load("res://NPCs/big_ooze.tscn")
|
||||
var instance = bigooze.instance()
|
||||
instance.position = position
|
||||
get_parent().add_child(instance)
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
|
Reference in New Issue
Block a user