Java Reference
In-Depth Information
removeFromParent(aboutScreen.gameOverText);
makeButton(aboutScreen.backButton, backToStart);
aboutScreen.effect = ColorAdjust{
hue: .2
}
}
public function removeFromParent(node:Node):Void{
var parent:Object = node.parent;
if (parent instanceof Group){
delete node from (parent as Group).content;
} else if (parent instanceof Scene){
delete node from (parent as Scene).content
}
}
public function makeButton(node:Node,action:function()){
node.blocksMouse = true;
node.onMouseClicked = function(event:MouseEvent):Void{
if (not blockInput){
action();
}
}
node.onMouseEntered = function(event:MouseEvent):Void{
node.effect = Glow{}
}
node.onMouseExited = function(event:MouseEvent):Void{
node.effect = null;
}
}
public function allowInput():Void{
blockInput = false;
}
function startGame():Void{
lightAnim.stop();
gameModel = GameModel{}
FlipReplace.doReplace(startScreen, gameModel.screen, gameModel.startingAnimationOver);
}
function showAbout():Void{
lightAnim.stop();
blockInput = true;
WipeReplace.doReplace(startScreen, aboutScreen, allowInput);
}
function backToStart():Void{
lightAnim.play();
blockInput = true;
WipeReplace.doReplace(aboutScreen, startScreen, allowInput);
}
public function offsetFromZero(node:Node):Group{
var xOffset = node.boundsInParent.minX + node.boundsInParent.width/2.0;
var yOffset = node.boundsInParent.minY + node.boundsInParent.height/2.0;
Search WWH ::




Custom Search