Hello guys. How can I check the current world
MyCheckPoint class
package CheckPoint {
import Levels.MyLevel;
import net.flashpunk.FP;
import net.flashpunk.Entity;
import net.flashpunk.graphics.Image;
public class MyCheckPoint extends Entity {
[Embed(source='../assets/checkp.png')]
private const CHECK_POINT:Class;
public function MyCheckPoint(posX:int, posY:int){
graphic = new Image(CHECK_POINT);
setHitbox(46, 46);
type = "check_point";
x = posX * 46;
y = posY * 46;
}
override public function update():void {
if (collide("player", x, y)) {
FP.world.removeAll();
FP.world = new MyLevel;// level_2
}
}
}
}
I can do 30 checkPoint classes for each level, but how can check the current world like this
if (collide("player", x, y) &&/* current world ( MyWorld )*/ ) { //MyWorld is it level_1
FP.world.removeAll();
FP.world = new MyLevel;// level_2
}
if (collide("player", x, y) &&/* current world ( MyLevel )*/ ) {
FP.world.removeAll();
FP.world = new MyLevelTwo;// level_3
}