diff --git a/assets/images/.num0.png-autosave.kra b/assets/images/.num0.png-autosave.kra index 938317a30..604d0ad82 100644 Binary files a/assets/images/.num0.png-autosave.kra and b/assets/images/.num0.png-autosave.kra differ diff --git a/assets/images/healthHeads.png b/assets/images/healthHeads.png new file mode 100644 index 000000000..1df9f30af Binary files /dev/null and b/assets/images/healthHeads.png differ diff --git a/assets/images/healthHeads.xml b/assets/images/healthHeads.xml new file mode 100644 index 000000000..70a598679 --- /dev/null +++ b/assets/images/healthHeads.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/sounds/intro1.mp3 b/assets/sounds/intro1.mp3 new file mode 100644 index 000000000..93e77a68a Binary files /dev/null and b/assets/sounds/intro1.mp3 differ diff --git a/assets/sounds/intro2.mp3 b/assets/sounds/intro2.mp3 new file mode 100644 index 000000000..7b956c7fb Binary files /dev/null and b/assets/sounds/intro2.mp3 differ diff --git a/assets/sounds/intro3.mp3 b/assets/sounds/intro3.mp3 new file mode 100644 index 000000000..51d656d1b Binary files /dev/null and b/assets/sounds/intro3.mp3 differ diff --git a/assets/sounds/introGo.mp3 b/assets/sounds/introGo.mp3 new file mode 100644 index 000000000..fcb349e48 Binary files /dev/null and b/assets/sounds/introGo.mp3 differ diff --git a/source/Main.hx b/source/Main.hx index 13376db44..a4040a187 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -9,7 +9,7 @@ class Main extends Sprite public function new() { super(); - addChild(new FlxGame(0, 0, TitleState)); + addChild(new FlxGame(0, 0, PlayState)); #if !mobile addChild(new FPS(10, 3, 0xFFFFFF)); diff --git a/source/PlayState.hx b/source/PlayState.hx index ad46220e6..a09d82ac8 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -14,6 +14,7 @@ import flixel.system.FlxSound; import flixel.text.FlxText; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; +import flixel.ui.FlxBar; import flixel.util.FlxCollision; import flixel.util.FlxColor; import flixel.util.FlxSort; @@ -57,9 +58,14 @@ class PlayState extends FlxTransitionableState private var health:Float = 1; private var combo:Int = 0; + private var healthBarBG:FlxSprite; + private var healthBar:FlxBar; + private var generatedMusic:Bool = false; private var countingDown:Bool = false; + private var healthHeads:FlxSprite; + override public function create() { persistentUpdate = true; @@ -97,14 +103,14 @@ class PlayState extends FlxTransitionableState generateSong('fresh'); countingDown = true; - Conductor.songPosition -= Conductor.crochet * 4; + Conductor.songPosition -= Conductor.crochet * 5; new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer) { switch (swagCounter) { case 0: - FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6); + FlxG.sound.play('assets/sounds/intro3.mp3', 0.6); case 1: var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/ready.png'); ready.scrollFactor.set(); @@ -117,7 +123,7 @@ class PlayState extends FlxTransitionableState ready.destroy(); } }); - FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6); + FlxG.sound.play('assets/sounds/intro2.mp3', 0.6); case 2: var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/set.png'); set.scrollFactor.set(); @@ -130,7 +136,7 @@ class PlayState extends FlxTransitionableState set.destroy(); } }); - FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6); + FlxG.sound.play('assets/sounds/intro1.mp3', 0.6); case 3: var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/go.png'); go.scrollFactor.set(); @@ -143,7 +149,7 @@ class PlayState extends FlxTransitionableState go.destroy(); } }); - FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6); + FlxG.sound.play('assets/sounds/introGo.mp3', 0.6); case 4: } @@ -165,6 +171,27 @@ class PlayState extends FlxTransitionableState FlxG.fixedTimestep = false; + healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(AssetPaths.healthBar__png); + healthBarBG.screenCenter(X); + healthBarBG.scrollFactor.set(); + add(healthBarBG); + + healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this, + 'health', 0, 2); + healthBar.scrollFactor.set(); + healthBar.createFilledBar(0xFFFF0000, 0xFF66FF33); + // healthBar + add(healthBar); + + healthHeads = new FlxSprite(); + var headTex = FlxAtlasFrames.fromSparrow(AssetPaths.healthHeads__png, AssetPaths.healthHeads__xml); + healthHeads.frames = headTex; + healthHeads.animation.add('healthy', [0]); + healthHeads.animation.add('unhealthy', [1]); + healthHeads.y = healthBar.y - (healthHeads.height / 2); + healthHeads.scrollFactor.set(); + add(healthHeads); + super.create(); } @@ -346,6 +373,9 @@ class PlayState extends FlxTransitionableState { super.update(elapsed); + healthHeads.setGraphicSize(Std.int(FlxMath.lerp(healthHeads.width, 80, 0.02))); + healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2); + if (FlxG.keys.justPressed.NINE) FlxG.switchState(new Charting()); if (FlxG.keys.justPressed.EIGHT) @@ -541,7 +571,7 @@ class PlayState extends FlxTransitionableState { var numScore:FlxSprite = new FlxSprite().loadGraphic('assets/images/num' + Std.int(i) + '.png'); numScore.screenCenter(); - numScore.x = coolText.x + (37 * daLoop) - 90; + numScore.x = coolText.x + (43 * daLoop) - 90; numScore.y += 80; numScore.antialiasing = true; numScore.setGraphicSize(Std.int(numScore.width * 0.5)); @@ -822,6 +852,7 @@ class PlayState extends FlxTransitionableState totalBeats += 1; dad.playAnim('idle'); + healthHeads.setGraphicSize(Std.int(healthHeads.width + 20)); if (totalBeats % gfSpeed == 0) gf.dance();