Section 1
//Clock (Clock)
package {
import flash.display.*;
public class Clock extends MovieClip {
public var clock_circle:Shape;
public var speed:Number;
public var health:int;// = 3
public var clock_graphic:ClockGraphic;
public function Clock(_arg1:uint):void{
health = 3;
super();
clock_graphic = new ClockGraphic();
addChild(clock_graphic);
clock_circle = new Shape();
clock_circle.graphics.lineStyle(2, 0x666666);
clock_circle.graphics.beginFill(0xFFFFFF);
clock_circle.graphics.drawCircle(0, 0, 5);
clock_circle.graphics.endFill();
clock_circle.graphics.lineStyle(2, 0x222222);
clock_circle.graphics.moveTo(0, 0);
clock_circle.graphics.lineTo(0, -3);
addChild(clock_circle);
clock_graphic.gotoAndStop(_arg1);
}
}
}//package
Section 2
//ClockGraphic (ClockGraphic)
package {
import flash.display.*;
public dynamic class ClockGraphic extends MovieClip {
}
}//package
Section 3
//Key (Key)
package {
import flash.display.*;
public class Key {
public static const ESCAPE:uint = 27;
public static const LEFT:uint = 37;
public static const ALT:uint = 18;
public static const CAPSLOCK:uint = 20;
public static const UP:uint = 38;
public static const DOWN:uint = 40;
public static const DELETEKEY:uint = 46;
public static const ENTER:uint = 13;
public static const INSERT:uint = 45;
public static const END:uint = 35;
public static const CONTROL:uint = 17;
public static const PGDN:uint = 34;
public static const B:uint = 66;
public static const C:uint = 67;
public static const E:uint = 69;
public static const F:uint = 70;
public static const G:uint = 71;
public static const A:uint = 65;
public static const I:uint = 73;
public static const J:uint = 74;
public static const D:uint = 68;
public static const N:uint = 78;
public static const H:uint = 72;
public static const P:uint = 80;
public static const Q:uint = 81;
public static const PGUP:uint = 33;
public static const M:uint = 77;
public static const U:uint = 85;
public static const O:uint = 79;
public static const W:uint = 87;
public static const X:uint = 88;
public static const R:uint = 82;
public static const K:uint = 75;
public static const L:uint = 76;
public static const V:uint = 86;
public static const BACKSPACE:uint = 8;
public static const Y:uint = 89;
public static const Z:uint = 90;
public static const SHIFT:uint = 16;
public static const T:uint = 84;
public static const SPACE:uint = 32;
public static const S:uint = 83;
public static const HOME:uint = 36;
public static const TAB:uint = 9;
public static const RIGHT:uint = 39;
public static var isDown:Object = new Object();
public static function init(_arg1:Stage):void{
_arg1.addEventListener("keyDown", kd);
_arg1.addEventListener("keyUp", ku);
_arg1.addEventListener("deactivate", re);
}
private static function re(_arg1):void{
isDown = new Object();
}
private static function kd(_arg1):void{
isDown[_arg1.keyCode] = true;
}
private static function ku(_arg1):void{
delete isDown[_arg1.keyCode];
}
}
}//package
Section 4
//Laser (Laser)
package {
import flash.media.*;
public dynamic class Laser extends Sound {
}
}//package
Section 5
//Loop (Loop)
package {
import flash.media.*;
public dynamic class Loop extends Sound {
}
}//package
Section 6
//Main (Main)
package {
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
public class Main extends MovieClip {
private const rect:Rectangle;
private const zero_point:Point;
private const to_rad:Number = 0.0174532925199433;
private const filter:BlurFilter;
private const max_spd:Number = 9;
private const to_deg:Number = 57.2957795130823;
private const ninety_rad:Number = 1.5707963267949;
private var bullet_show_show:Bitmap;
private var y_spd:Number;
private var loader:Preloader;
private var bullet_show:BitmapData;
private var enemies:Array;
private var timer:Timer;
private var menu_screen:MenuScreen;
private var clocks:Sprite;
private var max_extra:int;// = 2100
private var latest:Particle;
private var score:int;
private var x_spd:Number;
public var playbtn:PlayButton;
private var laser_sound:Laser;
private var score_text:TextField;
private var extra_time:int;// = 0
private var loop:Loop;
private var player:Clock;
public function Main(){
var _local1:ContextMenu;
enemies = new Array();
timer = new Timer(1500, 0);
extra_time = 0;
max_extra = 2100;
rect = new Rectangle(0, 0, 550, 400);
zero_point = new Point(0, 0);
filter = new BlurFilter(5, 5, 1);
super();
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
contextMenu = _local1;
Key.init(stage);
loader = new Preloader();
addChild(loader);
addEventListener("enterFrame", loadUpdate);
}
private function mouseup(_arg1):void{
stage.addEventListener("mouseDown", mouseclick);
stage.removeEventListener("mouseUp", mouseup);
}
private function mouseclick(_arg1):void{
addBullet();
laser_sound.play(100);
stage.addEventListener("mouseUp", mouseup);
stage.removeEventListener("mouseDown", mouseclick);
}
private function stopGame():void{
timer.removeEventListener("timer", ontime);
removeEventListener("enterFrame", game);
if (stage.hasEventListener("mouseDown")){
stage.removeEventListener("mouseDown", mouseclick);
};
if (stage.hasEventListener("mouseUp")){
stage.removeEventListener("mouseUp", mouseup);
};
startMenu();
}
private function addBullet():void{
var _local1:Particle;
var _local2:Number;
var _local3:ColorTransform;
_local1 = new Particle(latest);
if (latest){
latest.next = _local1;
};
latest = _local1;
_local2 = (((player.clock_circle.rotation + (Math.random() * 4)) - 2) * to_rad);
_local1.x = player.x;
_local1.y = player.y;
_local1.x_spd = (Math.sin(_local2) * 11);
_local1.y_spd = (Math.cos(_local2) * -11);
_local3 = new ColorTransform();
_local3.redOffset = ((Math.random() * 510) - 0xFF);
_local3.greenOffset = ((Math.random() * 510) - 0xFF);
_local3.blueOffset = ((Math.random() * 510) - 0xFF);
_local1.color = _local3.color;
}
private function ontime(_arg1):void{
var _local2:Clock;
var _local3:Boolean;
var _local4:Boolean;
_local2 = new Clock((Math.round((Math.random() * 6)) + 2));
_local3 = Boolean(Math.round(Math.random()));
_local4 = Boolean(Math.round(Math.random()));
if (_local3){
if (_local4){
_local2.x = -30;
} else {
_local2.x = 580;
};
_local2.y = (Math.random() * 400);
} else {
if (_local4){
_local2.y = -30;
} else {
_local2.y = 430;
};
_local2.x = (Math.random() * 550);
};
_local2.speed = ((Math.random() * 5) + 1);
enemies.push(_local2);
clocks.addChild(_local2);
if (extra_time < max_extra){
extra_time = (extra_time + 80);
};
timer.delay = (((Math.random() * 1500) + 2500) - extra_time);
}
private function loadUpdate(_arg1):void{
loader.bar.scaleX = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
if (loader.bar.scaleX){
removeChild(loader);
gotoAndStop(2);
gotoAndStop(1);
removeEventListener("enterFrame", loadUpdate);
laser_sound = new Laser();
loop = new Loop();
loop.play(0, 999);
startMenu();
};
}
private function startGame(_arg1):void{
var _local2:Clock;
removeChild(menu_screen);
menu_screen = null;
for each (_local2 in enemies) {
clocks.removeChild(_local2);
};
enemies = new Array();
if (player){
removeChild(player);
};
clocks = new Sprite();
addChild(clocks);
player = new Clock(1);
player.x = (stage.stageWidth / 2);
player.y = (stage.stageHeight / 2);
addChild(player);
latest = null;
if (bullet_show){
bullet_show.dispose();
};
bullet_show = new BitmapData(550, 400, true, 0);
bullet_show_show = new Bitmap(bullet_show, "auto", false);
addChild(bullet_show_show);
x_spd = 0;
y_spd = 0;
score = 0;
extra_time = 0;
if (score_text){
removeChild(score_text);
};
score_text = new TextField();
score_text.defaultTextFormat = new TextFormat(new MyFont().fontName, 13, 0xFFFFFF);
score_text.embedFonts = true;
score_text.selectable = false;
score_text.autoSize = "left";
score_text.text = "score: 0";
addChild(score_text);
addEventListener("enterFrame", game);
timer.addEventListener("timer", ontime);
stage.addEventListener("mouseDown", mouseclick);
timer.delay = 1500;
timer.start();
}
private function startMenu():void{
var _local1:PlayButton;
menu_screen = new MenuScreen();
addChild(menu_screen);
_local1 = new PlayButton();
_local1.x = 273.9;
_local1.y = 337.5;
menu_screen.addChild(_local1);
_local1.addEventListener("click", startGame, false, 0, false);
}
private function game(_arg1):void{
var _local2:Clock;
var _local3:Particle;
var _local4:Number;
var _local5:Number;
var _local6:Boolean;
var _local7:int;
var _local8:Number;
var _local9:Particle;
var _local10:ColorTransform;
if (((Key.isDown[Key.LEFT]) || (Key.isDown[Key.A]))){
if (x_spd > -(max_spd)){
x_spd = (x_spd - 0.9);
};
} else {
if (((Key.isDown[Key.RIGHT]) || (Key.isDown[Key.D]))){
if (x_spd < max_spd){
x_spd = (x_spd + 0.9);
};
} else {
x_spd = (x_spd * 0.9);
};
};
if (((Key.isDown[Key.UP]) || (Key.isDown[Key.W]))){
if (y_spd > -(max_spd)){
y_spd = (y_spd - 0.9);
};
} else {
if (((Key.isDown[Key.DOWN]) || (Key.isDown[Key.S]))){
if (y_spd < max_spd){
y_spd = (y_spd + 0.9);
};
} else {
y_spd = (y_spd * 0.9);
};
};
score_text.scaleX = (score_text.scaleX + ((1 - score_text.scaleX) / 5));
score_text.scaleY = score_text.scaleX;
player.clock_graphic.rotation = (x_spd * 4);
player.clock_circle.rotation = ((Math.atan2((mouseY - player.y), (mouseX - player.x)) * to_deg) + 90);
player.x = (player.x + x_spd);
player.y = (player.y + y_spd);
if ((((player.x < 0)) || ((player.x > 550)))){
x_spd = -(x_spd);
};
if ((((player.y < 0)) || ((player.y > 400)))){
y_spd = -(y_spd);
};
player.x = Math.max(0, Math.min(player.x, 550));
player.y = Math.max(0, Math.min(player.y, 400));
for each (_local2 in enemies) {
_local4 = (Math.atan2((_local2.y - player.y), (_local2.x - player.x)) + ninety_rad);
_local5 = (-(_local2.speed) * Math.sin(_local4));
_local2.x = (_local2.x + _local5);
_local2.y = (_local2.y + (_local2.speed * Math.cos(_local4)));
_local2.clock_graphic.rotation = (_local5 * 6);
_local2.clock_circle.rotation = (_local2.clock_circle.rotation + 1);
};
bullet_show.applyFilter(bullet_show, rect, zero_point, filter);
_local3 = latest;
while (_local3) {
_local6 = false;
_local3.x = (_local3.x + _local3.x_spd);
_local3.y = (_local3.y + _local3.y_spd);
if (_local3.for_show){
_local6 = true;
};
bullet_show.setPixel32(_local3.x, _local3.y, _local3.color);
bullet_show.setPixel32((_local3.x + 1), _local3.y, _local3.color);
bullet_show.setPixel32((_local3.x + 1), (_local3.y + 1), _local3.color);
bullet_show.setPixel32(_local3.x, (_local3.y + 1), _local3.color);
if (((!(_local3.for_show)) && (clocks.hitTestPoint(_local3.x, _local3.y, true)))){
_local7 = (enemies.length - 1);
while (_local7 >= 0) {
if (!enemies[_local7].hitTestPoint(_local3.x, _local3.y, true)){
} else {
enemies[_local7].health = (enemies[_local7].health - 1);
if (enemies[_local7].health <= 0){
score = (score + 1);
score_text.text = ("score: " + score);
score_text.scaleX = (score_text.scaleY = 3);
_local8 = -(Math.PI);
while (_local8 <= Math.PI) {
_local9 = new Particle(latest);
if (latest){
latest.next = _local9;
};
latest = _local9;
_local9.x = _local3.x;
_local9.y = _local3.y;
_local9.x_spd = (Math.sin(_local8) * 4);
_local9.y_spd = (Math.cos(_local8) * -4);
_local9.for_show = true;
_local10 = new ColorTransform();
_local10.redOffset = ((Math.random() * 510) - 0xFF);
_local10.greenOffset = ((Math.random() * 510) - 0xFF);
_local10.blueOffset = ((Math.random() * 510) - 0xFF);
_local9.color = _local10.color;
_local9 = new Particle(latest);
if (latest){
latest.next = _local9;
};
latest = _local9;
_local9.x = _local3.x;
_local9.y = _local3.y;
_local9.x_spd = (Math.sin(_local8) * 3);
_local9.y_spd = (Math.cos(_local8) * -3);
_local9.for_show = true;
_local10 = new ColorTransform();
_local10.redOffset = ((Math.random() * 510) - 0xFF);
_local10.greenOffset = ((Math.random() * 510) - 0xFF);
_local10.blueOffset = ((Math.random() * 510) - 0xFF);
_local9.color = _local10.color;
_local8 = (_local8 + (Math.PI / 10));
};
clocks.removeChild(enemies[_local7]);
enemies.splice(_local7, 1);
};
_local6 = true;
break;
};
_local7--;
};
};
if ((((((((((_local3.x < 0)) || ((_local3.x > 550)))) || ((_local3.y < 0)))) || ((_local3.y > 400)))) || (_local6))){
if (_local3.next){
if (_local3.previous){
_local3.next.previous = _local3.previous;
} else {
_local3.next.previous = null;
};
};
if (_local3.previous){
if (_local3.next){
_local3.previous.next = _local3.next;
} else {
_local3.previous.next = null;
};
};
if (_local3 == latest){
if (_local3.previous){
latest = _local3.previous;
} else {
latest = null;
};
};
};
_local3 = _local3.previous;
};
if (clocks.hitTestPoint(player.x, player.y, true)){
stopGame();
};
}
}
}//package
Section 7
//MenuScreen (MenuScreen)
package {
import flash.display.*;
public dynamic class MenuScreen extends Sprite {
}
}//package
Section 8
//MyFont (MyFont)
package {
import flash.text.*;
public dynamic class MyFont extends Font {
}
}//package
Section 9
//Particle (Particle)
package {
public class Particle {
public var color:uint;
public var y_spd:Number;
public var x_spd:Number;
public var next:Particle;
public var previous:Particle;
public var x:int;
public var y:int;
public var for_show:Boolean;// = false
public function Particle(_arg1:Particle){
for_show = false;
super();
previous = _arg1;
}
}
}//package
Section 10
//PlayButton (PlayButton)
package {
import flash.display.*;
public dynamic class PlayButton extends SimpleButton {
}
}//package
Section 11
//Preloader (Preloader)
package {
import flash.display.*;
public dynamic class Preloader extends Sprite {
public var bar:MovieClip;
}
}//package