Skip to content

Instantly share code, notes, and snippets.

@zachwlewis
Forked from sjakaus/gist:577766
Created September 13, 2010 18:44
Show Gist options
  • Save zachwlewis/577791 to your computer and use it in GitHub Desktop.
Save zachwlewis/577791 to your computer and use it in GitHub Desktop.
The proper way to add entites to a new World in FlashPunk.
package
{
import net.flashpunk.World;
import Master;
public class DungeonWorld extends World
{
public function DungeonWorld()
{
trace(Master.currentLevel);
}
override public function begin():void
{
// We want to add our entities on the first tick of our new world.
// This prevents things from being added to the previous world.
add(new Level());
add(new Player(50,50));
}
override public function update():void
{
super.update();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment