How i can make restart button with mouse click ?
package {
import net.flashpunk.Entity;
import net.flashpunk.graphics.Image;
import net.flashpunk.FP;
public class MyRestart extends Entity {
[Embed(source='assets/wall.png')]
private const RESTART:Class;
public function MyRestart(posX:int, posY:int){
graphic = new Image(RESTART);
setHitbox(46, 46);
type = "restart";
x = posX * 46;
y = posY * 46;
}
override public function update():void{
if (collide(/* there needs verification mouse x,y*/"", x, y) && /* there needs verification mouse click */){
FP.world.removeAll();
FP.world = new MainMenu;
}
}
}
}