diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8080abf..e9df082 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,8 +24,8 @@ jobs: key: cache-build-windows path: | .haxelib/ - export/release/windows/haxe/ - export/release/windows/obj/ + export/debug/windows/haxe/ + export/debug/windows/obj/ restore-keys: | cache-build-windows - name: Install Haxelib @@ -38,9 +38,9 @@ jobs: - name: Create Version Tag run: echo "${{github.run_id}}" > VERSION - name: Compile - run: haxelib run lime build windows --app-version="4.0.0-${{ github.run_id}}" + run: haxelib run lime build windows -debug --app-version="4.0.0-${{ github.run_id}}" - name: Publish Artifact uses: actions/upload-artifact@main with: name: windowsBuild - path: export/release/windows/bin \ No newline at end of file + path: export/debug/windows/bin \ No newline at end of file diff --git a/assets/music/synth.ogg b/assets/music/synth.ogg new file mode 100644 index 0000000..1067528 Binary files /dev/null and b/assets/music/synth.ogg differ diff --git a/source/Note.hx b/source/Note.hx index 220988c..c691e5b 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -2,33 +2,25 @@ package; import flixel.FlxG; import flixel.FlxSprite; - -import flixel.graphics.frames.FlxAtlasFrames; +import flixel.util.FlxColor; class Note extends FlxSprite { - public function new(x:Float = 0, y:Float = 0) - { - super(x, y); - - frames = Paths.getSparrowAtlas('arrows'); - - animation.addByPrefix('downI', 'downIdle'); - animation.addByPrefix('downP', 'downPress'); - animation.addByPrefix('downR', 'down'); + var time:Int; - animation.addByPrefix('leftI', 'leftIdle'); - animation.addByPrefix('leftP', 'leftPress'); - animation.addByPrefix('leftR', 'left'); - - animation.addByPrefix('rightI', 'rightIdle'); - animation.addByPrefix('rightP', 'rightPress'); - animation.addByPrefix('rightR', 'right'); + public function new(time:Int, yPos:Float) + { + super(0, yPos); + this.time = time; - animation.addByPrefix('upI', 'upIdle'); - animation.addByPrefix('upP', 'upPress'); - animation.addByPrefix('upR', 'up'); + makeGraphic(20, 20, FlxColor.fromRGB(FlxG.random.int(0, 255), FlxG.random.int(0, 255), FlxG.random.int(0, 255))); + visible = false; + } - setGraphicSize(width * 0.7); + public function trigger():Void + { + FlxG.camera.flash(FlxColor.WHITE, 0.5); + FlxG.camera.shake(0.01, 0.2); + visible = true; } } \ No newline at end of file diff --git a/source/PlayState.hx b/source/PlayState.hx index 20cfe98..7533fd5 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,38 +1,70 @@ package; +import flixel.sound.FlxSound; import flixel.text.FlxText; import flixel.FlxState; import flixel.FlxG; -class PlayState extends FlxState +class PlayState extends BeatState { var curSong:String = ''; - var strumYPos:Float = 100; - var noteSize:Float = 20; + var music:FlxSound; + var notes:Array; + var currentNoteIndex:Int = 0; override public function create() { super.create(); - var text:FlxText = new FlxText(0, 0, 0, "Hello World", 64); + var text:FlxText = new FlxText(0, 0, 0, "use space at the moment\nidk", 64); text.screenCenter(); add(text); - for (i in 0...4) - { - drawNote(400 + i * noteSize, strumYPos, noteSize); - } + var strumline:FlxSprite = new FlxSprite(0, FlxG.height - 20).makeGraphic(FlxG.width, 5, FlxColor.WHITE); + add(strumline); + + music = FlxG.sound.load(Paths.music('synth'), 1); // just for testing + music.play(true); + + notes = [ + new Note(0, 1000), + new Note(1000, 2000) + ]; + + for (note in notes) + add(note); } override public function update(elapsed:Float) { super.update(elapsed); - } - function drawNote(x:Float, y:Float, size:Float) - { - var note:Note = new Note(x, y); - add(note); + if (currentNoteIndex < notes.length && music.position >= notes[currentNoteIndex].time) + { + notes[currentNoteIndex].trigger(); + currentNoteIndex++; + } + + for (note in notes) + { + note.y += 100 * elapsed; + if (note.y > FlxG.height) + { + note.kill(); + trace('missed!'); + } + } + + if (FlxG.keys.justPressed.SPACE) + { + if (currentNoteIndex < notes.length && notes[currentNoteIndex].visible) + { + notes[currentNoteIndex].kill(); + trace('note hit!'); + } + else + trace('missed!'); + } } } \ No newline at end of file