mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-05 03:00:27 +00:00
HEALTH IN PROGRESS
This commit is contained in:
parent
4ab27ca8a6
commit
b40f7c94b8
Binary file not shown.
BIN
assets/images/healthHeads.png
Normal file
BIN
assets/images/healthHeads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
7
assets/images/healthHeads.xml
Normal file
7
assets/images/healthHeads.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextureAtlas imagePath="healthHeads.png">
|
||||||
|
<!-- Created with Adobe Animate version 20.0.0.17400 -->
|
||||||
|
<!-- http://www.adobe.com/products/animate.html -->
|
||||||
|
<SubTexture name="Boys instance 10000" x="0" y="126" width="180" height="118" frameX="0" frameY="0" frameWidth="190" frameHeight="121"/>
|
||||||
|
<SubTexture name="Boys instance 10001" x="0" y="0" width="190" height="121"/>
|
||||||
|
</TextureAtlas>
|
BIN
assets/sounds/intro1.mp3
Normal file
BIN
assets/sounds/intro1.mp3
Normal file
Binary file not shown.
BIN
assets/sounds/intro2.mp3
Normal file
BIN
assets/sounds/intro2.mp3
Normal file
Binary file not shown.
BIN
assets/sounds/intro3.mp3
Normal file
BIN
assets/sounds/intro3.mp3
Normal file
Binary file not shown.
BIN
assets/sounds/introGo.mp3
Normal file
BIN
assets/sounds/introGo.mp3
Normal file
Binary file not shown.
|
@ -9,7 +9,7 @@ class Main extends Sprite
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
addChild(new FlxGame(0, 0, TitleState));
|
addChild(new FlxGame(0, 0, PlayState));
|
||||||
|
|
||||||
#if !mobile
|
#if !mobile
|
||||||
addChild(new FPS(10, 3, 0xFFFFFF));
|
addChild(new FPS(10, 3, 0xFFFFFF));
|
||||||
|
|
|
@ -14,6 +14,7 @@ import flixel.system.FlxSound;
|
||||||
import flixel.text.FlxText;
|
import flixel.text.FlxText;
|
||||||
import flixel.tweens.FlxEase;
|
import flixel.tweens.FlxEase;
|
||||||
import flixel.tweens.FlxTween;
|
import flixel.tweens.FlxTween;
|
||||||
|
import flixel.ui.FlxBar;
|
||||||
import flixel.util.FlxCollision;
|
import flixel.util.FlxCollision;
|
||||||
import flixel.util.FlxColor;
|
import flixel.util.FlxColor;
|
||||||
import flixel.util.FlxSort;
|
import flixel.util.FlxSort;
|
||||||
|
@ -57,9 +58,14 @@ class PlayState extends FlxTransitionableState
|
||||||
private var health:Float = 1;
|
private var health:Float = 1;
|
||||||
private var combo:Int = 0;
|
private var combo:Int = 0;
|
||||||
|
|
||||||
|
private var healthBarBG:FlxSprite;
|
||||||
|
private var healthBar:FlxBar;
|
||||||
|
|
||||||
private var generatedMusic:Bool = false;
|
private var generatedMusic:Bool = false;
|
||||||
private var countingDown:Bool = false;
|
private var countingDown:Bool = false;
|
||||||
|
|
||||||
|
private var healthHeads:FlxSprite;
|
||||||
|
|
||||||
override public function create()
|
override public function create()
|
||||||
{
|
{
|
||||||
persistentUpdate = true;
|
persistentUpdate = true;
|
||||||
|
@ -97,14 +103,14 @@ class PlayState extends FlxTransitionableState
|
||||||
|
|
||||||
generateSong('fresh');
|
generateSong('fresh');
|
||||||
countingDown = true;
|
countingDown = true;
|
||||||
Conductor.songPosition -= Conductor.crochet * 4;
|
Conductor.songPosition -= Conductor.crochet * 5;
|
||||||
|
|
||||||
new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
|
||||||
{
|
{
|
||||||
switch (swagCounter)
|
switch (swagCounter)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
|
FlxG.sound.play('assets/sounds/intro3.mp3', 0.6);
|
||||||
case 1:
|
case 1:
|
||||||
var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/ready.png');
|
var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/ready.png');
|
||||||
ready.scrollFactor.set();
|
ready.scrollFactor.set();
|
||||||
|
@ -117,7 +123,7 @@ class PlayState extends FlxTransitionableState
|
||||||
ready.destroy();
|
ready.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
|
FlxG.sound.play('assets/sounds/intro2.mp3', 0.6);
|
||||||
case 2:
|
case 2:
|
||||||
var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/set.png');
|
var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/set.png');
|
||||||
set.scrollFactor.set();
|
set.scrollFactor.set();
|
||||||
|
@ -130,7 +136,7 @@ class PlayState extends FlxTransitionableState
|
||||||
set.destroy();
|
set.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
|
FlxG.sound.play('assets/sounds/intro1.mp3', 0.6);
|
||||||
case 3:
|
case 3:
|
||||||
var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/go.png');
|
var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/go.png');
|
||||||
go.scrollFactor.set();
|
go.scrollFactor.set();
|
||||||
|
@ -143,7 +149,7 @@ class PlayState extends FlxTransitionableState
|
||||||
go.destroy();
|
go.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
|
FlxG.sound.play('assets/sounds/introGo.mp3', 0.6);
|
||||||
case 4:
|
case 4:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +171,27 @@ class PlayState extends FlxTransitionableState
|
||||||
|
|
||||||
FlxG.fixedTimestep = false;
|
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();
|
super.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +373,9 @@ class PlayState extends FlxTransitionableState
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
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)
|
if (FlxG.keys.justPressed.NINE)
|
||||||
FlxG.switchState(new Charting());
|
FlxG.switchState(new Charting());
|
||||||
if (FlxG.keys.justPressed.EIGHT)
|
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');
|
var numScore:FlxSprite = new FlxSprite().loadGraphic('assets/images/num' + Std.int(i) + '.png');
|
||||||
numScore.screenCenter();
|
numScore.screenCenter();
|
||||||
numScore.x = coolText.x + (37 * daLoop) - 90;
|
numScore.x = coolText.x + (43 * daLoop) - 90;
|
||||||
numScore.y += 80;
|
numScore.y += 80;
|
||||||
numScore.antialiasing = true;
|
numScore.antialiasing = true;
|
||||||
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
||||||
|
@ -822,6 +852,7 @@ class PlayState extends FlxTransitionableState
|
||||||
totalBeats += 1;
|
totalBeats += 1;
|
||||||
|
|
||||||
dad.playAnim('idle');
|
dad.playAnim('idle');
|
||||||
|
healthHeads.setGraphicSize(Std.int(healthHeads.width + 20));
|
||||||
|
|
||||||
if (totalBeats % gfSpeed == 0)
|
if (totalBeats % gfSpeed == 0)
|
||||||
gf.dance();
|
gf.dance();
|
||||||
|
|
Loading…
Reference in a new issue