Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import adobe.utils.CustomActions;
- import org.flixel.*;
- public class TitleState extends FlxState
- {
- //[Embed (source = "../data/block/bg.png")] private var bg_img:Class;
- [Embed(source = "../data/font/visitor1.ttf", fontFamily = "BlockFont")] public var BlockFont:String;
- public const MAX_BULLETS:int = 300;
- public const MAX_BLOOD:int = 300;
- public const MAX_BONE:int = 300;
- public const MAX_SHARD:int = 300;
- public const MAX_GUYS:int = 10;
- public var slowmoverlay:FlxSprite = new FlxSprite (0,0);
- public var cursor:FlxSprite;
- public var hellgate:Boolean = true;
- public var bg:FlxSprite = new FlxSprite(0, 0);
- public var group_walls:FlxGroup = new FlxGroup();
- public var player:Player;
- //public var group_bullets:FlxGroup = new FlxGroup();
- //public var group_shards:FlxGroup = new FlxGroup();
- public var group_bones:FlxGroup = new FlxGroup();
- public var group_guys:FlxGroup = new FlxGroup();
- public var group_eyes:FlxGroup = new FlxGroup();
- public var group_eyeballs:FlxGroup = new FlxGroup();
- public var group_blocks:FlxGroup = new FlxGroup();
- //public var group_blood:FlxGroup = new FlxGroup();
- public var timer:int = 60000;
- //premade groups
- public var bulletGroup:FlxGroup;
- public var bloodGroup:FlxGroup;
- public var boneGroup:FlxGroup;
- public var shardGroup:FlxGroup;
- public var dummy:Guy;
- public var guyGroup:FlxGroup;
- public var gate_N:Gate;
- public var gate_E:Gate;
- public var gate_S:Gate;
- public var gate_W:Gate;
- public var group_gates:FlxGroup = new FlxGroup();
- public var group_gate_blockers:FlxGroup = new FlxGroup();
- public var group_hudtext:FlxGroup = new FlxGroup();
- public var txtAmmo:FlxText;
- public var txtAmmoNumber:FlxText;
- public var txtScore:FlxText;
- public var txtScoreNumber:FlxText;
- public var txtHighScore:FlxText;
- public var txtLevel:FlxText;
- public var txtLevelNumber:FlxText;
- public var paused:Boolean = false;
- public var sidebar_R:SideBar;
- public var sidebar_L:SideBar;
- public function TitleState()
- {
- super()
- }
- public function makeGuy(x:int, y:int, hcolor:uint, bcolor:uint, zombie:Boolean):void
- {
- var s:Guy = guyGroup.getFirstAvailable() as Guy;
- if (s != null)
- {
- s.spawn(x, y, hcolor, bcolor, zombie);
- }
- }
- public function makeBullet(x:int, y:int, vx:Number, vy:Number, color:uint):void
- {
- var s:Bullet = bulletGroup.getFirstAvailable() as Bullet;
- if (s != null)
- {
- s.spawn(x, y, vx, vy, color);
- }
- }
- public function makeBlood(x:int, y:int, vx:Number, vy:Number, color:uint):void
- {
- var s:Blood = bloodGroup.getFirstAvailable() as Blood;
- if (s != null)
- {
- s.spawn(x, y, vx, vy, color);
- }
- }
- public function makeBone(x:int, y:int, vx:Number, vy:Number):void
- {
- var s:Bone = boneGroup.getFirstAvailable() as Bone;
- if (s != null)
- {
- s.spawn(x, y, vx, vy);
- }
- }
- public function makeShard(x:int, y:int, vx:Number, vy:Number, color:uint):void
- {
- var s:Shard = shardGroup.getFirstAvailable() as Shard;
- if (s != null)
- {
- s.spawn(x, y, vx, vy, color);
- }
- }
- override public function create():void
- {
- super.create();
- bg.makeGraphic(400,400,0x000000)
- bg.color = 0x000000;
- slowmoverlay.makeGraphic(400, 400, 0xffffffff);
- slowmoverlay.alpha = 0;
- //premade groups
- bulletGroup = new FlxGroup();
- bloodGroup = new FlxGroup();
- boneGroup = new FlxGroup();
- shardGroup = new FlxGroup();
- guyGroup = new FlxGroup();
- /*
- for (var c:int = 0; c < MAX_BULLETS; c++)
- {
- bulletGroup.add(new Bullet());
- }
- */
- FlxG.stage.quality = "LOW";
- //outer walls
- for (var i:int = 0; i < 79; i++)
- {
- group_walls.add(new Wall((i * 4) + 40, 40));
- group_walls.add(new Wall((i * 4) + 44, 356));
- group_walls.add(new Wall(356, 40 + (i*4)));
- group_walls.add(new Wall(40, 44 + (i * 4)));
- group_walls.add(new Wall(12, 40 + (i * 4)));
- group_walls.add(new Wall(384, 40 + (i*4)));
- }
- //horizontal extra
- for (var j:int = 0; j < 10; j++)
- {
- group_walls.add(new Wall((j * 4), 40));
- group_walls.add(new Wall((j * 4)+360, 40));
- group_walls.add(new Wall((j * 4), 356));
- group_walls.add(new Wall((j * 4)+360, 356));
- }
- //right sidebar:slowmo
- sidebar_L = new SideBar(16, 44, 24, 312, 0, 0xff279ea5);
- sidebar_R = new SideBar(360, 44, 24, 312, 1, 0xffffa257);
- //N Gate
- gate_N = new Gate(180, 60, "N");
- gate_E = new Gate(336, 180, "E");
- gate_S = new Gate(180, 336, "S");
- gate_W = new Gate(60, 180, "W");
- player = new Player();
- //player.health_color = 0x35d2dc;
- //player.fill_health();
- //player.block = new Block(player.x + 2, player.y + 2);
- //player.block.block_color = 0xff279ea5;
- //player.block.fill_block();
- //player.block.guy = player;
- //player.eye = new Eye(0, 0);
- //player.eyeball = new Eyeball(0, 0);
- sidebar_L.fill_bar();
- //group_guys.add(player);
- //group_eyes.add(player.eye);
- //group_eyeballs.add(player.eyeball);
- //group_blocks.add(player.block);
- //group_bullets.add(player.group_bullets);
- txtAmmo = new FlxText(16, 360, 120, "AMMO:");
- txtAmmo.setFormat("BlockFont", 40);
- group_hudtext.add(txtAmmo);
- txtAmmoNumber = new FlxText(128, 360, 120, String(player.ammo));
- txtAmmoNumber.setFormat("BlockFont", 40,0xffffff,"left");
- group_hudtext.add(txtAmmoNumber);
- txtScore = new FlxText(100, 0, 200, "SCORE:");
- txtScore.setFormat("BlockFont", 40,0xffffff,"center");
- group_hudtext.add(txtScore);
- txtScoreNumber = new FlxText(240, 0, 150, String(player.score));
- txtScoreNumber.setFormat("BlockFont", 40, 0xffffff,"right");
- group_hudtext.add(txtScoreNumber);
- txtHighScore = new FlxText(16, 0, 160, String(FlxG.high_score));
- txtHighScore.setFormat("BlockFont", 40, 0xffffff, "left");
- group_hudtext.add(txtHighScore);
- txtLevel = new FlxText(220, 360, 150, "LEVEL:");
- txtLevel.setFormat("BlockFont", 40);
- group_hudtext.add(txtLevel);
- txtLevelNumber = new FlxText(360, 360, 120, String(FlxG.block_level));
- txtLevelNumber.setFormat("BlockFont", 40);
- group_hudtext.add(txtLevelNumber);
- //FlxG.timeScale = 1;
- add(bg);
- add(gate_N.group_gate);
- add(gate_E.group_gate);
- add(gate_S.group_gate);
- add(gate_W.group_gate);
- add(group_walls);
- add(sidebar_R);
- sidebar_R.fill_bar();
- add(sidebar_L);
- sidebar_L.fill_bar();
- group_gate_blockers.add(new GateBlocker(40, 40));
- group_gate_blockers.add(new GateBlocker(320, 40));
- group_gate_blockers.add(new GateBlocker(40, 320));
- group_gate_blockers.add(new GateBlocker(320, 320));
- add(group_gate_blockers);
- add(gate_N);
- group_walls.add(gate_N.group_walls_a)
- group_walls.add(gate_N.group_walls_b)
- group_walls.add(gate_N.group_walls_c)
- group_walls.add(gate_N.group_walls_d)
- add(gate_E);
- group_walls.add(gate_E.group_walls_a)
- group_walls.add(gate_E.group_walls_b)
- group_walls.add(gate_E.group_walls_c)
- group_walls.add(gate_E.group_walls_d)
- add(gate_S);
- group_walls.add(gate_S.group_walls_a)
- group_walls.add(gate_S.group_walls_b)
- group_walls.add(gate_S.group_walls_c)
- group_walls.add(gate_S.group_walls_d)
- add(gate_W);
- group_walls.add(gate_W.group_walls_a)
- group_walls.add(gate_W.group_walls_b)
- group_walls.add(gate_W.group_walls_c)
- group_walls.add(gate_W.group_walls_d)
- add(group_hudtext);
- //add(group_blood);
- add(bloodGroup);
- for (var e: int = 0; e < MAX_BLOOD; e++)
- {
- bloodGroup.add(new Blood());
- }
- add(boneGroup);
- for (var f: int = 0; f < MAX_BONE; f++)
- {
- boneGroup.add(new Bone());
- }
- add(shardGroup);
- for (var g: int = 0; g < MAX_SHARD; g++)
- {
- shardGroup.add(new Shard());
- }
- add(guyGroup);
- for (var h:int = 0; h < MAX_GUYS; h++)
- {
- var newguy:Guy = new Guy();
- guyGroup.add(newguy);
- group_blocks.add(newguy.block);
- group_eyes.add(newguy.eye);
- group_eyeballs.add(newguy.eyeball);
- }
- //player.spawn(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xff35d2dc, 0xff279ea5, false);
- //add(group_guys);
- add(group_eyes);
- add(group_eyeballs);
- add(group_blocks);
- //add(group_bullets);
- //add(group_shards);
- //add(group_bones);
- //new
- add(bulletGroup);
- for (var d: int = 0; d < MAX_BULLETS; d++)
- {
- bulletGroup.add(new Bullet());
- }
- cursor = new FlxSprite(0, 0);
- cursor.makeGraphic(12, 12, 0xffffff);
- cursor.drawLine(0, 1, 12, 1, 0xffffff, 2);
- cursor.drawLine(11, 0, 11, 12, 0xffffff, 2);
- cursor.drawLine(0, 11, 12, 11, 0xffffff, 2);
- cursor.drawLine(1, 0, 1, 12, 0xffffff, 2);
- cursor.alpha = 0.3;
- cursor.drawLine(5, 6, 7, 6, 0xffffff, 2);
- cursor.offset.x = 6;
- cursor.offset.y = 6;
- //FlxG.mouse.cursor = cursor;
- add(cursor);
- //FlxG.mouse.show();
- FlxKongregate.init(apiHasLoaded);
- for (var a:int = 0; a < gate_N.num_walls; a++)
- {
- gate_N.group_gate.members[a].color = 0x05df05;
- }
- for (var b:int = 0; b < gate_W.num_walls; b++)
- {
- gate_W.group_gate.members[b].color = 0xff0000;
- }
- //dummy = new Guy(190, 190);
- //dummy.hits = 0;
- add(slowmoverlay);
- makeGuy(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xffffa257, 0xffff3b3b, false);
- }
- public function move_dummy(dummy:Guy):void
- {
- if (Math.random() < .05)
- {
- dummy.dest_x = (Math.random() - .5) * 60;
- dummy.dest_y = (Math.random() - .5) * 60;
- }
- if (Math.random() < .05)
- {
- dummy.pushing_space = true;
- }
- if(Math.random() < .5)
- {
- dummy.pushing_space = false;
- }
- if (Math.random() < .02)
- {
- if (Math.abs(dummy.dest_x) > 20 || Math.abs(dummy.dest_y) > 20)
- {
- dummy.shoot();
- }
- }
- }
- public function block_hit_guy(a:Block, b:Guy):void
- {
- if (b.block != a)
- {
- if (a.hit_timer == 0)
- {
- b.get_hit_by_block(a);
- FlxObject.separate(a, b);
- }
- }
- }
- public function vaporize(a:Guy,b:Wall):void
- {
- makeBullet(a.x, a.y + 10, 666, 0, 0xffff0000);
- }
- public function check_goal(bullet:Bullet,wall:Wall):void
- {
- //trace(bullet.color,player.health_color)
- if (wall.color == 0x05df05 && bullet.color == 0x35d2dc)
- {
- player.score_points(50);
- }
- bullet.kill();
- }
- public function block_hit_block(a:Block, b:Block):void
- {
- a.guy.recoil_timer = 3;
- b.guy.recoil_timer = 3;
- }
- public function bullet_collision(a:Bullet, b:Bullet):void
- {
- var shard_vy:int;
- var shard_vx:int;
- if (a.life_timer > 10 && b.life_timer > 6)
- {
- if (a.color == player.health_color && b.color == player.health_color)
- {
- player.score_points(25);
- }
- for (var i:int = 0; i < 4; i++)
- {
- //var shardya:Shard = new Shard(a.x, a.y);
- shard_vx = ((a.velocity.x + b.velocity.x) / 2) * (Math.random() - .5);
- shard_vy = ((a.velocity.y + b.velocity.y) / 2) * (Math.random() - .5);
- if (shard_vx == 0)
- {
- shard_vx = 10*(Math.random() - .5);
- }
- if (shard_vy == 0)
- {
- shard_vy = 10*(Math.random() - .5);
- }
- //shardya.color = a.color;
- //group_shards.add(shardya);
- makeShard(a.x, a.y, shard_vx, shard_vy, a.color);
- }
- for (var j:int = 0; j < 5;j++)
- {
- shard_vx = ((a.velocity.x + b.velocity.x) / 2) * (Math.random() - .5);
- shard_vy = ((a.velocity.y + b.velocity.y) / 2) * (Math.random() - .5);
- if (shard_vx == 0)
- {
- shard_vx = 10*(Math.random() - .5);
- }
- if (shard_vy == 0)
- {
- shard_vy = 10*(Math.random() - .5);
- }
- //shardya.color = a.color;
- //group_shards.add(shardya);
- makeShard(b.x, b.y, shard_vx, shard_vy, b.color);
- }
- a.kill();
- b.kill();
- }
- }
- public function block_hit_bullet(a:Block, b:Bullet):void
- {
- //b.color = a.guy.color;
- b.hit_block(a);
- }
- public function bullet_hit_wall(a:Bullet, b:Wall):void
- {
- if (a.life_timer > 6)
- {
- //a.color = 0xffffff;
- }
- }
- public function bullet_hit_guy(a:Bullet, b:Guy):void
- {
- b.get_hit(a);
- }
- public function bullet_hit_player(a:Bullet, b:Player):void
- {
- b.get_hit(a);
- }
- public function pause_game():void
- {
- if (paused)
- {
- paused = false;
- }
- else
- {
- paused = true;
- }
- //trace(paused);
- }
- public function get_bone(a:Player,b:Bone):void
- {
- a.pickup_ammo();
- //a.slowmo += 10;
- //sidebar_L.fill_bar();
- b.kill();
- }
- public function move_gate_W():void
- {
- if (Math.random() > .99)
- {
- gate_W.velocity.y = (Math.random() - .5) * 200;
- }
- if (Math.random() > .99)
- {
- gate_W.acceleration.y = (Math.random() - .5) * 200;
- }
- if (gate_W.y < 60)
- {
- gate_W.velocity.y = Math.random() * 100;
- }
- if (gate_W.y > 332-gate_W.opening_width)
- {
- gate_W.velocity.y *= (Math.random() -1)* 100;
- }
- if (Math.random() > .87)
- {
- if (gate_W.y < 332 - gate_W.opening_width)
- {
- if(gate_W.opening_width < gate_W.max_width)
- {
- gate_W.opening_width += 1;
- }
- }
- }
- if (Math.random() > .9)
- {
- gate_W.opening_width -= 1;
- }
- if (gate_W.velocity.y > 500)
- {
- gate_W.velocity.y = 500;
- }
- if (gate_W.velocity.y < -500)
- {
- gate_W.velocity.y = -500;
- }
- //shoot
- if (Math.random() > .98 && hellgate==true)
- {
- for (var a:int = 0; a < gate_W.opening_width / 40; a++)
- {
- //var y_spawn:Number = gate_W.y +4 + (Math.random() * gate_W.opening_width - 4);
- /*
- var gate_shot:Bullet = new Bullet(gate_W.x-8, y_spawn);
- gate_shot.velocity.x = Math.random() * 200 + 100;
- gate_shot.velocity.y = gate_W.velocity.y + (gate_W.velocity.y * (Math.random() - .5));
- gate_shot.color = 0xff0000;
- group_bullets.add(gate_shot);
- */
- makeBullet(gate_W.x-8, gate_W.y +8 + (Math.random() * gate_W.opening_width - 4), Math.random() * 200 + 100, gate_W.velocity.y + (gate_W.velocity.y * (Math.random() - .5)), 0xff0000);
- //trace("bang");
- }
- }
- }
- public function move_gate_N():void
- {
- if (Math.random() > .99)
- {
- gate_N.velocity.x = (Math.random() - .5) * 200;
- }
- if (Math.random() > .99)
- {
- gate_N.acceleration.x = (Math.random() - .5) * 200;
- }
- if (gate_N.x < 60)
- {
- gate_N.velocity.x = Math.random() * 100;
- }
- if (gate_N.x > 332-gate_N.opening_width)
- {
- gate_N.velocity.x = (Math.random()-1)* 100;
- }
- if (Math.random() > .87)
- {
- if (gate_N.x < 332 - gate_N.opening_width)
- {
- if(gate_N.opening_width < gate_N.max_width)
- {
- gate_N.opening_width += 1;
- }
- }
- }
- if (Math.random() > .9)
- {
- gate_N.opening_width -= 1;
- }
- if (gate_N.velocity.x > 500)
- {
- gate_N.velocity.x = 500;
- }
- if (gate_N.velocity.x < -500)
- {
- gate_N.velocity.x = -500;
- }
- }
- override public function update():void
- {
- //if (!FlxG.kong) (FlxG.kong = parent.addChild(new FlxKong()) as FlxKong).init();
- timer -= FlxG.elapsed;
- if (timer % 20 == 0)
- {
- sidebar_R.fill_bar();
- }
- cursor.x = FlxG.mouse.screenX;
- cursor.y = FlxG.mouse.screenY;
- super.update();
- if (player.life_timer < 60)
- {
- //FlxG.timeScale = 0.2;
- }
- else
- {
- if (!FlxG.keys.SHIFT || player.slowmo == 0)
- {
- FlxG.timeScale = 1;
- }
- }
- for (var s:int = 0; s < guyGroup.members.length; s++)
- {
- if (guyGroup.members[s] != null)
- {
- move_dummy(guyGroup.members[s]);
- }
- }
- move_gate_W();
- move_gate_N();
- //player.move_eye();
- //ONE OR MORE OF THESE CALLS IS BREAKING THE GAME.
- //FIX IT!
- ///FlxG.overlap(guyGroup, gate_W.group_gate, vaporize);
- ///FlxG.collide(guyGroup, group_walls);
- ///FlxG.collide(group_blocks, group_walls);
- //FlxG.collide(group_blocks, group_bullets, block_hit_bullet);
- ///FlxG.collide(group_blocks, bulletGroup, block_hit_bullet);
- FlxG.collide(bulletGroup, group_walls);
- ///FlxG.collide(bulletGroup, bulletGroup, bullet_collision);
- ///FlxG.overlap(bulletGroup, guyGroup, bullet_hit_guy );
- ///FlxG.overlap(group_blocks, guyGroup, block_hit_guy );
- ////FlxG.overlap(bulletGroup, player, bullet_hit_player);
- //////FlxG.collide(bulletGroup, gate_N.group_gate, check_goal);
- //////FlxG.collide(bulletGroup, gate_E.group_gate, check_goal);
- //////FlxG.collide(bulletGroup, gate_S.group_gate, check_goal);
- //FlxG.collide(bulletGroup, gate_W.group_gate, check_goal);
- //FlxG.collide(group_bullets, group_walls, bullet_hit_wall );
- //FlxG.collide(group_bullets, group_bullets, bullet_collision);
- //FlxG.overlap(group_bullets, group_guys, bullet_hit_guy );
- /////FlxG.collide(shardGroup, group_walls);
- /////FlxG.collide(boneGroup, group_walls);
- /////FlxG.collide(bloodGroup, group_walls);
- ////////FlxG.collide(guyGroup, guyGroup);
- //FlxG.collide(group_guys, player);
- ///////FlxG.collide(group_blocks, group_blocks);
- //FlxG.collide(group_bullets, gate_N.group_gate, check_goal);
- //FlxG.collide(group_bullets, gate_E.group_gate, check_goal);
- //FlxG.collide(group_bullets, gate_S.group_gate, check_goal);
- //FlxG.collide(group_bullets, gate_W.group_gate, check_goal);
- ///////FlxG.collide(group_walls, group_gate_blockers);
- //FlxG.overlap(player, boneGroup, get_bone);
- if (timer % 500 == 0)
- {
- makeGuy(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xffffa257, 0xffff3b3b, false);
- }
- if (FlxG.keys.justPressed("Q"))
- {
- FlxG.mode = 1;
- }
- if (FlxG.keys.justPressed("W"))
- {
- FlxG.mode = 2;
- }
- if (FlxG.keys.justPressed("E"))
- {
- FlxG.mode = 3;
- }
- if (FlxG.keys.justPressed("A"))
- {
- player.pickup_ammo();
- /*
- var olden_bullet:Bullet = new Bullet(Math.random()*400,Math.random()*400);
- olden_bullet.life_timer = 10;
- olden_bullet.velocity.x = (Math.random()-.5)*2000;
- olden_bullet.velocity.y = (Math.random() - .5) * 2000;
- olden_bullet.color = 0xff0000;
- group_bullets.add(olden_bullet);
- makeBullet(gate_W.x - 8, y_spawn, Math.random() * 200 + 100, gate_W.velocity.y + (gate_W.velocity.y * (Math.random() - .5)), 0xff0000);
- */
- }
- if (FlxG.keys.justPressed("S") || player.hits == 0)
- {
- player.score_points(player.score * -1);
- player.spawn(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xff35d2dc, 0xff279ea5, false);
- player.slowmo = player.max_slowmo;
- sidebar_L.fill_bar();
- gate_W.opening_width = 30;
- gate_W.y = 160;
- gate_W.acceleration.y = 0;
- gate_W.acceleration.x = 0;
- gate_W.velocity.y = 0;
- gate_W.velocity.x = 0;
- gate_N.opening_width = 30;
- gate_N.x = 160;
- gate_N.acceleration.y = 0;
- gate_N.acceleration.x = 0;
- gate_N.velocity.y = 0;
- gate_N.velocity.x = 0;
- }
- if (FlxG.keys.justPressed("D"))
- { /*
- var golden_bullet:Bullet = new Bullet(player.x, player.y);
- golden_bullet.life_timer = 10;
- golden_bullet.velocity.x = (Math.random()-.5)*2000;
- golden_bullet.velocity.y = (Math.random()-.5)*2000;
- group_bullets.add(golden_bullet);
- */
- //makeBullet(player.x, player.y, Math.random() * 200 + 100, gate_W.velocity.y + (gate_W.velocity.y * (Math.random() - .5)), 0xff0000);
- //player.die();
- }
- if (FlxG.keys.justPressed("Z"))
- {
- makeGuy(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xffffa257, 0xffff3b3b, true); //
- //FlxKongregate.submitStats("ShotsFired", player.shots_fired);
- //FlxG.kong.API.stats.submit("ShotsFired",player.shots_fired);
- }
- if (FlxG.keys.justPressed("F"))
- {
- makeGuy(64 + (Math.random() * 244), 64 + (Math.random() * 244), 0xffffa257, 0xffff3b3b, false); //
- //FlxKongregate.submitStats("ShotsFired", player.shots_fired);
- //FlxG.kong.API.stats.submit("ShotsFired",player.shots_fired);
- }
- if (FlxG.keys.justPressed("G"))
- {
- makeGuy(332, 190, 0xffffa257, 0xffff3b3b, false); //
- //FlxKongregate.submitStats("ShotsFired", player.shots_fired);
- //FlxG.kong.API.stats.submit("ShotsFired",player.shots_fired);
- }
- if (FlxG.keys.P)
- {
- //move gate
- gate_N.x += 1;
- //trace(timer);
- }
- if (FlxG.keys.O)
- {
- //move gate
- gate_N.x -= 1;
- }
- if (FlxG.keys.LBRACKET)
- {
- //move gate
- gate_N.opening_width -= 1;
- }
- if (FlxG.keys.RBRACKET)
- {
- //move gate
- gate_N.opening_width += 1;
- }
- if (FlxG.keys.NUMPADEIGHT)
- {
- //move gate
- gate_E.y -= 1;
- }
- if (FlxG.keys.NUMPADTWO)
- {
- //move gate
- gate_E.y += 1;
- }
- if (FlxG.keys.NUMPADNINE)
- {
- //move gate
- gate_E.opening_width += 1;
- }
- if (FlxG.keys.NUMPADTHREE)
- {
- //move gate
- gate_E.opening_width -= 1;
- }
- if (FlxG.keys.NUMPADFOUR)
- {
- //move gate
- gate_S.x -= 1;
- }
- if (FlxG.keys.NUMPADSIX)
- {
- //move gate
- gate_S.x += 1;
- }
- if (FlxG.keys.NUMPADONE)
- {
- //shrink
- gate_S.opening_width -= 1;
- }
- if (FlxG.keys.NUMPADTHREE)
- {
- //widen
- gate_S.opening_width += 1;
- }
- if (FlxG.keys.justPressed("G"))
- {
- var gate_goal:Gate;
- var randgate:Number = Math.random();
- if (randgate > 0.666)
- {
- gate_goal = gate_N;
- }
- else if (randgate > 0.333)
- {
- gate_goal = gate_E;
- }
- else
- {
- gate_goal = gate_S;
- }
- for (var g:int = 0; g < gate_goal.num_walls; g++)
- {
- gate_N.group_gate.members[g].color = 0xffffff;
- gate_E.group_gate.members[g].color = 0xffffff;
- gate_S.group_gate.members[g].color = 0xffffff;
- gate_goal.group_gate.members[g].color = 0x05df05;
- }
- if (hellgate)
- {
- hellgate = false;
- }
- else
- {
- hellgate = true;
- }
- }
- if (FlxG.timeScale != 1)
- {
- slowmoverlay.alpha = 0.3;
- }
- else
- {
- slowmoverlay.alpha = 0;
- }
- }
- private function apiHasLoaded():void
- {
- FlxKongregate.connect();
- }
- public function start_game():void
- {
- //FlxG.state = new GameState();
- FlxG.switchState(new GameState());
- }
- }
- }
Add Comment
Please, Sign In to add comment