36 lines
635 B
GDScript3
36 lines
635 B
GDScript3
extends Spatial
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
# var a = 2
|
|
# var b = "text"
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
var delay = 0.5
|
|
var existing = false
|
|
func _process(delta):
|
|
delay -= delta
|
|
if delay < 0:
|
|
if !existing:
|
|
create_ch()
|
|
delay = 10.0
|
|
existing = true
|
|
else:
|
|
destroy_ch()
|
|
delay = 3.0
|
|
existing = false
|
|
var char_id = -1
|
|
|
|
func create_ch():
|
|
char_id = Character.create_character(0)
|
|
|
|
func destroy_ch():
|
|
print(char_id)
|
|
Character.destroy_character(char_id)
|
|
char_id = -1
|