mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 01:49:21 +00:00
train in progress
This commit is contained in:
parent
55a4de8112
commit
2cb855702b
|
@ -12,7 +12,7 @@ import lime.utils.Assets;
|
||||||
|
|
||||||
class FreeplayState extends MusicBeatState
|
class FreeplayState extends MusicBeatState
|
||||||
{
|
{
|
||||||
var songs:Array<String> = ["Pico", "Bopeebo", "Dadbattle", "Fresh", "Tutorial"];
|
var songs:Array<String> = ["Pico", "Blammed", "Bopeebo", "Dadbattle", "Fresh", "Tutorial"];
|
||||||
|
|
||||||
var selector:FlxText;
|
var selector:FlxText;
|
||||||
var curSelected:Int = 0;
|
var curSelected:Int = 0;
|
||||||
|
|
|
@ -35,6 +35,7 @@ using StringTools;
|
||||||
class PlayState extends MusicBeatState
|
class PlayState extends MusicBeatState
|
||||||
{
|
{
|
||||||
public static var curLevel:String = 'Tutorial';
|
public static var curLevel:String = 'Tutorial';
|
||||||
|
public static var curStage:String = '';
|
||||||
public static var SONG:SwagSong;
|
public static var SONG:SwagSong;
|
||||||
public static var isStoryMode:Bool = false;
|
public static var isStoryMode:Bool = false;
|
||||||
public static var storyWeek:Int = 0;
|
public static var storyWeek:Int = 0;
|
||||||
|
@ -81,6 +82,10 @@ class PlayState extends MusicBeatState
|
||||||
var halloweenBG:FlxSprite;
|
var halloweenBG:FlxSprite;
|
||||||
var isHalloween:Bool = false;
|
var isHalloween:Bool = false;
|
||||||
|
|
||||||
|
var phillyCityLights:FlxTypedGroup<FlxSprite>;
|
||||||
|
var phillyTrain:FlxSprite;
|
||||||
|
var trainSound:FlxSound;
|
||||||
|
|
||||||
var talking:Bool = true;
|
var talking:Bool = true;
|
||||||
var songScore:Int = 0;
|
var songScore:Int = 0;
|
||||||
var scoreTxt:FlxText;
|
var scoreTxt:FlxText;
|
||||||
|
@ -144,6 +149,47 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
isHalloween = true;
|
isHalloween = true;
|
||||||
}
|
}
|
||||||
|
else if (SONG.song.toLowerCase() == 'pico' || SONG.song.toLowerCase() == 'blammed')
|
||||||
|
{
|
||||||
|
curStage = 'philly';
|
||||||
|
|
||||||
|
var bg:FlxSprite = new FlxSprite(-100).loadGraphic(AssetPaths.sky__png);
|
||||||
|
bg.scrollFactor.set(0.1, 0.1);
|
||||||
|
add(bg);
|
||||||
|
|
||||||
|
var city:FlxSprite = new FlxSprite(-10).loadGraphic(AssetPaths.city__png);
|
||||||
|
city.scrollFactor.set(0.3, 0.3);
|
||||||
|
city.setGraphicSize(Std.int(city.width * 0.85));
|
||||||
|
city.updateHitbox();
|
||||||
|
add(city);
|
||||||
|
|
||||||
|
phillyCityLights = new FlxTypedGroup<FlxSprite>();
|
||||||
|
add(phillyCityLights);
|
||||||
|
|
||||||
|
for (i in 0...5)
|
||||||
|
{
|
||||||
|
var light:FlxSprite = new FlxSprite(city.x).loadGraphic('assets/images/philly/win' + i + '.png');
|
||||||
|
light.scrollFactor.set(0.3, 0.3);
|
||||||
|
light.visible = false;
|
||||||
|
light.setGraphicSize(Std.int(light.width * 0.85));
|
||||||
|
light.updateHitbox();
|
||||||
|
phillyCityLights.add(light);
|
||||||
|
}
|
||||||
|
|
||||||
|
var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(AssetPaths.behindTrain__png);
|
||||||
|
add(streetBehind);
|
||||||
|
|
||||||
|
phillyTrain = new FlxSprite(2000, 300).loadGraphic(AssetPaths.train__png);
|
||||||
|
add(phillyTrain);
|
||||||
|
|
||||||
|
trainSound = new FlxSound().loadEmbedded('assets/sounds/train_passes' + TitleState.soundExt);
|
||||||
|
FlxG.sound.list.add(trainSound);
|
||||||
|
|
||||||
|
// var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0__png);
|
||||||
|
|
||||||
|
var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(AssetPaths.street__png);
|
||||||
|
add(street);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
|
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
|
||||||
|
@ -200,6 +246,7 @@ class PlayState extends MusicBeatState
|
||||||
case 'dad':
|
case 'dad':
|
||||||
camPos.x += 400;
|
camPos.x += 400;
|
||||||
case 'pico':
|
case 'pico':
|
||||||
|
camPos.x += 600;
|
||||||
dad.y += 300;
|
dad.y += 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,6 +645,23 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
override public function update(elapsed:Float)
|
override public function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
|
switch (curStage)
|
||||||
|
{
|
||||||
|
case 'philly':
|
||||||
|
if (trainMoving)
|
||||||
|
{
|
||||||
|
trainFrameTiming += elapsed;
|
||||||
|
|
||||||
|
if (trainFrameTiming >= 1 / 24)
|
||||||
|
{
|
||||||
|
updateTrainPos();
|
||||||
|
trainFrameTiming = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
scoreTxt.text = "Score:" + songScore;
|
scoreTxt.text = "Score:" + songScore;
|
||||||
|
@ -1308,6 +1372,56 @@ class PlayState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var trainMoving:Bool = false;
|
||||||
|
var trainFrameTiming:Float = 0;
|
||||||
|
|
||||||
|
var trainCars:Int = 8;
|
||||||
|
var trainFinishing:Bool = false;
|
||||||
|
|
||||||
|
function trainStart():Void
|
||||||
|
{
|
||||||
|
trainMoving = true;
|
||||||
|
if (!trainSound.playing)
|
||||||
|
trainSound.play(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var startedMoving:Bool = false;
|
||||||
|
|
||||||
|
function updateTrainPos():Void
|
||||||
|
{
|
||||||
|
if (trainSound.time >= 4700)
|
||||||
|
{
|
||||||
|
startedMoving = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startedMoving)
|
||||||
|
{
|
||||||
|
phillyTrain.x -= 400;
|
||||||
|
|
||||||
|
if (phillyTrain.x < -2000 && !trainFinishing)
|
||||||
|
{
|
||||||
|
phillyTrain.x = -1150;
|
||||||
|
trainCars -= 1;
|
||||||
|
|
||||||
|
if (trainCars <= 0)
|
||||||
|
trainFinishing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phillyTrain.x < 0 && trainFinishing)
|
||||||
|
trainReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function trainReset():Void
|
||||||
|
{
|
||||||
|
phillyTrain.x = FlxG.width + 200;
|
||||||
|
trainMoving = false;
|
||||||
|
// trainSound.stop();
|
||||||
|
// trainSound.time = 0;
|
||||||
|
trainCars = 8;
|
||||||
|
startedMoving = false;
|
||||||
|
}
|
||||||
|
|
||||||
function lightningStrikeShit():Void
|
function lightningStrikeShit():Void
|
||||||
{
|
{
|
||||||
FlxG.sound.play('assets/sounds/thunder_' + FlxG.random.int(1, 2) + TitleState.soundExt);
|
FlxG.sound.play('assets/sounds/thunder_' + FlxG.random.int(1, 2) + TitleState.soundExt);
|
||||||
|
@ -1396,9 +1510,33 @@ class PlayState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (curStage)
|
||||||
|
{
|
||||||
|
case "philly":
|
||||||
|
if (totalBeats % 4 == 0)
|
||||||
|
{
|
||||||
|
phillyCityLights.forEach(function(light:FlxSprite)
|
||||||
|
{
|
||||||
|
light.visible = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
curLight = FlxG.random.int(0, phillyCityLights.length - 1);
|
||||||
|
|
||||||
|
phillyCityLights.members[curLight].visible = true;
|
||||||
|
phillyCityLights.members[curLight].alpha = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalBeats % 8 == 4 && FlxG.random.bool(40) && !trainMoving)
|
||||||
|
{
|
||||||
|
trainStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
|
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
|
||||||
{
|
{
|
||||||
lightningStrikeShit();
|
lightningStrikeShit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var curLight:Int = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class TitleState extends MusicBeatState
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SKIP_TO_PLAYSTATE
|
#if SKIP_TO_PLAYSTATE
|
||||||
FlxG.switchState(new ChartingState());
|
FlxG.switchState(new FreeplayState());
|
||||||
#else
|
#else
|
||||||
startIntro();
|
startIntro();
|
||||||
#end
|
#end
|
||||||
|
|
Loading…
Reference in a new issue