intro!
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1284
|
||||
1287
|
||||
@@ -34,7 +34,8 @@ class AnimationDebug extends FlxState
|
||||
|
||||
override function create()
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
var gridBG:FlxSprite = FlxGridOverlay.create(10, 10);
|
||||
gridBG.scrollFactor.set(0.5, 0.5);
|
||||
|
||||
@@ -433,6 +433,8 @@ class PlayState extends MusicBeatState
|
||||
public var startTimer:FlxTimer;
|
||||
public var perfectMode:Bool = false;
|
||||
public var introLength:Int = 5;
|
||||
public var introSprites:Array<String> = [null, 'game/ready', "game/set", "game/go"];
|
||||
public var introSounds:Array<String> = ['intro3', 'intro2', "intro1", "introGo"];
|
||||
|
||||
public function startCountdown():Void
|
||||
{
|
||||
@@ -449,8 +451,6 @@ class PlayState extends MusicBeatState
|
||||
|
||||
var swagCounter:Int = 0;
|
||||
|
||||
var introSprites:Array<String> = [null, 'game/ready', "game/set", "game/go"];
|
||||
var introSounds:Array<String> = ['intro3', 'intro2', "intro1", "introGo"];
|
||||
|
||||
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
||||
{
|
||||
@@ -458,51 +458,59 @@ class PlayState extends MusicBeatState
|
||||
gf.dance();
|
||||
boyfriend.dance();
|
||||
|
||||
var event:CountdownEvent = scripts.event("onCountdown", new CountdownEvent(
|
||||
swagCounter,
|
||||
introSprites[swagCounter],
|
||||
introSounds[swagCounter],
|
||||
1, 0.6, true));
|
||||
countdown(swagCounter);
|
||||
|
||||
var sprite:FlxSprite = null;
|
||||
var sound:FlxSound = null;
|
||||
var tween:FlxTween = null;
|
||||
|
||||
if (!event.cancelled) {
|
||||
if (event.spritePath != null) {
|
||||
var spr = event.spritePath;
|
||||
if (!Assets.exists(spr)) spr = Paths.image('$spr');
|
||||
|
||||
sprite = new FlxSprite().loadGraphic(spr);
|
||||
sprite.scrollFactor.set();
|
||||
sprite.scale.set(event.scale, event.scale);
|
||||
sprite.updateHitbox();
|
||||
sprite.screenCenter();
|
||||
add(sprite);
|
||||
tween = FlxTween.tween(sprite, {y: sprite.y + 100, alpha: 0}, Conductor.crochet / 1000, {
|
||||
ease: FlxEase.cubeInOut,
|
||||
onComplete: function(twn:FlxTween)
|
||||
{
|
||||
sprite.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (event.soundPath != null) {
|
||||
var sfx = event.soundPath;
|
||||
if (!Assets.exists(sfx)) sfx = Paths.sound(sfx);
|
||||
sound = FlxG.sound.play(sfx, event.volume);
|
||||
}
|
||||
}
|
||||
event.sprite = sprite;
|
||||
event.sound = sound;
|
||||
event.spriteTween = tween;
|
||||
event.cancelled = false;
|
||||
|
||||
scripts.event("onCountdownPost", event);
|
||||
swagCounter += 1;
|
||||
}, introLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fake countdown.
|
||||
*/
|
||||
public function countdown(swagCounter:Int) {
|
||||
var event:CountdownEvent = scripts.event("onCountdown", new CountdownEvent(
|
||||
swagCounter,
|
||||
introSprites[swagCounter],
|
||||
introSounds[swagCounter],
|
||||
1, 0.6, true));
|
||||
|
||||
var sprite:FlxSprite = null;
|
||||
var sound:FlxSound = null;
|
||||
var tween:FlxTween = null;
|
||||
|
||||
if (!event.cancelled) {
|
||||
if (event.spritePath != null) {
|
||||
var spr = event.spritePath;
|
||||
if (!Assets.exists(spr)) spr = Paths.image('$spr');
|
||||
|
||||
sprite = new FlxSprite().loadGraphic(spr);
|
||||
sprite.scrollFactor.set();
|
||||
sprite.scale.set(event.scale, event.scale);
|
||||
sprite.updateHitbox();
|
||||
sprite.screenCenter();
|
||||
add(sprite);
|
||||
tween = FlxTween.tween(sprite, {y: sprite.y + 100, alpha: 0}, Conductor.crochet / 1000, {
|
||||
ease: FlxEase.cubeInOut,
|
||||
onComplete: function(twn:FlxTween)
|
||||
{
|
||||
sprite.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (event.soundPath != null) {
|
||||
var sfx = event.soundPath;
|
||||
if (!Assets.exists(sfx)) sfx = Paths.sound(sfx);
|
||||
sound = FlxG.sound.play(sfx, event.volume);
|
||||
}
|
||||
}
|
||||
event.sprite = sprite;
|
||||
event.sound = sound;
|
||||
event.spriteTween = tween;
|
||||
event.cancelled = false;
|
||||
|
||||
scripts.event("onCountdownPost", event);
|
||||
}
|
||||
|
||||
public var previousFrameTime:Int = 0;
|
||||
public var lastReportedPlayheadPosition:Int = 0;
|
||||
public var songTime:Float = 0;
|
||||
|
||||
@@ -86,7 +86,6 @@ class GlobalScript {
|
||||
script.call(name, args);
|
||||
}
|
||||
public static function onModSwitch(newMod:String) {
|
||||
trace(newMod);
|
||||
if (script != null) {
|
||||
script.destroy();
|
||||
script = null;
|
||||
|
||||
Reference in New Issue
Block a user