diff --git a/assets/week6/images/weeb/gfPixel - Copy.png b/assets/week6/images/weeb/gfPixel - Copy.png deleted file mode 100644 index b298a13a..00000000 Binary files a/assets/week6/images/weeb/gfPixel - Copy.png and /dev/null differ diff --git a/assets/week6/images/weeb/gfPixel - Copy.xml b/assets/week6/images/weeb/gfPixel - Copy.xml deleted file mode 100644 index 87b998c8..00000000 --- a/assets/week6/images/weeb/gfPixel - Copy.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/funkin/backend/scripting/events/AmountEvent.hx b/source/funkin/backend/scripting/events/AmountEvent.hx new file mode 100644 index 00000000..45b5c9ce --- /dev/null +++ b/source/funkin/backend/scripting/events/AmountEvent.hx @@ -0,0 +1,8 @@ +package funkin.backend.scripting.events; + +final class AmountEvent extends CancellableEvent { + /** + * Amount + */ + public var amount:Int; +} \ No newline at end of file diff --git a/source/funkin/backend/system/framerate/AssetTreeInfo.hx b/source/funkin/backend/system/framerate/AssetTreeInfo.hx index 7417e124..1ebba189 100644 --- a/source/funkin/backend/system/framerate/AssetTreeInfo.hx +++ b/source/funkin/backend/system/framerate/AssetTreeInfo.hx @@ -28,7 +28,7 @@ class AssetTreeInfo extends FramerateCategory { } if (text != "") text = text.substr(0, text.length-1); - + this.text.text = text; super.__enterFrame(t); } diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 8f0cd79f..356d57cf 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -198,7 +198,7 @@ class Note extends FlxSprite frameOffset.y += __notePosFrameOffset.y * 2; super.drawComplex(camera); frameOffset.y -= __notePosFrameOffset.y * 2; - } else + } else super.drawComplex(camera); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 250872f6..0d96e66f 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -565,7 +565,7 @@ class PlayState extends MusicBeatState for(content in [Paths.getFolderContent('songs/${SONG.meta.name.toLowerCase()}/scripts', true, fromMods ? MODS : BOTH), Paths.getFolderContent('data/charts/', true, fromMods ? MODS : BOTH)]) for(file in content) addScript(file); - for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH)) + for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH)) if (EventsData.eventsList.contains(Path.withoutExtension(Path.withoutDirectory(file)))) addScript(file); } } @@ -601,7 +601,7 @@ class PlayState extends MusicBeatState } } - for(strumLine in SONG.strumLines) { + for(i=>strumLine in SONG.strumLines) { if (strumLine == null) continue; var chars = []; @@ -621,6 +621,7 @@ class PlayState extends MusicBeatState strLine.cameras = [camHUD]; strLine.data = strumLine; strLine.visible = (strumLine.visible != false); + strLine.ID = i; strumLines.add(strLine); } @@ -635,9 +636,9 @@ class PlayState extends MusicBeatState // CAMERA & HUD INITIALISATION #if REGION - - if (!scripts.event("onPreGenerateStrums", new CancellableEvent()).cancelled) { - generateStrums(); + var event = EventManager.get(AmountEvent).recycle(4); + if (!scripts.event("onPreGenerateStrums", event).cancelled) { + generateStrums(event.amount); scripts.call("onPostGenerateStrums"); } @@ -798,7 +799,6 @@ class PlayState extends MusicBeatState var swagCounter:Int = 0; - startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer) { countdown(swagCounter++); @@ -935,9 +935,9 @@ class PlayState extends MusicBeatState } @:dox(hide) - private inline function generateStrums():Void + private inline function generateStrums(amount:Int = 4):Void for(p in strumLines) - p.generateStrums(); + p.generateStrums(amount); @:dox(hide) override function openSubState(SubState:FlxSubState) @@ -1105,7 +1105,7 @@ class PlayState extends MusicBeatState { if (startedCountdown) { - Conductor.songPosition += FlxG.elapsed * 1000; + Conductor.songPosition += elapsed * 1000; if (Conductor.songPosition >= 0) startSong(); } @@ -1336,6 +1336,7 @@ class PlayState extends MusicBeatState /** * Misses a note + * @param strumLine The strumline the miss happened on. * @param note Note to miss. * @param direction Specify a custom direction in case note is null. * @param player Specify a custom player in case note is null. @@ -1344,14 +1345,13 @@ class PlayState extends MusicBeatState { var playerID:Null = note == null ? player : strumLines.members.indexOf(strumLine); var directionID:Null = note == null ? direction : note.strumID; - if (playerID == null || directionID == null) return; + if (playerID == null || directionID == null || playerID == -1) return; - var event:NoteHitEvent = scripts.event("onPlayerMiss", EventManager.get(NoteHitEvent).recycle(true, false, false, note, strumLines.members[playerID].characters, true, note != null ? note.noteType : null, "", "", "", directionID, -10, 0, -0.04, "shit")); + var event:NoteHitEvent = scripts.event("onPlayerMiss", EventManager.get(NoteHitEvent).recycle(true, false, false, note, strumLines.members[playerID].characters, true, note != null ? note.noteType : null, "", "", "", directionID, -10, 0, note != null ? -0.0475 : -0.04, "shit")); strumLine.onMiss.dispatch(event); if (event.cancelled) return; - - if (event.note != null && strumLine != null) strumLine.addHealth(event.healthGain); + if (strumLine != null) strumLine.addHealth(event.healthGain); if (gf != null && combo > 5 && gf.hasAnimation('sad')) gf.playAnim('sad', event.forceAnim, MISS); combo = 0; diff --git a/source/funkin/game/SplashGroup.hx b/source/funkin/game/SplashGroup.hx index 81c04b38..67e136c5 100644 --- a/source/funkin/game/SplashGroup.hx +++ b/source/funkin/game/SplashGroup.hx @@ -66,7 +66,7 @@ class SplashGroup extends FlxTypedGroup { splashSprite.animation.finishCallback = function(name) { splashSprite.active = splashSprite.visible = false; }; - + if (xml.has.scale) splashSprite.scale.scale(Std.parseFloat(xml.att.scale).getDefault(1)); if (xml.has.alpha) splashSprite.alpha = Std.parseFloat(xml.att.alpha).getDefault(1); if (xml.has.antialiasing) splashSprite.antialiasing = xml.att.antialiasing == "true"; diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 56f705be..22e37019 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -72,22 +72,24 @@ class Stage extends FlxBasic implements IBeatReceiver { stageSprites.set(spr.name, spr); state.add(spr); spr; - case "box": + case "box" | "solid": if ( !node.has.name || !node.has.width || !node.has.height) continue; var spr = new FlxSprite( (node.has.x) ? Std.parseFloat(node.att.x) : 0, (node.has.y) ? Std.parseFloat(node.att.y) : 0 - ).makeGraphic( + ); + + (node.name == "solid" ? spr.makeSolid : spr.makeGraphic)( Std.parseInt(node.att.width), Std.parseInt(node.att.height), - (node.has.color) ? CoolUtil.getColorFromDynamic(node.att.color) : 0xFFFFFFFF + (node.has.color) ? CoolUtil.getColorFromDynamic(node.att.color) : -1 ); stageSprites.set(node.getAtt("name"), spr); state.add(spr); spr; - case "boyfriend" | "bf": + case "boyfriend" | "bf" | "player": addCharPos("boyfriend", node, { x: 770, y: 100, diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index ca8ac584..96db83f1 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -65,6 +65,10 @@ class StrumLine extends FlxTypedGroup { * Whenever alt animation is enabled on this strumline. */ public var altAnim:Bool = false; + /** + * TODO: Write documention about this being a variable that can help when making multi key + */ + public var strumAnimPrefix = ["left", "down", "up", "right"]; private function get_ghostTapping() { if (this.ghostTapping != null) return this.ghostTapping; @@ -200,7 +204,7 @@ class StrumLine extends FlxTypedGroup { __justPressed = CoolUtil.getDefault(event.justPressed, []); __justReleased = CoolUtil.getDefault(event.justReleased, []); - __notePerStrum = [for(_ in 0...4) null]; + __notePerStrum = [for(_ in 0...members.length) null]; if (__pressed.contains(true)) { @@ -235,7 +239,7 @@ class StrumLine extends FlxTypedGroup { PlayState.instance.health += health * (opponentSide ? -1 : 1); public inline function generateStrums(amount:Int = 4) { - for (i in 0...4) + for (i in 0...amount) add(createStrum(i)); } @@ -246,13 +250,7 @@ class StrumLine extends FlxTypedGroup { */ public function createStrum(i:Int, ?animPrefix:String) { if (animPrefix == null) - animPrefix = switch(i % 4) { - case 0: "left"; - case 1: "down"; - case 2: "up"; - case 3: "right"; - case _: "up"; - } + animPrefix = strumAnimPrefix[i % strumAnimPrefix.length]; var babyArrow:Strum = new Strum((FlxG.width * strumOffset) + (Note.swagWidth * (i - 2)), PlayState.instance.strumLine.y); babyArrow.ID = i; @@ -284,7 +282,7 @@ class StrumLine extends FlxTypedGroup { FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)}); } babyArrow.playAnim('static'); - + insert(i, babyArrow); return babyArrow; } diff --git a/update.sh b/update.sh index 6f843ad6..b664c4fd 100644 --- a/update.sh +++ b/update.sh @@ -1,2 +1,2 @@ #!/bin/sh -haxe -cp update -D analyzer-optimize -main Update --interp \ No newline at end of file +haxe -cp commandline -D analyzer-optimize --run Main setup \ No newline at end of file