I’m trying to remove all entities from a world when a function is called.
Here is the code:
package {
import net.flashpunk.World;
import net.flashpunk.utils.Input;
import net.flashpunk.utils.Key;
import net.flashpunk.FP;
public class MainScreen extends World{
var scene:Number = 1;
var sceneType:Number = 1;
/*
1 = Straight Forward Text
2 = Can't move Forward (Choice to make)
*/
public function MainScreen() {
loadScene();
}
public function loadScene()
{
FP.MainScreen.removeAll;
add (new Background('test'));
add (new Character(5, 250, 'Beta'));
add (new Character(400, 200, 'Sanic'));
add (new Textbox(0, 450));
add (new DialogTextLine1(10, 455, "Random Text"));
}
public function changeScene():void
{
scene += 1;
loadScene();
}
override public function update():void
{
if (Input.released (Key.SPACE))
{
changeScene();
}
}
}
}
Can someone tell me what I am doing wrong?