Sync story mode menu to the beat
This commit is contained in:
parent
388c6215c7
commit
c23f9738e3
@ -1,6 +1,7 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
|
import flixel.FlxG;
|
||||||
import flixel.graphics.frames.FlxAtlasFrames;
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
|
|
||||||
class CharacterSetting
|
class CharacterSetting
|
||||||
@ -33,6 +34,10 @@ class MenuCharacter extends FlxSprite
|
|||||||
];
|
];
|
||||||
|
|
||||||
private var flipped:Bool = false;
|
private var flipped:Bool = false;
|
||||||
|
//questionable variable name lmfao
|
||||||
|
private var goesLeftNRight:Bool = false;
|
||||||
|
private var danceLeft:Bool = false;
|
||||||
|
private var character:String = '';
|
||||||
|
|
||||||
public function new(x:Int, y:Int, scale:Float, flipped:Bool)
|
public function new(x:Int, y:Int, scale:Float, flipped:Bool)
|
||||||
{
|
{
|
||||||
@ -43,15 +48,17 @@ class MenuCharacter extends FlxSprite
|
|||||||
|
|
||||||
frames = Paths.getSparrowAtlas('campaign_menu_UI_characters');
|
frames = Paths.getSparrowAtlas('campaign_menu_UI_characters');
|
||||||
|
|
||||||
animation.addByPrefix('bf', "BF idle dance white", 24);
|
animation.addByPrefix('bf', "BF idle dance white", 24, false);
|
||||||
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
||||||
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
|
animation.addByIndices('gf-left', 'GF Dancing Beat WHITE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||||
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
|
animation.addByIndices('gf-right', 'GF Dancing Beat WHITE', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||||
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
|
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24, false);
|
||||||
animation.addByPrefix('pico', "Pico Idle Dance", 24);
|
animation.addByIndices('spooky-left', 'spooky dance idle BLACK LINES', [0, 2, 6], "", 12, false);
|
||||||
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
|
animation.addByIndices('spooky-right', 'spooky dance idle BLACK LINES', [8, 10, 12, 14], "", 12, false);
|
||||||
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
|
animation.addByPrefix('pico', "Pico Idle Dance", 24, false);
|
||||||
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
|
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24, false);
|
||||||
|
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24, false);
|
||||||
|
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24, false);
|
||||||
|
|
||||||
setGraphicSize(Std.int(width * scale));
|
setGraphicSize(Std.int(width * scale));
|
||||||
updateHitbox();
|
updateHitbox();
|
||||||
@ -59,6 +66,8 @@ class MenuCharacter extends FlxSprite
|
|||||||
|
|
||||||
public function setCharacter(character:String):Void
|
public function setCharacter(character:String):Void
|
||||||
{
|
{
|
||||||
|
var sameCharacter:Bool = character == this.character;
|
||||||
|
this.character = character;
|
||||||
if (character == '')
|
if (character == '')
|
||||||
{
|
{
|
||||||
visible = false;
|
visible = false;
|
||||||
@ -69,11 +78,31 @@ class MenuCharacter extends FlxSprite
|
|||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
animation.play(character);
|
if (!sameCharacter) {
|
||||||
|
bopHead(true);
|
||||||
|
}
|
||||||
|
|
||||||
var setting:CharacterSetting = settings[character];
|
var setting:CharacterSetting = settings[character];
|
||||||
offset.set(setting.x, setting.y);
|
offset.set(setting.x, setting.y);
|
||||||
setGraphicSize(Std.int(width * setting.scale));
|
setGraphicSize(Std.int(width * setting.scale));
|
||||||
flipX = setting.flipped != flipped;
|
flipX = setting.flipped != flipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function bopHead(LastFrame:Bool = false):Void
|
||||||
|
{
|
||||||
|
if (character == 'gf' || character == 'spooky') {
|
||||||
|
danceLeft = !danceLeft;
|
||||||
|
|
||||||
|
if (danceLeft)
|
||||||
|
animation.play(character + "-left", true);
|
||||||
|
else
|
||||||
|
animation.play(character + "-right", true);
|
||||||
|
} else {
|
||||||
|
//no spooky nor girlfriend so we do da normal animation
|
||||||
|
animation.play(character, true);
|
||||||
|
}
|
||||||
|
if (LastFrame) {
|
||||||
|
animation.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,6 +323,9 @@ class StoryMenuState extends MusicBeatState
|
|||||||
FlxG.switchState(new MainMenuState());
|
FlxG.switchState(new MainMenuState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FlxG.sound.music != null)
|
||||||
|
Conductor.songPosition = FlxG.sound.music.time;
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,4 +477,13 @@ class StoryMenuState extends MusicBeatState
|
|||||||
FlxG.save.data.weekUnlocked = weekUnlocked.length - 1;
|
FlxG.save.data.weekUnlocked = weekUnlocked.length - 1;
|
||||||
FlxG.save.flush();
|
FlxG.save.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override function beatHit()
|
||||||
|
{
|
||||||
|
super.beatHit();
|
||||||
|
|
||||||
|
grpWeekCharacters.members[0].bopHead();
|
||||||
|
grpWeekCharacters.members[1].bopHead();
|
||||||
|
grpWeekCharacters.members[2].bopHead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user