Skip to content

Commit

Permalink
Softcoding Character select and getting ready for custom characters l…
Browse files Browse the repository at this point in the history
…ast thing for today
  • Loading branch information
CamLikesKirby committed May 19, 2024
1 parent 9dfd4a1 commit 401ed81
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 4 deletions.
1 change: 1 addition & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<assets path="assets/shared" library="shared" exclude="*.ogg" if="web"/>
<assets path="assets/shared" library="shared" exclude="*.mp3" unless="web"/>
<assets path='mods' rename='mods' embed='false'/>
<assets path='skins' rename='skins' embed='false'/>
<assets path='art/readme.txt' rename='PLEASE READ.txt' />
<assets path='art/icons' rename='icons' embed='true'/>
<assets path="CHANGELOG.md" rename='changelog.txt'/>
Expand Down
130 changes: 130 additions & 0 deletions assets/preload/data/characterSelect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"characters": [
{
"newCharacter": [
{
"casename": "bf",
"thecharactername": "Boyfriend",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
},
{
"casename": "bf-pixel",
"thecharactername": "Pixel Boyfriend",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
}
],
"mainName": "bf",
"thehotemsithink": [1, 1, 1, 1]
},
{
"newCharacter": [
{
"casename": "dave",
"thecharactername": "Dave",
"thenotemsagain": [0.25, 0.25, 2, 2],
"notestyle": ""
}
],
"mainName": "dave",
"thehotemsithink": [0.25, 0.25, 2, 2]
},
{
"newCharacter": [
{
"casename": "bambi-new",
"thecharactername": "Bambi",
"thenotemsagain": [0, 0, 3, 0]
}
],
"mainName": "bambi",
"thehotemsithink": [0, 0, 3, 0]
},
{
"newCharacter": [
{
"casename": "tristan",
"thecharactername": "Tristan",
"thenotemsagain": [2, 0.5, 0.5, 0.5],
"notestyle": ""
}
],
"mainName": "tristan",
"thehotemsithink": [2, 0.5, 0.5, 0.5]
},
{
"newCharacter": [
{
"casename": "tristan-golden",
"thecharactername": "Tristan Golden",
"thenotemsagain": [0.25, 0.25, 0.25, 2],
"notestyle": ""
}
],
"mainName": "tristan-golden",
"thehotemsithink": [0.25, 0.25, 0.25, 2]
},
{
"newCharacter": [
{
"casename": "dave-angey",
"thecharactername": "3D Dave",
"thenotemsagain": [2, 2, 0.25, 0.25],
"notestyle": "3D"
},
{
"casename": "dave-festival-3d",
"thecharactername": "3D Dave Festival",
"thenotemsagain": [2, 2, 0.25, 0.25],
"notestyle": "3D"
}
],
"mainName": "dave-angey",
"thehotemsithink": [2, 2, 0.25, 0.25]
},
{
"newCharacter": [
{
"casename": "bambi-3d",
"thecharactername": "Expunged",
"thenotemsagain": [0, 3, 0, 0],
"notestyle": "3D"
}
],
"mainName": "bambi-3d",
"thehotemsithink": [0, 3, 0, 0]

},
{
"newCharacter": [
{
"casename": "shaggy",
"thecharactername": "Shaggy",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
},
{
"casename": "supershaggy",
"thecharactername": "Shaggy (0.001%)",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
},
{
"casename": "godshaggy",
"thecharactername": "Shaggy (0.002%)",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
},
{
"casename": "redshaggy",
"thecharactername": "Red Shaggy",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
}
],
"mainName": "shaggy",
"thehotemsithink": [1, 1, 1, 1]
}
]
}
16 changes: 16 additions & 0 deletions mods/test/data/characterSelect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"characters": [
{
"newCharacter": [
{
"casename": "bf-pixel",
"thecharactername": "Test",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
}
],
"mainName": "testtwo",
"thehotemsithink": [1, 1, 1, 1]
}
]
}
16 changes: 16 additions & 0 deletions skins/characterSelect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"characters": [
{
"newCharacter": [
{
"casename": "bf-pixel",
"thecharactername": "Test",
"thenotemsagain": [1, 1, 1, 1],
"notestyle": ""
}
],
"mainName": "test",
"thehotemsithink": [1, 1, 1, 1]
}
]
}
Empty file added skins/readme.txt
Empty file.
1 change: 1 addition & 0 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import flixel.FlxG;
import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames;
import haxe.Json;

using StringTools;

Expand Down
82 changes: 78 additions & 4 deletions source/CharacterSelectState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import flixel.FlxSprite;
import lime.app.Application;
import sys.FileSystem;
#end
import haxe.Json;
import haxe.format.JsonParser;

/**
hey you fun commiting people,
Expand All @@ -31,6 +33,26 @@ import sys.FileSystem;
the secondary dev, ben
*/

typedef CharacterSelectFile =
{
var characters:Array<CharSelectStuff>;
}

typedef CharSelectStuff =
{
var newCharacter:Array<TheActualChar>;
var mainName:String;
var thehotemsithink:Array<Float>;

}

typedef TheActualChar =
{
var casename:String;
var thecharactername:String;
var thenotemsagain:Array<Float>;
var notestyle:String;
}
class CharacterInSelect
{
public var name:String;
Expand Down Expand Up @@ -85,15 +107,20 @@ class CharacterSelectState extends MusicBeatState
private var camTransition:FlxCamera;

var currentSelectedCharacter:CharacterInSelect;

public var rawJson:String;
public var json:CharacterSelectFile;
public var rawJsonCustom:String;
public var jsonCustom:CharacterSelectFile;
public var rawJsonCustom2:String;
public var jsonCustom2:CharacterSelectFile;
var noteMsTexts:FlxTypedGroup<FlxText> = new FlxTypedGroup<FlxText>();

var arrows:Array<FlxSprite> = [];
var basePosition:FlxPoint;

public var characters:Array<CharacterInSelect> =
[
new CharacterInSelect('bf', [1, 1, 1, 1], [
/*new CharacterInSelect('bf', [1, 1, 1, 1], [
new CharacterForm('bf', 'Boyfriend', [1,1,1,1]),
new CharacterForm('bf-pixel', 'Pixel Boyfriend', [1,1,1,1])
]),
Expand Down Expand Up @@ -121,6 +148,7 @@ class CharacterSelectState extends MusicBeatState
new CharacterForm('godshaggy', 'Shaggy (0.002%)', [1, 1, 1, 1]),
new CharacterForm('redshaggy', 'Red Shaggy', [1, 1, 1, 1]),
]),
*/
];
#if SHADERS_ENABLED
var bgShader:Shaders.GlitchEffect;
Expand All @@ -144,7 +172,55 @@ class CharacterSelectState extends MusicBeatState
wasInFullscreen = true;
}
}
rawJson = File.getContent(Paths.json('characterSelect'));
json = cast Json.parse(rawJson);
rawJsonCustom = File.getContent(('Skins/characterSelect.json'));
jsonCustom = cast Json.parse(rawJsonCustom);
if (FileSystem.exists(TitleState.modFolder + '/data/characterSelect.json')) {
rawJsonCustom2 = File.getContent((TitleState.modFolder + '/data/characterSelect.json'));
jsonCustom2 = cast Json.parse(rawJsonCustom2);
}

var characterInSelectArray:Array<CharacterInSelect> = [];

for (character in json.characters) { // Normal
var mainName:String = character.mainName;
var thehotemsithink:Array<Float> = character.thehotemsithink;

var newCharacterForms:Array<CharacterForm> = [];
for (newChar in character.newCharacter) {
newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle));
}

characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms));
}

for (character in jsonCustom.characters) { // For Globle Characters
var mainName:String = character.mainName;
var thehotemsithink:Array<Float> = character.thehotemsithink;

var newCharacterForms:Array<CharacterForm> = [];
for (newChar in character.newCharacter) {
newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle));
}

characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms));
}
if (FileSystem.exists(TitleState.modFolder + '/data/characterSelect.json')) {
for (character in jsonCustom2.characters) { // For Characters in Mod Packs
var mainName:String = character.mainName;
var thehotemsithink:Array<Float> = character.thehotemsithink;

var newCharacterForms:Array<CharacterForm> = [];
for (newChar in character.newCharacter) {
newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle));
}

characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms));
}
}

trace(characters);
Conductor.changeBPM(110);

camGame = new FlxCamera();
Expand Down Expand Up @@ -505,7 +581,6 @@ class CharacterSelectState extends MusicBeatState
UpdateBF();
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
}
#if debug
if (FlxG.keys.justPressed.R && !selectedCharacter)
{
reset();
Expand All @@ -522,7 +597,6 @@ class CharacterSelectState extends MusicBeatState
}
}
}
#end
}
public static function unlockCharacter(character:String)
{
Expand Down

0 comments on commit 401ed81

Please sign in to comment.