mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-19 23:15:15 +00:00
RELEAAASE
This commit is contained in:
parent
0d6ef4b20f
commit
4eab1c34ed
51
source/GameOverState.hx
Normal file
51
source/GameOverState.hx
Normal file
|
@ -0,0 +1,51 @@
|
|||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
||||
class GameOverState extends FlxTransitionableState
|
||||
{
|
||||
override function create()
|
||||
{
|
||||
var loser:FlxSprite = new FlxSprite(100, 100);
|
||||
var loseTex = FlxAtlasFrames.fromSparrow(AssetPaths.lose__png, AssetPaths.lose__xml);
|
||||
loser.frames = loseTex;
|
||||
loser.animation.addByPrefix('lose', 'lose', 24, false);
|
||||
loser.animation.play('lose');
|
||||
add(loser);
|
||||
|
||||
var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(AssetPaths.restart__png);
|
||||
restart.setGraphicSize(Std.int(restart.width * 0.6));
|
||||
restart.updateHitbox();
|
||||
restart.alpha = 0;
|
||||
restart.antialiasing = true;
|
||||
add(restart);
|
||||
|
||||
FlxG.sound.music.fadeOut(2, FlxG.sound.music.volume * 0.6);
|
||||
|
||||
FlxTween.tween(restart, {alpha: 1}, 1, {ease: FlxEase.quartInOut});
|
||||
FlxTween.tween(restart, {y: restart.y + 40}, 7, {ease: FlxEase.quartInOut, type: PINGPONG});
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
private var fading:Bool = false;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (FlxG.keys.justPressed.ANY && !fading)
|
||||
{
|
||||
fading = true;
|
||||
FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
FlxG.switchState(new PlayState());
|
||||
});
|
||||
}
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ class Main extends Sprite
|
|||
public function new()
|
||||
{
|
||||
super();
|
||||
addChild(new FlxGame(0, 0, PlayState));
|
||||
addChild(new FlxGame(0, 0, TitleState));
|
||||
|
||||
#if !mobile
|
||||
addChild(new FPS(10, 3, 0xFFFFFF));
|
||||
|
|
|
@ -27,6 +27,8 @@ using StringTools;
|
|||
|
||||
class PlayState extends FlxTransitionableState
|
||||
{
|
||||
public static var curLevel:String = 'Bopeebo';
|
||||
|
||||
private var lastBeat:Float = 0;
|
||||
private var lastStep:Float = 0;
|
||||
private var vocals:FlxSound;
|
||||
|
@ -117,8 +119,9 @@ class PlayState extends FlxTransitionableState
|
|||
|
||||
var swagCounter:Int = 0;
|
||||
|
||||
generateSong('fresh');
|
||||
generateSong(curLevel.toLowerCase());
|
||||
countingDown = true;
|
||||
Conductor.songPosition = 0;
|
||||
Conductor.songPosition -= Conductor.crochet * 5;
|
||||
|
||||
new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
||||
|
@ -214,7 +217,7 @@ class PlayState extends FlxTransitionableState
|
|||
function startSong():Void
|
||||
{
|
||||
countingDown = false;
|
||||
FlxG.sound.playMusic("assets/music/" + "Fresh" + "_Inst.mp3");
|
||||
FlxG.sound.playMusic("assets/music/" + curLevel + "_Inst.mp3");
|
||||
vocals.play();
|
||||
}
|
||||
|
||||
|
@ -392,10 +395,16 @@ class PlayState extends FlxTransitionableState
|
|||
healthHeads.setGraphicSize(Std.int(FlxMath.lerp(100, healthHeads.width, 0.98)));
|
||||
healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2);
|
||||
|
||||
if (healthBar.percent < 10)
|
||||
healthHeads.animation.play('unhealthy');
|
||||
else
|
||||
healthHeads.animation.play('healthy');
|
||||
/*
|
||||
if (FlxG.keys.justPressed.NINE)
|
||||
FlxG.switchState(new Charting());
|
||||
if (FlxG.keys.justPressed.EIGHT)
|
||||
FlxG.switchState(new Charting(true));
|
||||
*/
|
||||
|
||||
if (countingDown)
|
||||
{
|
||||
|
@ -451,12 +460,33 @@ class PlayState extends FlxTransitionableState
|
|||
gfSpeed = 2;
|
||||
case 112:
|
||||
gfSpeed = 1;
|
||||
case 163:
|
||||
FlxG.sound.music.stop();
|
||||
curLevel = 'Bopeebo';
|
||||
FlxG.switchState(new TitleState());
|
||||
}
|
||||
}
|
||||
|
||||
if (curSong == 'Bopeebo')
|
||||
{
|
||||
switch (totalBeats)
|
||||
{
|
||||
case 127:
|
||||
FlxG.sound.music.stop();
|
||||
curLevel = 'Fresh';
|
||||
FlxG.switchState(new PlayState());
|
||||
}
|
||||
}
|
||||
everyBeat();
|
||||
everyStep();
|
||||
// better streaming of shit
|
||||
|
||||
if (health <= 0)
|
||||
{
|
||||
boyfriend.stunned = true;
|
||||
FlxG.switchState(new GameOverState());
|
||||
}
|
||||
|
||||
if (unspawnNotes[0] != null)
|
||||
{
|
||||
FlxG.watch.addQuick('spsa', unspawnNotes[0].strumTime);
|
||||
|
@ -511,7 +541,10 @@ class PlayState extends FlxTransitionableState
|
|||
if (daNote.y < -daNote.height)
|
||||
{
|
||||
if (daNote.tooLate)
|
||||
{
|
||||
health -= 0.05;
|
||||
vocals.volume = 0;
|
||||
}
|
||||
|
||||
daNote.active = false;
|
||||
daNote.visible = false;
|
||||
|
@ -687,6 +720,8 @@ class PlayState extends FlxTransitionableState
|
|||
if (daNote.wasGoodHit)
|
||||
{
|
||||
daNote.kill();
|
||||
notes.remove(daNote, true);
|
||||
daNote.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -763,7 +798,7 @@ class PlayState extends FlxTransitionableState
|
|||
{
|
||||
if (!boyfriend.stunned)
|
||||
{
|
||||
health -= 0.075;
|
||||
health -= 0.08;
|
||||
if (combo > 5)
|
||||
{
|
||||
gf.playAnim('sad');
|
||||
|
@ -827,6 +862,11 @@ class PlayState extends FlxTransitionableState
|
|||
{
|
||||
combo += 1;
|
||||
|
||||
if (note.noteData > 0)
|
||||
health += 0.03;
|
||||
else
|
||||
health += 0.007;
|
||||
|
||||
switch (Math.abs(note.noteData))
|
||||
{
|
||||
case 1:
|
||||
|
@ -850,6 +890,10 @@ class PlayState extends FlxTransitionableState
|
|||
sectionScores[1][curSection] += note.noteScore;
|
||||
note.wasGoodHit = true;
|
||||
vocals.volume = 1;
|
||||
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,10 @@ class TitleState extends FlxTransitionableState
|
|||
|
||||
persistentUpdate = true;
|
||||
|
||||
var bg:FlxSprite = FlxGridOverlay.create(20, 20);
|
||||
var bg:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.stageback__png);
|
||||
bg.antialiasing = true;
|
||||
bg.setGraphicSize(Std.int(bg.width * 0.6));
|
||||
bg.updateHitbox();
|
||||
add(bg);
|
||||
|
||||
var logoBl:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
|
||||
|
@ -55,6 +58,7 @@ class TitleState extends FlxTransitionableState
|
|||
|
||||
var logo:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
|
||||
logo.screenCenter();
|
||||
logo.antialiasing = true;
|
||||
add(logo);
|
||||
|
||||
FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
|
||||
|
|
Loading…
Reference in a new issue