From 8ad3bf1f44c92ca326218b0febaf09e417b21847 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 13 Jan 2021 22:38:31 -0500 Subject: [PATCH] swappable characters debug --- CHANGELOG.md | 3 +++ source/Boyfriend.hx | 4 ++-- source/Character.hx | 26 ++++++++++++++++++--- source/ChartingState.hx | 50 +++++++++++++++++++++++++++++++++-------- source/PlayState.hx | 6 ++--- 5 files changed, 72 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 112ab5f21..80367d567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Enemy icons change when they you are winning a lot ([Thanks to pahaze for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/138)) - Holding CTRL in charting editor places notes on both sides +- Q and E changes sustain lengths in note editor - Other charting editor workflow improvements +### Removed +- Removed APE ### Fixed - Song no longer loops when finishing the song. ([Thanks Injourn for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/132)) diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx index a30805221..b22917935 100644 --- a/source/Boyfriend.hx +++ b/source/Boyfriend.hx @@ -11,9 +11,9 @@ class Boyfriend extends Character { public var stunned:Bool = false; - public function new(x:Float, y:Float) + public function new(x:Float, y:Float, ?char:String = 'bf') { - super(x, y); + super(x, y, char, true); } override function update(elapsed:Float) diff --git a/source/Character.hx b/source/Character.hx index 255fcdc3a..3b2b22875 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -166,8 +166,7 @@ class Character extends FlxSprite addOffset("singLEFTmiss", 62, 64); addOffset("singDOWNmiss", 210, -28); - if (!isPlayer) - flipX = true; + flipX = true; case 'bf': var tex = FlxAtlasFrames.fromSparrow('assets/images/BOYFRIEND.png', 'assets/images/BOYFRIEND.xml'); @@ -188,7 +187,6 @@ class Character extends FlxSprite animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false); animation.addByPrefix('scared', 'BF idle shaking', 24); - playAnim('idle'); antialiasing = true; @@ -206,6 +204,28 @@ class Character extends FlxSprite addOffset('deathLoop', 37, 5); addOffset('deathConfirm', 37, 69); addOffset('scared', -4); + + flipX = true; + } + + playAnim('singUP'); + + if (isPlayer) + { + flipX = !flipX; + + // var animArray + var oldRight = animation.getByName('singRIGHT').frames; + animation.getByName('singRIGHT').frames = animation.getByName('singLEFT').frames; + animation.getByName('singLEFT').frames = oldRight; + + // IF THEY HAVE MISS ANIMATIONS?? + if (animation.getByName('singRIGHTmiss') != null) + { + var oldMiss = animation.getByName('singRIGHTmiss').frames; + animation.getByName('singRIGHTmiss').frames = animation.getByName('singLEFTmiss').frames; + animation.getByName('singLEFTmiss').frames = oldMiss; + } } } diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 54f526ce2..04d6bab33 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -47,6 +47,8 @@ class ChartingState extends MusicBeatState */ var curSection:Int = 0; + public static var lastSection:Int = 0; + var bpmTxt:FlxText; var strumLine:FlxSprite; @@ -79,6 +81,8 @@ class ChartingState extends MusicBeatState override function create() { + curSection = lastSection; + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); add(gridBG); @@ -167,6 +171,18 @@ class ChartingState extends MusicBeatState trace('CHECKED!'); }; + var check_mute_inst = new FlxUICheckBox(10, 200, null, null, "Mute Instrumental (in editor)", 100); + check_mute_inst.checked = false; + check_mute_inst.callback = function() + { + var vol:Float = 1; + + if (check_mute_inst.checked) + vol = 0; + + FlxG.sound.music.volume = vol; + }; + var saveButton:FlxButton = new FlxButton(110, 8, "Save", function() { saveLevel(); @@ -217,6 +233,7 @@ class ChartingState extends MusicBeatState tab_group_song.add(UI_songTitle); tab_group_song.add(check_voices); + tab_group_song.add(check_mute_inst); tab_group_song.add(saveButton); tab_group_song.add(reloadSong); tab_group_song.add(reloadSongJson); @@ -489,12 +506,23 @@ class ChartingState extends MusicBeatState if (FlxG.keys.justPressed.ENTER) { + lastSection = curSection; + PlayState.SONG = _song; FlxG.sound.music.stop(); vocals.stop(); FlxG.switchState(new PlayState()); } + if (FlxG.keys.justPressed.E) + { + changeNoteSustain(Conductor.stepCrochet); + } + if (FlxG.keys.justPressed.Q) + { + changeNoteSustain(-Conductor.stepCrochet); + } + if (FlxG.keys.justPressed.TAB) { if (FlxG.keys.pressed.SHIFT) @@ -607,6 +635,18 @@ class ChartingState extends MusicBeatState super.update(elapsed); } + function changeNoteSustain(value:Float):Void + { + if (curSelectedNote[2] != null) + { + curSelectedNote[2] += value; + curSelectedNote[2] = Math.max(curSelectedNote[2], 0); + } + + updateNoteUI(); + updateGrid(); + } + function recalculateSteps():Int { var steps:Int = 0; @@ -675,15 +715,7 @@ class ChartingState extends MusicBeatState daNum++; } - if (FlxG.keys.pressed.CONTROL) - { - FlxG.sound.music.time = (daLength - lengthBpmBullshit()) * Conductor.stepCrochet; - } - else - { - FlxG.sound.music.time += (lengthBpmBullshit() * Conductor.stepCrochet) * sec; - } - + FlxG.sound.music.time = (daLength - lengthBpmBullshit()) * Conductor.stepCrochet; vocals.time = FlxG.sound.music.time; updateCurStep(); } diff --git a/source/PlayState.hx b/source/PlayState.hx index bef9e30db..adf543204 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -312,7 +312,7 @@ class PlayState extends MusicBeatState dad.y += 300; } - boyfriend = new Boyfriend(770, 450); + boyfriend = new Boyfriend(770, 450, SONG.player1); add(boyfriend); // REPOSITIONING PER STAGE @@ -796,8 +796,8 @@ class PlayState extends MusicBeatState iconP1.animation.curAnim.curFrame = 1; else iconP1.animation.curAnim.curFrame = 0; - - if (healthBar.percent > 80) + + if (healthBar.percent > 80) iconP2.animation.curAnim.curFrame = Std.parseInt(curStage) + 1; else iconP2.animation.curAnim.curFrame = Std.parseInt(curStage);