abstract shit for brandy

This commit is contained in:
Cameron Taylor 2020-10-30 17:09:33 -07:00
parent f964f69a40
commit c36e13722e
3 changed files with 79 additions and 3 deletions

View file

@ -11,6 +11,7 @@ import flixel.input.gamepad.FlxGamepadButton;
import flixel.input.gamepad.FlxGamepadInputID;
import flixel.input.keyboard.FlxKey;
#if (haxe >= "4.0.0")
enum abstract Action(String) to String from String
{
var UP = "up";
@ -30,6 +31,28 @@ enum abstract Action(String) to String from String
var PAUSE = "pause";
var RESET = "reset";
}
#else
@:enum
abstract Action(String) to String from String
{
var UP = "up";
var LEFT = "left";
var RIGHT = "right";
var DOWN = "down";
var UP_P = "up-press";
var LEFT_P = "left-press";
var RIGHT_P = "right-press";
var DOWN_P = "down-press";
var UP_R = "up-release";
var LEFT_R = "left-release";
var RIGHT_R = "right-release";
var DOWN_R = "down-release";
var ACCEPT = "accept";
var BACK = "back";
var PAUSE = "pause";
var RESET = "reset";
}
#end
enum Device
{

27
source/MenuCharacter.hx Normal file
View file

@ -0,0 +1,27 @@
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class MenuCharacter extends FlxSprite
{
public var character:String;
public function new(x:Float, character:String = 'bf')
{
super(x);
this.character = character;
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_characters__png, AssetPaths.campaign_menu_UI_characters__xml);
frames = tex;
animation.addByPrefix('bf', "BF idle dance white", 24);
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
animation.play(character);
updateHitbox();
}
}

View file

@ -15,12 +15,13 @@ class StoryMenuState extends MusicBeatState
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']];
var weekUnlocked:Array<Bool> = [true, false];
var weekCharacters:Array<Dynamic> = [['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']];
var curWeek:Int = 0;
var txtTracklist:FlxText;
var grpWeekText:FlxTypedGroup<MenuItem>;
var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
var grpLocks:FlxTypedGroup<FlxSprite>;
@ -30,14 +31,12 @@ class StoryMenuState extends MusicBeatState
{
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
scoreText.setFormat("VCR OSD Mono", 32);
add(scoreText);
var rankText:FlxText = new FlxText(0, 10);
rankText.text = 'RANK: GREAT';
rankText.setFormat("assets/fonts/vcr.ttf", 32);
rankText.size = scoreText.size;
rankText.screenCenter(X);
add(rankText);
var ui_tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
@ -45,6 +44,8 @@ class StoryMenuState extends MusicBeatState
grpWeekText = new FlxTypedGroup<MenuItem>();
add(grpWeekText);
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
grpLocks = new FlxTypedGroup<FlxSprite>();
add(grpLocks);
@ -76,6 +77,28 @@ class StoryMenuState extends MusicBeatState
}
}
for (char in 0...3)
{
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[curWeek][char]);
weekCharacterThing.y += 70;
weekCharacterThing.antialiasing = true;
switch (weekCharacterThing.character)
{
case 'dad':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
weekCharacterThing.updateHitbox();
case 'bf':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
weekCharacterThing.updateHitbox();
case 'gf':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
weekCharacterThing.updateHitbox();
}
grpWeekCharacters.add(weekCharacterThing);
}
difficultySelectors = new FlxGroup();
add(difficultySelectors);
@ -100,12 +123,15 @@ class StoryMenuState extends MusicBeatState
difficultySelectors.add(rightArrow);
add(yellowBG);
add(grpWeekCharacters);
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
txtTracklist.alignment = CENTER;
txtTracklist.font = rankText.font;
txtTracklist.color = 0xFFe55777;
add(txtTracklist);
add(rankText);
add(scoreText);
updateText();