Skip to content

Commit

Permalink
Custom Character stuff
Browse files Browse the repository at this point in the history
I'm not doing events anymore so now I'm remastering the results screen
  • Loading branch information
CamLikesKirby committed Jun 21, 2024
1 parent 9552f77 commit 8299ce9
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 70 deletions.
1 change: 1 addition & 0 deletions mods/global characters/characters/bfexample.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"blue": 209
},
"antialiasing": true,
"iconAntialiasing": true,
"nativelyPlayable": true,
"flipX": true,
"updateHitbox": false,
Expand Down
3 changes: 2 additions & 1 deletion mods/test/data/characters/Example.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"green": 215,
"blue": 0
},
"antialiasing": true,
"antialiasing": false,
"iconAntialiasing": false,
"nativelyPlayable": true,
"flipX": true,
"updateHitbox": true,
Expand Down
Binary file added mods/test/images/credits/socialMedia/custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 41 additions & 67 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef CharacterFile =
var skins:Array<SkinSet>;
var barcolor:RGB;
var antialiasing:Bool;
var iconAntialiasing:Bool;
var nativelyPlayable:Bool;
var flipX:Bool;
var updateHitbox:Bool;
Expand Down Expand Up @@ -1186,12 +1187,21 @@ class Character extends FlxSprite
playAnim('firstDeath');

default:
var customPath:String = '';
var customPath2:String = '';
if (FileSystem.exists(TitleState.modFolder + '/data/characters/${curCharacter}.json')) {
customPath = TitleState.modFolder + '/data/characters/${curCharacter}.json';
customPath2 = TitleState.modFolder + '/images/characters/' + curCharacter;
} else if (FileSystem.exists('mods/global characters/characters/${curCharacter}.json')) {
customPath = 'mods/global characters/characters/${curCharacter}.json';
customPath2 = 'mods/global characters/images/' + curCharacter;
}

rawJsonCustom = File.getContent((TitleState.modFolder + '/data/characters/${curCharacter}.json'));
if (customPath != '' && customPath2 != '') {
rawJsonCustom = File.getContent(customPath);
jsonCustom = cast Json.parse(rawJsonCustom);

frames = Paths.getCustomSparrowAtlas(TitleState.modFolder + '/images/characters/' + curCharacter);
frames = Paths.getCustomSparrowAtlas(customPath2);

for (i in jsonCustom.animations) {
animation.addByPrefix(i.animName, i.anim, i.fps, i.loop);
Expand Down Expand Up @@ -1226,14 +1236,36 @@ class Character extends FlxSprite
if (jsonCustom.effect != '')
{
var funnyeffect = jsonCustom.effect;
if (funnyeffect == '3dfloat' && !PlayState.funnyFloatyBoys.contains(curCharacter )&& !Note.CharactersWith3D.contains(curCharacter)) {
if (funnyeffect == '3dfloat' && !PlayState.funnyFloatyBoys.contains(curCharacter) && !Note.CharactersWith3D.contains(curCharacter)) {
PlayState.funnyFloatyBoys.push(curCharacter);
Note.CharactersWith3D.push(curCharacter);
if (PlayState.floatyBoysMod.contains(curCharacter)) {
PlayState.floatyBoysMod.remove(curCharacter);
}
if (PlayState.threedBoysMod.contains(curCharacter)) {
PlayState.threedBoysMod.remove(curCharacter);
}
} else if (funnyeffect == 'float' && !PlayState.floatyBoysMod.contains(curCharacter)) {
PlayState.floatyBoysMod.push(curCharacter);

if (PlayState.funnyFloatyBoys.contains(curCharacter)) {
PlayState.funnyFloatyBoys.remove(curCharacter);
Note.CharactersWith3D.remove(curCharacter);
}
if (PlayState.threedBoysMod.contains(curCharacter)) {
PlayState.threedBoysMod.remove(curCharacter);
Note.CharactersWith3D.remove(curCharacter);
}
} else if (funnyeffect == '3d' && !PlayState.threedBoysMod.contains(curCharacter) && !Note.CharactersWith3D.contains(curCharacter)) {
PlayState.threedBoysMod.push(curCharacter);
Note.CharactersWith3D.push(curCharacter);

if (PlayState.funnyFloatyBoys.contains(curCharacter)) {
PlayState.funnyFloatyBoys.remove(curCharacter);
}
if (PlayState.floatyBoysMod.contains(curCharacter)) {
PlayState.floatyBoysMod.remove(curCharacter);
}
}
}

Expand All @@ -1246,78 +1278,20 @@ class Character extends FlxSprite

antialiasing = jsonCustom.antialiasing;



flipX = jsonCustom.flipX;

playAnim('idle');
} else if (FileSystem.exists('mods/global characters/characters/${curCharacter}.json')) {

rawJsonCustom = File.getContent(('mods/global characters/characters/${curCharacter}.json'));
jsonCustom = cast Json.parse(rawJsonCustom);

frames = Paths.getCustomSparrowAtlas('mods/global characters/images/' + curCharacter);

for (i in jsonCustom.animations) {
animation.addByPrefix(i.animName, i.anim, i.fps, i.loop);
if (!jsonCustom.iconAntialiasing) {
HealthIcon.noAaChars.push(curCharacter);
} else {
if (HealthIcon.noAaChars.contains(curCharacter)) {
HealthIcon.noAaChars.remove(curCharacter);
}

if (!jsonCustom.isPlayable) {
loadSkinOffsetFile(curCharacter);
} else {
loadSkinOffsetFile(curCharacter + (isPlayer ? '-playable' : ''));
}

globalOffset = jsonCustom.globalOffset;

for (i in jsonCustom.skins) {
skins.set(i.type, i.replacement);
}

barColor = FlxColor.fromRGB(jsonCustom.barcolor.red, jsonCustom.barcolor.green, jsonCustom.barcolor.blue);

if (jsonCustom.setGraphicSize != '')
{
var thing = jsonCustom.setGraphicSize;
if (thing == 'furiosityScale') {
setGraphicSize(Std.int((width * 1.3) / furiosityScale));
} else if (thing == 'daPixelZoom') {
setGraphicSize(Std.int(width * PlayState.daPixelZoom));
}else {
setGraphicSize(Std.int(width * Std.parseInt(thing)));
}
}

if (jsonCustom.effect != '')
{
var funnyeffect = jsonCustom.effect;
if (funnyeffect == '3dfloat' && !PlayState.funnyFloatyBoys.contains(curCharacter )&& !Note.CharactersWith3D.contains(curCharacter)) {
PlayState.funnyFloatyBoys.push(curCharacter);
Note.CharactersWith3D.push(curCharacter);
} else if (funnyeffect == 'float' && !PlayState.floatyBoysMod.contains(curCharacter)) {
PlayState.floatyBoysMod.push(curCharacter);
} else if (funnyeffect == '3d' && !PlayState.threedBoysMod.contains(curCharacter) && !Note.CharactersWith3D.contains(curCharacter)) {
PlayState.threedBoysMod.push(curCharacter);
Note.CharactersWith3D.push(curCharacter);
}
}



if (jsonCustom.updateHitbox)
{
updateHitbox();
}

nativelyPlayable = jsonCustom.nativelyPlayable;

antialiasing = jsonCustom.antialiasing;



flipX = jsonCustom.flipX;

playAnim('idle');


} else {

Expand Down
3 changes: 2 additions & 1 deletion source/CreditsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
for (i in 0...selectedPerson.socialMedia.length)
{
var social:Social = selectedPerson.socialMedia[i];
var socialGraphic:FlxSprite = new FlxSprite(0, credits.y + 100 + (i * 100)).loadGraphic(Paths.image('credits/socialMedia/' + social.socialMediaName));
var imageSocial:Dynamic = FileSystem.exists(Paths.image('credits/socialMedia/' + social.socialMediaName)) ? Paths.image('credits/socialMedia/' + social.socialMediaName) : Paths.customImage(TitleState.modFolder + '/images/credits/socialMedia/' + social.socialMediaName);
var socialGraphic:FlxSprite = new FlxSprite(0, credits.y + 100 + (i * 100)).loadGraphic(imageSocial);
var discordText:FlxText = null;
socialGraphic.updateHitbox();
socialGraphic.screenCenter(X);
Expand Down
6 changes: 6 additions & 0 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ class FreeplayState extends MusicBeatState
awaitingExploitation = (FlxG.save.data.exploitationState == 'awaiting');
showCharText = FlxG.save.data.wasInCharSelect;

if (FlxG.sound.music != null)
{
if (!FlxG.sound.music.playing)
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}

if (awaitingExploitation)
{
bg = new FlxSprite(-600, -200).loadGraphic(Paths.image('backgrounds/void/redsky', 'shared'));
Expand Down
2 changes: 1 addition & 1 deletion source/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class HealthIcon extends FlxSprite
{
public var sprTracker:FlxSprite;

public var noAaChars:Array<String> = [
public static var noAaChars:Array<String> = [
'dave-angey',
'bambi-3d',
'bf-pixel',
Expand Down
12 changes: 12 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ typedef Settings = {
var recursedEffect:Bool;
}

/*typedef EventJson =
{
var events:Array<StepJson>;
}
typedef StepJson =
{
var curStep:Int;
var event:String;
var vaule:String;
} */

class PlayState extends MusicBeatState
{
public static var mania:Int = 0;
Expand Down

0 comments on commit 8299ce9

Please sign in to comment.