scores and dope shit

This commit is contained in:
Cameron Taylor 2020-10-03 12:32:15 -07:00
parent 32001dad2e
commit 75a02413de
4 changed files with 69 additions and 9 deletions

View File

@ -27,7 +27,9 @@
<!-- _____________________________ Path Settings ____________________________ --> <!-- _____________________________ Path Settings ____________________________ -->
<set name="BUILD_DIR" value="export" /> <set name="BUILD_DIR" value="export/debug" if="debug" />
<set name="BUILD_DIR" value="export/release" unless="debug" />
<classpath name="source" /> <classpath name="source" />
<assets path="assets" /> <assets path="assets" />
@ -36,7 +38,7 @@
<haxelib name="flixel" /> <haxelib name="flixel" />
<!--In case you want to use the addons package--> <!--In case you want to use the addons package-->
<!--<haxelib name="flixel-addons" />--> <haxelib name="flixel-addons" />
<!--In case you want to use the ui package--> <!--In case you want to use the ui package-->
<!--<haxelib name="flixel-ui" />--> <!--<haxelib name="flixel-ui" />-->

11
art/build-Itch-HTML.bat Normal file
View File

@ -0,0 +1,11 @@
@echo off
color 0a
cd ..
@echo on
echo BUILDING GAME
lime build html5 -debug
echo UPLOADING TO ITCH
butler push ./export/debug/html5/bin ninja-muffin24/ld47:html5
butler status ninja-muffin24/ld47:html5
echo ITCH SHIT UPDATED LMAOOOOO
pause

View File

@ -14,6 +14,8 @@ class Note extends FlxSprite
public var wasGoodHit:Bool = false; public var wasGoodHit:Bool = false;
public var prevNote:Note; public var prevNote:Note;
public var noteScore:Float = 1;
public function new(strumTime:Float, noteData:Int) public function new(strumTime:Float, noteData:Int)
{ {
super(); super();
@ -43,8 +45,11 @@ class Note extends FlxSprite
} }
if (noteData < 0) if (noteData < 0)
{
noteScore * 0.2;
alpha = 0.6; alpha = 0.6;
} }
}
override function update(elapsed:Float) override function update(elapsed:Float)
{ {

View File

@ -6,6 +6,8 @@ import flixel.FlxState;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.system.FlxSound; import flixel.system.FlxSound;
import flixel.text.FlxText; import flixel.text.FlxText;
import flixel.tweens.FlxTween;
import flixel.util.FlxTimer;
import haxe.Json; import haxe.Json;
import lime.utils.Assets; import lime.utils.Assets;
@ -26,6 +28,9 @@ class PlayState extends FlxState
private var notes:FlxTypedGroup<Note>; private var notes:FlxTypedGroup<Note>;
private var strumLine:FlxSprite; private var strumLine:FlxSprite;
private var curSection:Int = 0;
private var sectionScores:Array<Dynamic> = [[], []];
override public function create() override public function create()
{ {
@ -42,6 +47,8 @@ class PlayState extends FlxState
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10); strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
add(strumLine); add(strumLine);
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
super.create(); super.create();
} }
@ -70,6 +77,9 @@ class PlayState extends FlxState
for (songNotes in dumbassSection) for (songNotes in dumbassSection)
{ {
sectionScores[0].push(0);
sectionScores[1].push(0);
if (songNotes != 0) if (songNotes != 0)
{ {
var daStrumTime:Float = (((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * daBeats)) var daStrumTime:Float = (((daStep * Conductor.stepCrochet) + (Conductor.crochet * 8 * daBeats))
@ -83,14 +93,16 @@ class PlayState extends FlxState
{ {
swagNote.mustPress = true; swagNote.mustPress = true;
} }
else
{
sectionScores[0][daBeats] += swagNote.noteScore;
}
if (notes.members.length > 0) if (notes.members.length > 0)
swagNote.prevNote = notes.members[notes.members.length - 1]; swagNote.prevNote = notes.members[notes.members.length - 1];
else else
swagNote.prevNote = swagNote; swagNote.prevNote = swagNote;
trace(notes.members.length - 1);
notes.add(swagNote); notes.add(swagNote);
} }
@ -106,6 +118,8 @@ class PlayState extends FlxState
var bouncingSprite:FlxSprite; var bouncingSprite:FlxSprite;
var sectionScored:Bool = false;
override public function update(elapsed:Float) override public function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -113,8 +127,17 @@ class PlayState extends FlxState
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
var playerTurn:Int = totalBeats % 8; var playerTurn:Int = totalBeats % 8;
if (playerTurn == 7 && !sectionScored)
{
popUpScore();
sectionScored = true;
}
if (playerTurn < 4) if (playerTurn < 4)
{
bouncingSprite = dad; bouncingSprite = dad;
sectionScored = false;
}
else else
bouncingSprite = boyfriend; bouncingSprite = boyfriend;
@ -139,6 +162,25 @@ class PlayState extends FlxState
keyShit(); keyShit();
} }
private function popUpScore():Void
{
var placement:String = sectionScores[1][curSection] + '/' + sectionScores[0][curSection];
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
coolText.screenCenter();
coolText.x = FlxG.width * 0.75;
add(coolText);
FlxTween.tween(coolText, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
coolText.kill();
},
startDelay: Conductor.crochet * 0.001
});
curSection += 1;
}
function keyShit():Void function keyShit():Void
{ {
// HOLDING // HOLDING
@ -162,19 +204,15 @@ class PlayState extends FlxState
{ {
// NOTES YOU ARE HOLDING // NOTES YOU ARE HOLDING
case -1: case -1:
trace(daNote.prevNote.wasGoodHit);
if (up && daNote.prevNote.wasGoodHit) if (up && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -2: case -2:
trace(daNote.prevNote.wasGoodHit);
if (right && daNote.prevNote.wasGoodHit) if (right && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -3: case -3:
trace(daNote.prevNote.wasGoodHit);
if (down && daNote.prevNote.wasGoodHit) if (down && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -4: case -4:
trace(daNote.prevNote.wasGoodHit);
if (left && daNote.prevNote.wasGoodHit) if (left && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case 1: // NOTES YOU JUST PRESSED case 1: // NOTES YOU JUST PRESSED
@ -202,8 +240,12 @@ class PlayState extends FlxState
function goodNoteHit(note:Note):Void function goodNoteHit(note:Note):Void
{ {
if (!note.wasGoodHit)
{
sectionScores[1][curSection] += note.noteScore;
note.wasGoodHit = true; note.wasGoodHit = true;
} }
}
function everyBeat():Void function everyBeat():Void
{ {