Skip to content

Commit

Permalink
using new code i guess
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Feb 18, 2024
1 parent 09df9e4 commit b5d7e00
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 39 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
path: export/debug/windows/bin
Binary file added assets/music/synth.ogg
Binary file not shown.
36 changes: 14 additions & 22 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
58 changes: 45 additions & 13 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -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<Note>;
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!');
}
}
}

0 comments on commit b5d7e00

Please # to comment.