diff --git a/assets/data/characters/pico.xml b/assets/data/characters/pico.xml index d4bd008a..f7a12dc0 100644 --- a/assets/data/characters/pico.xml +++ b/assets/data/characters/pico.xml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/assets/images/icons/bf-old.png b/assets/images/icons/bf-old.png new file mode 100644 index 00000000..3d6fea03 Binary files /dev/null and b/assets/images/icons/bf-old.png differ diff --git a/assets/images/icons/bf-pixel.png b/assets/images/icons/bf-pixel.png new file mode 100644 index 00000000..41e31efe Binary files /dev/null and b/assets/images/icons/bf-pixel.png differ diff --git a/assets/images/icons/bf.png b/assets/images/icons/bf.png new file mode 100644 index 00000000..6eeb4179 Binary files /dev/null and b/assets/images/icons/bf.png differ diff --git a/assets/images/icons/dad.png b/assets/images/icons/dad.png new file mode 100644 index 00000000..bf125ae4 Binary files /dev/null and b/assets/images/icons/dad.png differ diff --git a/assets/images/icons/face.png b/assets/images/icons/face.png new file mode 100644 index 00000000..c994419c Binary files /dev/null and b/assets/images/icons/face.png differ diff --git a/assets/images/icons/gf.png b/assets/images/icons/gf.png new file mode 100644 index 00000000..200f1d46 Binary files /dev/null and b/assets/images/icons/gf.png differ diff --git a/assets/images/icons/mom-car.png b/assets/images/icons/mom-car.png new file mode 100644 index 00000000..d2dc0774 Binary files /dev/null and b/assets/images/icons/mom-car.png differ diff --git a/assets/images/icons/monster.png b/assets/images/icons/monster.png new file mode 100644 index 00000000..d8ae16b6 Binary files /dev/null and b/assets/images/icons/monster.png differ diff --git a/assets/images/icons/parents-christmas.png b/assets/images/icons/parents-christmas.png new file mode 100644 index 00000000..c521b86d Binary files /dev/null and b/assets/images/icons/parents-christmas.png differ diff --git a/assets/images/icons/pico.png b/assets/images/icons/pico.png new file mode 100644 index 00000000..e5b3acc4 Binary files /dev/null and b/assets/images/icons/pico.png differ diff --git a/assets/images/icons/senpai.png b/assets/images/icons/senpai.png new file mode 100644 index 00000000..35308d22 Binary files /dev/null and b/assets/images/icons/senpai.png differ diff --git a/assets/images/icons/spirit.png b/assets/images/icons/spirit.png new file mode 100644 index 00000000..1e3f7dd7 Binary files /dev/null and b/assets/images/icons/spirit.png differ diff --git a/assets/images/icons/spooky.png b/assets/images/icons/spooky.png new file mode 100644 index 00000000..3eba87f5 Binary files /dev/null and b/assets/images/icons/spooky.png differ diff --git a/assets/images/icons/tankman.png b/assets/images/icons/tankman.png new file mode 100644 index 00000000..d623136e Binary files /dev/null and b/assets/images/icons/tankman.png differ diff --git a/buildnumber.txt b/buildnumber.txt index 274ccca8..c5a64442 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -209 \ No newline at end of file +221 \ No newline at end of file diff --git a/source/AnimationDebug.hx b/source/AnimationDebug.hx index 4d44f52b..08d13d69 100644 --- a/source/AnimationDebug.hx +++ b/source/AnimationDebug.hx @@ -178,13 +178,13 @@ class AnimationDebug extends FlxState { updateTexts(); if (upP) - char.animOffsets.get(animList[curAnim])[1] += 1 * multiplier; + char.animOffsets.get(animList[curAnim]).y += 1 * multiplier; if (downP) - char.animOffsets.get(animList[curAnim])[1] -= 1 * multiplier; + char.animOffsets.get(animList[curAnim]).y -= 1 * multiplier; if (leftP) - char.animOffsets.get(animList[curAnim])[0] += 1 * multiplier; + char.animOffsets.get(animList[curAnim]).x += 1 * multiplier; if (rightP) - char.animOffsets.get(animList[curAnim])[0] -= 1 * multiplier; + char.animOffsets.get(animList[curAnim]).x -= 1 * multiplier; updateTexts(); genBoyOffsets(false); diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 39224c6e..af5cf71b 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -9,6 +9,7 @@ import flixel.FlxSprite; import flixel.FlxCamera; import flixel.animation.FlxBaseAnimation; import flixel.graphics.frames.FlxAtlasFrames; +import flixel.math.FlxRect; import openfl.utils.Assets; import haxe.xml.Access; @@ -19,9 +20,15 @@ using StringTools; class Character extends FlxSprite implements IBeatReceiver implements IOffsetCompatible { - public var stunned:Bool = false; + private var __stunnedTime:Float = 0; + public var stunned(default, set):Bool = false; - public var animOffsets:Map>; + private function set_stunned(b:Bool) { + __stunnedTime = 0; + return stunned = b; + } + + public var animOffsets:Map; public var debugMode:Bool = false; public var isPlayer:Bool = false; @@ -33,13 +40,20 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom public var playerOffsets:Bool = false; + public var cameraOffset:FlxPoint = new FlxPoint(0, 0); public var globalOffset:FlxPoint = new FlxPoint(0, 0); + public inline function getCameraPosition() { + var midpoint = getMidpoint(); + return FlxPoint.get( + midpoint.x + (isPlayer ? -100 : 150) + globalOffset.x + cameraOffset.x, + midpoint.y - 100 + globalOffset.y + cameraOffset.y); + } public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false) { super(x, y); - animOffsets = new Map>(); + animOffsets = new Map(); curCharacter = character; this.isPlayer = isPlayer; @@ -73,7 +87,9 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom if (character.has.isPlayer) playerOffsets = (character.att.isPlayer == "true"); if (character.has.isGF) isGF = (character.att.isGF == "true"); if (character.has.x) globalOffset.x = Std.parseFloat(character.att.x); - if (character.has.x) globalOffset.y = Std.parseFloat(character.att.y); + if (character.has.y) globalOffset.y = Std.parseFloat(character.att.y); + if (character.has.camx) cameraOffset.x = Std.parseFloat(character.att.camx); + if (character.has.camy) cameraOffset.y = Std.parseFloat(character.att.camy); if (character.has.flipX) flipX = (character.att.flipX == "true"); frames = Paths.getSparrowAtlas('characters/$curCharacter'); @@ -589,6 +605,11 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom override function update(elapsed:Float) { super.update(elapsed); + if (stunned) { + __stunnedTime += elapsed; + if (__stunnedTime > 5 / 60) + stunned = false; + } } private var danced:Bool = false; @@ -627,52 +648,28 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom // nothing } - // /** - // * DO NOT TOUCH!! FOR DRAWING STUFF - // */ - // public override function isOnScreen() { - // if (flipX) { - // return super.isOnScreen(); - // } else { - // return super.isOnScreen(); - // } - // } - // public override function draw() { - // // doing this cause flixel have a bug with frameX not being applied correctly when sprite is flipped - // if (flipX) { - // isOnScreen - // // setting up variables - // flipX = false; - // scale.x = -scale.x; - - // // drawing - // super.draw(); - - // // resetting variables - // scale.x = -scale.x; - // flipX = true; - // } else - // super.draw(); - // } - - public override function isOnScreen(?Camera:FlxCamera):Bool - { - if (Camera == null) - Camera = FlxG.camera; - - getScreenPosition(_point, Camera); - return Camera.containsPoint(_point, width, height); + var __reverseDrawProcedure:Bool = false; + public override function getScreenBounds(?newRect:FlxRect, ?camera:FlxCamera):FlxRect { + if (__reverseDrawProcedure) { + scale.x *= -1; + var bounds = super.getScreenBounds(newRect, camera); + scale.x *= -1; + return bounds; + } + return super.getScreenBounds(newRect, camera); } - + public override function draw() { if (flipX) { - dirty = true; + __reverseDrawProcedure = true; flipX = false; scale.x *= -1; super.draw(); flipX = true; scale.x *= -1; + + __reverseDrawProcedure = false; } else super.draw(); } @@ -682,21 +679,12 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom animation.play(AnimName, Force, Reversed, Frame); var daOffset = animOffsets.get(AnimName); - if (animOffsets.exists(AnimName)) - { - if (isPlayer != playerOffsets) { - offset.set(-daOffset[0], daOffset[1]); - var anim = animation.getByName(AnimName); - // if (anim != null && anim.frames.length > 0) { - // offset.x -= frames.frames[anim.frames[0]].offset.x * 2; - // } - } else { - offset.set(daOffset[0], daOffset[1]); - } - } + if (daOffset != null) + offset.set(daOffset.x * (isPlayer != playerOffsets ? -1 : 1), daOffset.y); else offset.set(0, 0); - offset.x -= globalOffset.x; + + offset.x += globalOffset.x - (isPlayer != playerOffsets ? 1 : -1); offset.y -= globalOffset.y; if (AnimName.startsWith("sing")) @@ -720,8 +708,12 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom } } + public override function destroy() { + super.destroy(); + } + public function addOffset(name:String, x:Float = 0, y:Float = 0) { - animOffsets[name] = [x, y]; + animOffsets[name] = new FlxPoint(x, y); } } \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 2dc89397..0d21769f 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -90,6 +90,8 @@ class PlayState extends MusicBeatState public var playerStrums:FlxTypedGroup; public var cpuStrums:FlxTypedGroup; + public var muteVocalsOnMiss:Bool = true; + public var camZooming:Bool = false; public var camZoomingInterval:Int = 4; public var curSong:String = ""; @@ -843,46 +845,10 @@ class PlayState extends MusicBeatState if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { - if (curBeat % 4 == 0) + if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) { - // trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); - } - - if (camFollow.x != dad.getMidpoint().x + 150 + dad.globalOffset.x && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) - { - camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100); - // camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210); - - switch (dad.curCharacter) - { - case 'mom': - camFollow.y = dad.getMidpoint().y; - case 'senpai': - camFollow.y = dad.getMidpoint().y - 430; - camFollow.x = dad.getMidpoint().x - 100; - case 'senpai-angry': - camFollow.y = dad.getMidpoint().y - 430; - camFollow.x = dad.getMidpoint().x - 100; - } - - - camFollow.x += dad.globalOffset.x; - camFollow.y += dad.globalOffset.y; - - if (dad.curCharacter == 'mom') - vocals.volume = 1; - - if (SONG.song.toLowerCase() == 'tutorial') - { - tweenCamIn(); - } - } - - // TODO: redo this god forsaken system - - if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100 + boyfriend.globalOffset.x) - { - camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100); + var pos = boyfriend.getCameraPosition(); + camFollow.setPosition(pos.x, pos.y); // switch (curStage) // { @@ -897,14 +863,37 @@ class PlayState extends MusicBeatState // camFollow.x = boyfriend.getMidpoint().x - 200; // camFollow.y = boyfriend.getMidpoint().y - 200; // } - - camFollow.x += boyfriend.globalOffset.x; - camFollow.y += boyfriend.globalOffset.y; - + if (SONG.song.toLowerCase() == 'tutorial') { FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut}); } + } else { + var pos = dad.getCameraPosition(); + camFollow.setPosition(pos.x, pos.y); + + // camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100); + // camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210); + + // switch (dad.curCharacter) + // { + // case 'mom': + // camFollow.y = dad.getMidpoint().y; + // case 'senpai': + // camFollow.y = dad.getMidpoint().y - 430; + // camFollow.x = dad.getMidpoint().x - 100; + // case 'senpai-angry': + // camFollow.y = dad.getMidpoint().y - 430; + // camFollow.x = dad.getMidpoint().x - 100; + // } + + if (dad.curCharacter == 'mom') + vocals.volume = 1; + + if (SONG.song.toLowerCase() == 'tutorial') + { + tweenCamIn(); + } } } @@ -996,7 +985,11 @@ class PlayState extends MusicBeatState if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (Conductor.stepCrochet) < Conductor.songPosition) { deleteNote(daNote); return; - } + } + if (daNote.tooLate) { + noteMiss(daNote); + return; + } var strum:Strum = null; for(e in (daNote.mustPress ? playerStrums : cpuStrums).members) { @@ -1019,6 +1012,8 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.ONE) endSong(); #end + + scripts.call("updatePost", [elapsed]); } function endSong():Void @@ -1295,7 +1290,7 @@ class PlayState extends MusicBeatState scripts.call("onKeyShitPost"); } - function noteMiss(direction:Int = 1):Void + function noteMiss(note:Note):Void { if (!boyfriend.stunned) { @@ -1312,15 +1307,10 @@ class PlayState extends MusicBeatState // FlxG.sound.play(Paths.sound('missnote1'), 1, false); // FlxG.log.add('played imss note'); + if (muteVocalsOnMiss) vocals.volume = 0; boyfriend.stunned = true; - // get stunned for 5 seconds - new FlxTimer().start(5 / 60, function(tmr:FlxTimer) - { - boyfriend.stunned = false; - }); - - switch (direction) + switch (note.strumID) { case 0: boyfriend.playAnim('singLEFTmiss', true); @@ -1331,6 +1321,7 @@ class PlayState extends MusicBeatState case 3: boyfriend.playAnim('singRIGHTmiss', true); } + deleteNote(note); } } diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index e97439eb..f36039ac 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -23,7 +23,7 @@ class Stage extends FlxBasic implements IBeatReceiver { if (PlayState.instance == null) return; stagePath = Paths.xml('stages/$stage'); try { - stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement()); + if (Assets.exists(stagePath)) stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement()); } catch(e) { // TODO: handler trace(e.details()); diff --git a/source/funkin/game/Strum.hx b/source/funkin/game/Strum.hx index 3d73151e..f1739002 100644 --- a/source/funkin/game/Strum.hx +++ b/source/funkin/game/Strum.hx @@ -32,10 +32,12 @@ class Strum extends FlxSprite { // TODO: angle stuff daNote.x = x + offset.x; daNote.y = y - offset.y; + + offset.put(); } public function updateClipRect(daNote:Note) { - if (!daNote.isSustainNote) return; + if (!daNote.isSustainNote || !daNote.wasGoodHit) return; daNote.updateClipRect(this); }