[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Section 1 (323 B)
//electric_12 (h2opanic_fla.electric_12)
package h2opanic_fla {
import flash.display.*;
public dynamic class electric_12 extends MovieClip {
public function electric_12(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
stop();
}
}
}//package h2opanic_fla
Section 2 (1.58 KiB) ●
//AAGun (AAGun)
package {
import flash.events.*;
import flash.display.*;
public class AAGun extends MovieClip {
private var ay:Number;// = 0
private var ax:Number;// = 0
var speed:Number;// = 1
private var vx:Number;// = 0
private var vy:Number;// = 0
public function AAGun(){
speed = 1;
ax = 0;
vx = 0;
vy = 0;
ay = 0;
super();
this.x = 275;
this.y = 50;
addEventListener(Event.ENTER_FRAME, moveGun);
}
public function moveGun(_arg1:Event){
var newx:*;
var newy:*;
var myKeyUp:Function;
var event = _arg1;
myKeyUp = function (_arg1:KeyboardEvent):void{
trace("myKeyUp");
ax = 0;
ay = 0;
};
newx = this.x;
newy = this.y;
if (MovieClip(parent).A_Button){
newx = (newx - speed);
ax = -0.2;
vx = (vx + ax);
vy = (vy + ay);
newx = (newx + vx);
newy = (newy + vy);
};
if (MovieClip(parent).D_Button){
newx = (newx + speed);
ax = 0.2;
vx = (vx + ax);
vy = (vy + ay);
newx = (newx + vx);
newy = (newy + vy);
};
if (MovieClip(parent).W_Button){
newy = (newy - speed);
ay = -0.2;
vx = (vx + ax);
vy = (vy + ay);
newx = (newx + vx);
newy = (newy + vy);
};
if (MovieClip(parent).S_Button){
newy = (newy + speed);
ay = 0.2;
vx = (vx + ax);
vy = (vy + ay);
newx = (newx + vx);
newy = (newy + vy);
};
if (newx < 10){
newx = 10;
};
if (newx > 540){
newx = 540;
};
if (newy < 20){
newy = 20;
};
if (newy > 380){
newy = 380;
};
this.x = newx;
this.y = newy;
}
}
}//package
Section 3 (1.2 KiB) ●
//Asteroid (Asteroid)
package {
import flash.events.*;
import flash.display.*;
public class Asteroid extends MovieClip {
var canStartAsteroid;// = true
private var vx:Number;
private var vy:Number;// = -400
public function Asteroid(){
vy = -400;
canStartAsteroid = true;
super();
addFrameScript(0, frame1);
init();
}
private function init():void{
this.y = (this.y + vy);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function resetAsteroid():void{
this.y = ((Math.random() * -100) - 100);
this.x = (Math.random() * 550);
vy = ((Math.random() * 2) + 4);
}
public function startAsteroid():void{
if (canStartAsteroid == true){
this.x = (Math.random() * 550);
this.y = ((Math.random() * -100) - 100);
vy = ((Math.random() * 2) + 4);
canStartAsteroid = false;
};
}
function frame1(){
stop();
}
private function onEnterFrame(_arg1:Event):void{
if (canStartAsteroid == false){
this.y = (this.y + vy);
};
if ((this.y - 50) > stage.stageHeight){
this.y = ((Math.random() * -400) - 100);
this.x = (Math.random() * 550);
vy = ((Math.random() * 2) + 4);
canStartAsteroid = true;
};
}
}
}//package
Section 4 (1.19 KiB) ●
//Bullet (Bullet)
package {
import flash.events.*;
import flash.display.*;
public class Bullet extends MovieClip {
private var myBulletRotation:Number;// = 0
private var deltaY;
private var deltaX;
private var bulletMoving:Boolean;// = false
public function Bullet(){
bulletMoving = false;
myBulletRotation = 0;
super();
init();
}
public function startBullet(_arg1, _arg2, _arg3, _arg4, _arg5:Number):void{
if (bulletMoving == false){
this.x = _arg1;
this.y = _arg2;
deltaX = _arg3;
deltaY = _arg4;
myBulletRotation = _arg5;
this.rotation = myBulletRotation;
bulletMoving = true;
};
}
public function init():void{
this.x = 150;
this.y = 600;
addEventListener(Event.ENTER_FRAME, moveBullet);
}
public function resetBullet():void{
this.x = 150;
this.y = 600;
bulletMoving = false;
}
public function moveBullet(_arg1:Event){
if (bulletMoving == true){
this.y = (this.y + deltaY);
this.x = (this.x + deltaX);
if ((((((((this.y < 0)) || ((this.y > 400)))) || ((this.x < 0)))) || ((this.x > 550)))){
this.x = 150;
this.y = 600;
bulletMoving = false;
};
};
}
}
}//package
Section 5 (112 B)
//elec (elec)
package {
import flash.display.*;
public dynamic class elec extends MovieClip {
}
}//package
Section 6 (115 B)
//gunshot (gunshot)
package {
import flash.media.*;
public dynamic class gunshot extends Sound {
}
}//package
Section 7 (115 B)
//popcork (popcork)
package {
import flash.media.*;
public dynamic class popcork extends Sound {
}
}//package
Section 8 (118 B)
//popcork2 (popcork2)
package {
import flash.media.*;
public dynamic class popcork2 extends Sound {
}
}//package
Section 9 (118 B)
//popcork3 (popcork3)
package {
import flash.media.*;
public dynamic class popcork3 extends Sound {
}
}//package
Section 10 (8.68 KiB) ● ●
//StartTrigGame (StartTrigGame)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class StartTrigGame extends MovieClip {
public var left:Boolean;
public var txtScore:TextField;
public var right:Boolean;
var canFire:Boolean;// = true
private var myHitSound3:Sound;
public var jump:Boolean;
private var myHitSound2:Sound;
private var numAsteroids:Number;// = 8
public var W_Button;
var shotxspeed:Number;// = 0
public var grav:Number;
private var asteroidArray:Array;
private var bulletArray:Array;
var bulletSpeed:Number;// = 5
public var acc:Number;
public var test:int;
public var up:Boolean;
private var score:int;// = 10
public var jumpAble;
public var down:Boolean;
public var minusNumNum:Number;
public var S_Button;
public var vx:Number;
public var vy:Number;
public var startit2:Boolean;
public var startit3:Boolean;
public var time:Number;
var shotyspeed:Number;// = 0
public var jumpHeight:Number;
public var minusNum:Number;
var myTimer:Timer;
private var myHitSound:Sound;
public var startit:Boolean;
public var A_Button;
public var maxSpeed:Number;
public var elec1:MovieClip;
private var numBullets:Number;// = 17
public var man:MovieClip;
var whichBullet:Number;// = 0
public var ground:MovieClip;
public var D_Button:Boolean;
public var timerTime:Timer;
public var water_mc:MovieClip;
private var myCannon:AAGun;
public var startit16:Boolean;
var whichAsteroid:Number;// = 0
public function StartTrigGame(){
score = 10;
bulletSpeed = 5;
shotxspeed = 0;
shotyspeed = 0;
numBullets = 17;
whichBullet = 0;
canFire = true;
numAsteroids = 8;
whichAsteroid = 0;
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
init();
}
function timerFunction(_arg1:TimerEvent):void{
asteroidArray[whichAsteroid].startAsteroid();
whichAsteroid++;
if (whichAsteroid >= (asteroidArray.length - 1)){
whichAsteroid = 0;
};
}
public function gravity(_arg1){
grav++;
if (man.hitTestObject(ground)){
grav--;
grav = 0;
grav = (grav - (jumpHeight / minusNum));
minusNum = (minusNum + minusNumNum);
jumpAble = true;
if (minusNum >= jumpHeight){
minusNumNum = 0;
grav = (grav + (jumpHeight / minusNum));
};
};
if (right){
vx++;
};
if (left){
vx--;
};
if (((!(right)) && (!(left)))){
vx = (vx * acc);
};
if (((((man.x + man.width) > 550)) || (((man.x - man.width) < 0)))){
vx = (vx * -6);
};
if (vx >= maxSpeed){
vx = maxSpeed;
};
if (vx <= -(maxSpeed)){
vx = -(maxSpeed);
};
if (up){
if (jumpAble){
grav = (grav - jumpHeight);
jumpAble = false;
minusNum = 2;
minusNumNum = 2;
};
};
man.y = (man.y + grav);
man.x = (man.x + vx);
}
function frame3(){
stop();
grav = 5;
jump = false;
vx = 10;
vy = 10;
acc = 0.9;
maxSpeed = 11;
jumpHeight = 14;
jumpAble = false;
minusNum = 2;
minusNumNum = 2;
stage.addEventListener(Event.ENTER_FRAME, gravity);
timerTime = new Timer(1000, 100);
timerTime.addEventListener(TimerEvent.TIMER, timerCountDown);
timerTime.start();
time = 100;
test = 95;
if (man.hitTestObject(water_mc)){
grav = 20;
trace("WHYWONTYOUWORK");
jumpHeight = 1;
maxSpeed = 2;
};
}
function frame4(){
stop();
stop();
score = 10;
startit3 = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown4);
timerTime.stop();
time = 100;
}
function frame5(){
stop();
score = 10;
startit2 = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown3);
timerTime.stop();
time = 100;
}
function frame6(){
stop();
}
function frame1(){
stop();
startit = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown2);
startit16 = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown16);
}
public function timerCountDown(_arg1:TimerEvent):void{
time--;
if (time == 0){
gotoAndPlay(4);
};
if (time == 13){
elec1.gotoAndPlay(2);
};
}
function frame2(){
right = false;
left = false;
up = false;
down = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeys);
stage.addEventListener(KeyboardEvent.KEY_UP, checkKeyUp);
}
public function keyDown2(_arg1:KeyboardEvent){
if (_arg1.keyCode == 32){
startit = true;
gotoAndPlay(2);
};
}
public function keyDown4(_arg1:KeyboardEvent){
if (_arg1.keyCode == 17){
startit3 = true;
gotoAndPlay(1);
};
}
public function keyDown3(_arg1:KeyboardEvent){
if (_arg1.keyCode == 17){
startit2 = true;
gotoAndPlay(1);
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
_local2 = Math.atan2((mouseY - myCannon.y), (mouseX - myCannon.x));
_local3 = Math.round(((_local2 * 180) / Math.PI));
myCannon.rotation = _local3;
_local4 = (bulletArray.length - 1);
while (_local4 >= 0) {
_local5 = (asteroidArray.length - 1);
while (_local5 >= 0) {
if (man.hitTestObject(asteroidArray[_local5])){
score++;
myHitSound2.play(0, 1);
trace(score);
txtScore.text = String(score);
asteroidArray[_local5].resetAsteroid();
};
if (bulletArray[_local4].hitTestObject(man)){
bulletArray[_local4].resetBullet();
score--;
myHitSound.play(0, 1);
txtScore.text = String(score);
trace(score);
if (score == 0){
gotoAndStop(5);
};
};
if (bulletArray[_local4].hitTestObject(asteroidArray[_local5])){
myHitSound3.play(0, 1);
asteroidArray[_local5].resetAsteroid();
bulletArray[_local4].resetBullet();
};
_local5--;
};
_local4--;
};
}
public function keyDownFunction(_arg1:KeyboardEvent){
}
private function init():void{
var _local1:uint;
var _local2:uint;
var _local3:*;
var _local4:*;
myHitSound = new popcork2();
myHitSound2 = new popcork();
myHitSound3 = new popcork3();
myCannon = new AAGun();
bulletArray = new Array();
asteroidArray = new Array();
_local1 = 0;
while (_local1 < numAsteroids) {
_local3 = new Asteroid();
addChild(_local3);
asteroidArray.push(_local3);
_local1++;
};
addChild(myCannon);
_local2 = 0;
while (_local2 < numBullets) {
_local4 = new Bullet();
addChild(_local4);
bulletArray.push(_local4);
_local2++;
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMousePress);
stage.addEventListener(MouseEvent.MOUSE_UP, onMyMouseUp);
myTimer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, timerFunction);
myTimer.start();
}
public function checkKeys(_arg1:KeyboardEvent){
if (_arg1.keyCode == ((37) || (87))){
left = true;
};
if (_arg1.keyCode == ((38) || (83))){
up = true;
};
if (_arg1.keyCode == ((39) || (65))){
right = true;
};
if (_arg1.keyCode == ((40) || (68))){
down = true;
};
}
public function checkKeyUp(_arg1:KeyboardEvent){
if (_arg1.keyCode == ((37) || (87))){
_arg1.keyCode = 0;
left = false;
};
if (_arg1.keyCode == ((38) || (83))){
_arg1.keyCode = 0;
up = false;
};
if (_arg1.keyCode == ((39) || (65))){
_arg1.keyCode = 0;
right = false;
};
if (_arg1.keyCode == ((40) || (68))){
_arg1.keyCode = 0;
down = false;
};
}
public function keyDown16(_arg1:KeyboardEvent){
if (_arg1.keyCode == 13){
startit16 = true;
gotoAndPlay(6);
};
}
public function onMyMouseUp(_arg1:MouseEvent):void{
canFire = true;
}
public function onMousePress(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = (myCannon.y - mouseY);
_local3 = (myCannon.x - mouseX);
_local4 = Math.sqrt(((_local3 * _local3) + (_local2 * _local2)));
_local5 = ((myCannon.y - mouseY) / _local4);
shotyspeed = (bulletSpeed * _local5);
shotyspeed = (shotyspeed * -1);
_local6 = ((mouseX - myCannon.x) / _local4);
shotxspeed = (bulletSpeed * _local6);
_local7 = Math.atan2((mouseY - myCannon.y), (mouseX - myCannon.x));
_local8 = Math.round(((_local7 * 180) / Math.PI));
if (canFire == true){
bulletArray[whichBullet].startBullet(myCannon.x, myCannon.y, shotxspeed, shotyspeed, _local8);
whichBullet++;
if (whichBullet >= (bulletArray.length - 1)){
whichBullet = 0;
};
canFire = false;
};
}
}
}//package
Section 11 (117 B)
//turret (turret)
package {
import flash.display.*;
public dynamic class turret extends MovieClip {
}
}//package