@Dschoonmaker said:
What do you have so far?
This is the script for the character selection
extends Area2D #This is the icon of the character to select
func _ready():
pass
func _on_Area2D_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
if event.is_pressed():
get_tree().change_scene("res://Level.tscn")
var chosen_character = 1 #global variable, or singleton
The next script is in the level, and should spawn the chosen character, who is a Kinectbody2D
extends Node2D
var character1 = load("res://Character1.tscn")
onready var spawner = get_node("Level/Position2D")
func _process(delta):
if chosen_character == 1:
var spawn = character1.instance()
spawn.set_position(Position2D)
add_child(character1)
It say that "chosen_character" isn't declared int the current scope