Java Reference
In-Depth Information
function mouseButtonClicked(event:MouseEvent):Void{
fireClown();
}
function mouseWheelMoved(event:MouseEvent):Void{
adjustCannon(event.wheelRotation);
}
public function keyReleased(event:KeyEvent):Void{
if (event.code == KeyCode.VK_SPACE){
fireClown();
} else if (event.code == KeyCode.VK_UP){
adjustCannon(-2);
} else if (event.code == KeyCode.VK_DOWN){
adjustCannon(2);
}
}
function adjustCannon(amount:Number):Void{
cannonAngle += amount;
if (cannonAngle < -85){
cannonAngle = -85
}
if (cannonAngle > -15){
cannonAngle = -15;
}
}
function readyLaunch():Void{
(screen.status as Text).content = "Fire When Ready";
if (clownBody != null){
world.remove(clownBody.body);
}
balloonAnim.stop();
balloonAnim = Timeline{
repeatCount: Timeline.INDEFINITE;
autoReverse: true;
keyFrames: [
KeyFrame{
time: 0s
values: balloonNode.translateY => 100.0 tween Interpolator.EASEOUT;
},
KeyFrame{
time: 4s
values: balloonNode.translateY => 400.0 tween Interpolator.EASEIN;
}
]
}
clownNode.translateX = cannonNode.translateX;
clownNode.translateY = cannonNode.translateY;
clownNode.rotate = cannonAngle;
Search WWH ::




Custom Search