Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com
- {
- import org.flixel.*;
- import org.flixel.plugin.photonstorm.*;
- //Kuroki
- public class RandomPainting extends FlxExtendedSprite
- {
- [Embed(source = '../pics/apartmentA1.png')] public static var ap1:Class;
- [Embed(source = '../pics/apartmentA2.png')] public static var ap2:Class;
- [Embed(source = '../pics/apartmentA3.png')] public static var ap3:Class;
- [Embed(source = '../pics/apartmentA4.png')] public static var ap4:Class;
- [Embed(source = '../pics/apartmentA5.png')] public static var ap5:Class;
- [Embed(source = '../pics/apartmentA6.png')] public static var ap6:Class;
- [Embed(source = '../pics/houseA1.png')] public static var hse1:Class;
- [Embed(source = '../pics/houseA2.png')] public static var hse2:Class;
- [Embed(source = '../pics/houseA3.png')] public static var hse3:Class;
- [Embed(source = '../pics/houseA4.png')] public static var hse4:Class;
- [Embed(source = '../pics/houseA5.png')] public static var hse5:Class;
- [Embed(source = '../pics/houseA6.png')] public static var hse6:Class;
- [Embed(source = '../pics/towerA1.png')] public static var tow1:Class;
- [Embed(source = '../pics/towerA2.png')] public static var tow2:Class;
- [Embed(source = '../pics/towerA3.png')] public static var tow3:Class;
- [Embed(source = '../pics/towerA4.png')] public static var tow4:Class;
- [Embed(source = '../pics/towerA5.png')] public static var tow5:Class;
- [Embed(source = '../pics/towerA6.png')] public static var tow6:Class;
- //Formatting
- public var PlAYERSON:Boolean;
- public var PlAYERSOFF:Boolean;
- public var IsAbused:Boolean;
- protected var _bits:FlxEmitter;
- public var distributionp:int = 0;
- public var DISH:int;
- //Movement
- private var vx:Number = 0;
- private var maxspeedG:Number = 9;
- private var maxspeed:Number = 6;
- private var friction:Number = .92;
- public function RandomPainting(X:int, Y:int,Bits:FlxEmitter):void
- {
- super(X, Y);
- distributionp = Math.random() * 19;
- //distributionp = Math.random() * 0;
- y = 280;
- health = 90;
- this.immovable = true;
- FlxG.log("Painting - "+distributionp);
- //addAnimation("stopped", [0], 46);
- _bits = Bits;
- }
- override public function update():void
- {
- //Animation Still
- //play("stopped");
- //Moving to the left
- x -= vx;
- if (vx > maxspeed)
- vx = maxspeed;
- else if (vx < -maxspeed)
- vx = -maxspeed;
- vx += .18;
- vx *= friction;
- //Give end piece a fair chance
- if (distributionp == 0)
- {
- distributionp += 1;
- }
- //Apartments
- if (distributionp == 1)
- {
- loadGraphic(ap1, false, false, 64, 32);
- DISH = 32;
- }
- if (distributionp == 2)
- {
- loadGraphic(ap2, false, false, 96, 48);
- DISH = 48;
- }
- if (distributionp == 3)
- {
- loadGraphic(ap3, false, false, 128, 64);
- DISH = 64;
- }
- if (distributionp == 4)
- {
- loadGraphic(ap4, false, false, 64, 32);
- DISH = 32;
- }
- if (distributionp == 5)
- {
- loadGraphic(ap5, false, false, 96, 48);
- DISH = 48;
- }
- if (distributionp == 6)
- {
- loadGraphic(ap6, false, false, 96, 64);
- DISH = 64;
- }
- //Houses
- if (distributionp == 7)
- {
- loadGraphic(hse1, false, false, 40, 56);
- DISH = 56;
- }
- if (distributionp == 8)
- {
- loadGraphic(hse2, false, false, 40, 56);
- DISH = 56;
- }
- if (distributionp == 9)
- {
- loadGraphic(hse3, false, false, 40, 96);
- DISH = 96;
- }
- if (distributionp == 10)
- {
- loadGraphic(hse4, false, false, 40, 96);
- DISH = 96;
- }
- if (distributionp == 11)
- {
- loadGraphic(hse5, false, false, 40, 144);
- DISH = 144;
- }
- if (distributionp == 12)
- {
- loadGraphic(hse6, false, false, 40, 144);
- DISH = 144;
- }
- //Towers
- if (distributionp == 13)
- {
- loadGraphic(tow1, false, false, 32, 56);
- DISH = 56;
- }
- if (distributionp == 14)
- {
- loadGraphic(tow2, false, false, 32, 56);
- DISH = 56;
- }
- if (distributionp == 15)
- {
- loadGraphic(tow3, false, false, 32, 96);
- DISH = 96;
- }
- if (distributionp == 16)
- {
- loadGraphic(tow4, false, false, 32, 96);
- DISH = 96;
- }
- if (distributionp == 17)
- {
- loadGraphic(tow5, false, false, 32, 144);
- DISH = 144;
- }
- if (distributionp == 18)
- {
- loadGraphic(tow6, false, false, 32, 144);
- DISH = 144;
- }
- //Give end piece a fair chance
- if (distributionp == 19)
- {
- distributionp - 1;
- }
- super.update();
- //trace("Hi"+height);
- y = 280-DISH-16;
- }
- override public function destroy():void
- {
- super.destroy();
- _bits = null;
- }
- override public function kill():void
- {
- if(!alive)
- return;
- super.kill();
- visible = false;
- //velocity.make();
- //acceleration.make();
- if(_bits != null)
- {
- _bits.at(this);
- _bits.start(true,5,0,50);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment