bunch of polish bullshit

This commit is contained in:
Cameron Taylor 2020-10-05 11:24:51 -07:00
parent a380fa16e5
commit 9dfe5cfe42
23 changed files with 190 additions and 53 deletions

View File

@ -41,7 +41,7 @@
<haxelib name="flixel-addons" />
<!--In case you want to use the ui package-->
<!--<haxelib name="flixel-ui" />-->
<!-- <haxelib name="flixel-ui" /> -->
<!--In case you want to use nape with flixel-->
<!--<haxelib name="nape-haxe4" />-->

BIN
assets/images/GO0001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/images/GO0002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/images/GO0003.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/images/GO0004.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0005.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0006.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0007.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0008.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0009.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0010.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0011.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/images/GO0012.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/images/GO0013.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
assets/images/GO0014.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/images/ready.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
assets/images/set.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/music/title.mp3 Normal file

Binary file not shown.

BIN
assets/music/titleShoot.mp3 Normal file

Binary file not shown.

Binary file not shown.

View File

@ -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));

View File

@ -5,12 +5,14 @@ import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxCollision;
import flixel.util.FlxColor;
@ -22,7 +24,7 @@ import lime.utils.Assets;
using StringTools;
class PlayState extends FlxState
class PlayState extends FlxTransitionableState
{
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
@ -55,8 +57,14 @@ class PlayState extends FlxState
private var health:Float = 1;
private var combo:Int = 0;
private var generatedMusic:Bool = false;
private var countingDown:Bool = false;
override public function create()
{
persistentUpdate = true;
persistentDraw = true;
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.bg__png);
bg.setGraphicSize(Std.int(bg.width * 2.5));
bg.updateHitbox();
@ -85,11 +93,35 @@ class PlayState extends FlxState
playerStrums = new FlxTypedGroup<FlxSprite>();
var swagCounter:Int = 0;
generateSong('fresh');
countingDown = true;
Conductor.songPosition -= Conductor.crochet * 4;
new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{
switch (swagCounter)
{
case 0:
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
case 1:
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
case 2:
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
case 3:
FlxG.sound.play('assets/sounds/freshIntro.mp3', 0.6);
case 4:
}
swagCounter += 1;
// generateSong('fresh');
}, 5);
// add(strumLine);
camFollow = new FlxObject(0, 0, 1, 1);
camFollow.setPosition(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y);
add(camFollow);
FlxG.camera.follow(camFollow, LOCKON, 0.04);
@ -103,24 +135,30 @@ class PlayState extends FlxState
super.create();
}
function startSong():Void
{
countingDown = false;
FlxG.sound.playMusic("assets/music/" + "Fresh" + "_Inst.mp3");
vocals.play();
}
var debugNum:Int = 0;
private function generateSong(dataPath:String):Void
{
// FlxG.log.add(ChartParser.parse());
generatedMusic = true;
generateStaticArrows(0);
generateStaticArrows(1);
var songData = Json.parse(Assets.getText('assets/data/' + dataPath + '/' + dataPath + '.json'));
Conductor.changeBPM(songData.bpm);
FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3");
curSong = songData.song;
vocals = new FlxSound().loadEmbedded("assets/music/" + songData.song + "_Voices.mp3");
vocals = new FlxSound().loadEmbedded("assets/music/" + curSong + "_Voices.mp3");
FlxG.sound.list.add(vocals);
vocals.play();
notes = new FlxTypedGroup<Note>();
add(notes);
@ -226,6 +264,10 @@ class PlayState extends FlxState
babyArrow.updateHitbox();
babyArrow.antialiasing = true;
babyArrow.y -= 10;
babyArrow.alpha = 0;
FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)});
babyArrow.ID = i + 1;
if (player == 1)
@ -276,7 +318,15 @@ class PlayState extends FlxState
if (FlxG.keys.justPressed.EIGHT)
FlxG.switchState(new Charting(true));
Conductor.songPosition = FlxG.sound.music.time;
if (countingDown)
{
Conductor.songPosition += FlxG.elapsed * 1000;
if (Conductor.songPosition >= 0)
startSong();
}
else
Conductor.songPosition = FlxG.sound.music.time;
var playerTurn:Int = totalBeats % (sectionLengths[curSection] * 8);
if (playerTurn == (sectionLengths[curSection] * 8) - 1 && !sectionScored)
@ -285,7 +335,7 @@ class PlayState extends FlxState
sectionScored = true;
}
if (playerTurn == 0)
if (playerTurn == 0 && generatedMusic)
{
if (camFollow.x != dad.getGraphicMidpoint().x + 150)
camFollow.setPosition(dad.getGraphicMidpoint().x + 150, dad.getGraphicMidpoint().y - 100);
@ -343,59 +393,60 @@ class PlayState extends FlxState
}
}
notes.forEachAlive(function(daNote:Note)
if (generatedMusic)
{
if (daNote.y > FlxG.height)
notes.forEachAlive(function(daNote:Note)
{
daNote.active = false;
daNote.visible = false;
}
else
{
daNote.visible = true;
daNote.active = true;
}
if (!daNote.mustPress && daNote.wasGoodHit)
{
switch (Math.abs(daNote.noteData))
if (daNote.y > FlxG.height)
{
case 1:
dad.playAnim('singUP');
case 2:
dad.playAnim('singRIGHT');
case 3:
dad.playAnim('singDOWN');
case 4:
dad.playAnim('singLEFT');
daNote.active = false;
daNote.visible = false;
}
else
{
daNote.visible = true;
daNote.active = true;
}
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
if (!daNote.mustPress && daNote.wasGoodHit)
{
switch (Math.abs(daNote.noteData))
{
case 1:
dad.playAnim('singUP');
case 2:
dad.playAnim('singRIGHT');
case 3:
dad.playAnim('singDOWN');
case 4:
dad.playAnim('singLEFT');
}
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
if (daNote.y < -daNote.height)
{
if (daNote.tooLate)
vocals.volume = 0;
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
daNote.active = false;
daNote.visible = false;
if (daNote.y < -daNote.height)
{
if (daNote.tooLate)
vocals.volume = 0;
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
daNote.active = false;
daNote.visible = false;
// one time sort
if (!sortedNotes)
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
});
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
FlxG.watch.addQuick('length', notes.length);
// one time sort
if (!sortedNotes)
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
});
}
keyShit();
}
@ -521,7 +572,7 @@ class PlayState extends FlxState
var leftR = FlxG.keys.anyJustReleased([A, LEFT]);
FlxG.watch.addQuick('asdfa', upP);
if ((upP || rightP || downP || leftP) && !boyfriend.stunned)
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
{
var possibleNotes:Array<Note> = [];
@ -566,7 +617,7 @@ class PlayState extends FlxState
}
}
if ((up || right || down || left) && !boyfriend.stunned)
if ((up || right || down || left) && !boyfriend.stunned && generatedMusic)
{
notes.forEach(function(daNote:Note)
{
@ -634,7 +685,7 @@ class PlayState extends FlxState
if (!boyfriend.stunned)
{
health -= 0.075;
if (combo > 10)
if (combo > 5)
{
gf.playAnim('sad');
}

86
source/TitleState.hx Normal file
View File

@ -0,0 +1,86 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
class TitleState extends FlxTransitionableState
{
static var initialized:Bool = false;
override public function create():Void
{
super.create();
if (!initialized)
{
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
diamond.persist = true;
diamond.destroyOnNoUse = false;
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 2, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
new FlxRect(0, 0, FlxG.width, FlxG.height));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 1.3, new FlxPoint(0, 1),
{asset: diamond, width: 32, height: 32}, new FlxRect(0, 0, FlxG.width, FlxG.height));
initialized = true;
FlxTransitionableState.defaultTransIn.tileData = {asset: diamond, width: 32, height: 32};
FlxTransitionableState.defaultTransOut.tileData = {asset: diamond, width: 32, height: 32};
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
}
persistentUpdate = true;
var bg:FlxSprite = FlxGridOverlay.create(20, 20);
add(bg);
var logoBl:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
logoBl.screenCenter();
logoBl.color = FlxColor.BLACK;
add(logoBl);
var logo:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.logo__png);
logo.screenCenter();
add(logo);
FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
FlxG.sound.playMusic('assets/music/title.mp3', 0, false);
FlxG.sound.music.fadeIn(4, 0, 0.7);
}
var transitioning:Bool = false;
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ENTER && !transitioning)
{
transitioning = true;
FlxG.sound.music.stop();
new FlxTimer().start(2, function(tmr:FlxTimer)
{
FlxG.switchState(new PlayState());
});
FlxG.sound.play('assets/music/titleShoot.mp3', 0.7);
}
super.update(elapsed);
}
}