2020-11-05 05:08:40 -05:00
|
|
|
package ;
|
|
|
|
|
|
|
|
import flixel.system.FlxBasePreloader;
|
|
|
|
import openfl.display.Sprite;
|
|
|
|
import flash.display.Bitmap;
|
|
|
|
import flash.display.BitmapData;
|
|
|
|
import flash.display.BlendMode;
|
|
|
|
import flash.display.Sprite;
|
|
|
|
import flash.Lib;
|
|
|
|
import flixel.FlxG;
|
|
|
|
|
2020-11-07 17:18:13 -05:00
|
|
|
@:bitmap("art/preloaderArt.png") class LogoImage extends BitmapData { }
|
2020-11-05 05:08:40 -05:00
|
|
|
|
|
|
|
class Preloader extends FlxBasePreloader
|
|
|
|
{
|
2020-11-16 15:29:18 -05:00
|
|
|
public function new(MinDisplayTime:Float=3, ?AllowedURLs:Array<String>)
|
2020-11-05 05:08:40 -05:00
|
|
|
{
|
|
|
|
super(MinDisplayTime, AllowedURLs);
|
|
|
|
}
|
|
|
|
|
|
|
|
var logo:Sprite;
|
|
|
|
|
|
|
|
override function create():Void
|
|
|
|
{
|
|
|
|
this._width = Lib.current.stage.stageWidth;
|
|
|
|
this._height = Lib.current.stage.stageHeight;
|
|
|
|
|
2020-11-07 02:29:20 -05:00
|
|
|
var ratio:Float = this._width / 2560; //This allows us to scale assets depending on the size of the screen.
|
2020-11-05 05:08:40 -05:00
|
|
|
|
|
|
|
logo = new Sprite();
|
|
|
|
logo.addChild(new Bitmap(new LogoImage(0,0))); //Sets the graphic of the sprite to a Bitmap object, which uses our embedded BitmapData class.
|
|
|
|
logo.scaleX = logo.scaleY = ratio;
|
|
|
|
logo.x = ((this._width) / 2) - ((logo.width) / 2);
|
|
|
|
logo.y = (this._height / 2) - ((logo.height) / 2);
|
|
|
|
addChild(logo); //Adds the graphic to the NMEPreloader's buffer.
|
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
override function update(Percent:Float):Void
|
|
|
|
{
|
2020-11-07 15:52:21 -05:00
|
|
|
if(Percent < 69)
|
2020-11-05 05:08:40 -05:00
|
|
|
{
|
2020-11-10 15:07:34 -05:00
|
|
|
logo.scaleX += Percent / 1920;
|
|
|
|
logo.scaleY += Percent / 1920;
|
|
|
|
logo.x -= Percent * 0.6;
|
|
|
|
logo.y -= Percent / 2;
|
2020-11-07 02:29:20 -05:00
|
|
|
}else{
|
|
|
|
logo.scaleX = this._width / 1280;
|
|
|
|
logo.scaleY = this._width / 1280;
|
|
|
|
logo.x = ((this._width) / 2) - ((logo.width) / 2);
|
|
|
|
logo.y = (this._height / 2) - ((logo.height) / 2);
|
2020-11-05 05:08:40 -05:00
|
|
|
}
|
2020-11-07 02:29:20 -05:00
|
|
|
|
2020-11-05 05:08:40 -05:00
|
|
|
super.update(Percent);
|
|
|
|
}
|
|
|
|
}
|