Skip to content

Commit

Permalink
FINALLY CUSTOM STAGES
Browse files Browse the repository at this point in the history
gonna add more stuff though
  • Loading branch information
CamLikesKirby committed Jun 20, 2024
1 parent d2d001a commit 2a26845
Show file tree
Hide file tree
Showing 16 changed files with 194 additions and 66 deletions.
61 changes: 61 additions & 0 deletions mods/test/data/stages/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"bgZoom": 0.7,
"bfPosX": 843,
"bfPosY": 270,
"dadPosX": 50,
"dadPosY": 270,
"gfPosX": 300,
"gfPosY": -60,
"backgrounds": [
{
"spriteName": "bg",
"posX": -600,
"posY": -300,
"image": "sky",
"size": 1,
"scrollX": 0.6,
"scrollY": 0.6,
"antialiasing": true
},
{
"spriteName": "stageHills",
"posX": -834,
"posY": -159,
"image": "hills",
"size": 1,
"scrollX": 0.7,
"scrollY": 0.7,
"antialiasing": true
},
{
"spriteName": "grassbg",
"posX": -1205,
"posY": 580,
"image": "grass bg",
"size": 1,
"scrollX": 1,
"scrollY": 1,
"antialiasing": true
},
{
"spriteName": "gate",
"posX": -755,
"posY": 250,
"image": "gate",
"size": 1,
"scrollX": 1,
"scrollY": 1,
"antialiasing": true
},
{
"spriteName": "stageFront",
"posX": -832,
"posY": 505,
"image": "grass",
"size": 1,
"scrollX": 1,
"scrollY": 1,
"antialiasing": true
}
]
}
Binary file added mods/test/images/stages/test/gate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mods/test/images/stages/test/grass bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mods/test/images/stages/test/grass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mods/test/images/stages/test/hills.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file added mods/test/images/stages/test/sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion source/BGSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BGSprite extends FlxSprite
{
public var spriteName:String;
var customPath:String;
public function new(spriteName:String, posX:Float, posY:Float, path:String = '', animations:Array<Animation>, scrollX:Float = 1, scrollY:Float = 1, antialiasing:Bool = true, active:Bool = false)
public function new(spriteName:String, posX:Float, posY:Float, path:String = '', animations:Array<Animation>, scrollX:Float = 1, scrollY:Float = 1, antialiasing:Bool = true, active:Bool = false, custom:Bool = false)
{
super(posX, posY);

Expand All @@ -24,7 +24,11 @@ class BGSprite extends FlxSprite
{
if (hasAnimations)
{
if (custom) {
frames = Paths.getCustomSparrowAtlas(path);
} else {
frames = Paths.getSparrowAtlas(path);
}
for (i in 0...animations.length)
{
var curAnim = animations[i];
Expand All @@ -45,12 +49,16 @@ class BGSprite extends FlxSprite
{
//trace(TitleState.modFolder + '/' + customPath);
//trace(path);
if (custom) {
loadGraphic(Paths.customImage(path));
} else {
if (FileSystem.exists(TitleState.modFolder + '/' + customPath)) {
loadGraphic((FlxGraphic.fromBitmapData(BitmapData.fromFile(TitleState.modFolder + '/' + customPath))));
} else {
loadGraphic(path);
}
}
}
}
this.antialiasing = antialiasing;
scrollFactor.set(scrollX, scrollY);
Expand Down
1 change: 1 addition & 0 deletions source/CharacterSelectState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class CharacterSelectState extends MusicBeatState
var mainName:String = character.mainName;
var thehotemsithink:Array<Float> = character.mainnotems;


var newCharacterForms:Array<CharacterForm> = [];
for (newChar in character.newCharacter) {
newCharacterForms.push(new CharacterForm(newChar.playername, newChar.thecharactername, newChar.thenotems, newChar.notestyle));
Expand Down
3 changes: 3 additions & 0 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,13 @@ class FreeplayState extends MusicBeatState
for (i in 0...iconArray.length)
{
iconArray[i].alpha = 0.6;
iconArray[i].changeState('normal');
}

iconArray[curSelected].alpha = 1;

iconArray[curSelected].changeState('winning');

for (item in grpSongs.members)
{
item.targetY = bullShit - curSelected;
Expand Down
42 changes: 34 additions & 8 deletions source/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class HealthIcon extends FlxSprite
var char:String;
var state:String;
public var isPlayer:Bool;
var winningIcon:Bool;

public function new(char:String = 'bf', isPlayer:Bool = false)
{
Expand All @@ -37,28 +38,45 @@ class HealthIcon extends FlxSprite
{
if (this.char != char)
{
var file:Dynamic = '';

if (char != "none") {
if (FileSystem.exists('assets/images/ui/iconGrid/' + char + '.png')) {
if (FileSystem.exists(TitleState.modFolder + '/assets/images/ui/iconGrid/' + char + '.png')) {
loadGraphic(Paths.customImage(TitleState.modFolder + '/assets/images/ui/iconGrid/' + char), true, 150, 150);
//trace('found');
file = Paths.customImage(TitleState.modFolder + '/assets/images/ui/iconGrid/' + char);
} else {
loadGraphic(FlxGraphic.fromBitmapData(BitmapData.fromFile(Paths.image('ui/iconGrid/' + char, 'preload'))), true, 150, 150);
file = FlxGraphic.fromBitmapData(BitmapData.fromFile(Paths.image('ui/iconGrid/' + char, 'preload')));
}
} else if (FileSystem.exists('mods/global characters/images/icons/' + char + '.png')) {
loadGraphic(Paths.customImage('mods/global characters/images/icons/' + char), true, 150, 150);
file = Paths.customImage('mods/global characters/images/icons/' + char);
} else if (FileSystem.exists(TitleState.modFolder + '/images/icons/' + char + '.png')) {
loadGraphic(Paths.customImage(TitleState.modFolder + '/images/icons/' + char), true, 150, 150);
file = Paths.customImage(TitleState.modFolder + '/images/icons/' + char);
} else {
loadGraphic(Paths.image('blank', 'shared'));
file = Paths.image('blank', 'shared');
}
} else {
loadGraphic(Paths.image('blank', 'shared'));
file = Paths.image('blank', 'shared');
}


loadGraphic(file);
if (width == 450) {
loadGraphic(file, true, Math.floor(width / 3), 150);
winningIcon = true;
} else {
loadGraphic(file, true, 150, 150);
}

if (char != "none")
{
antialiasing = !noAaChars.contains(char);
animation.add(char, [0, 1], 0, false, isPlayer);
//trace('Graphic width before setting: ' + width);
if (winningIcon) {
//trace('winning :) added');
animation.add(char, [0, 1, 2], 0, false, isPlayer);
} else {
animation.add(char, [0, 1], 0, false, isPlayer);
}
animation.play(char);
}
}
Expand All @@ -74,12 +92,20 @@ class HealthIcon extends FlxSprite
}
public function changeState(charState:String)
{
//trace('Graphic width before setting: ' + width);
switch (charState)
{
case 'normal':
animation.curAnim.curFrame = 0;
case 'losing':
animation.curAnim.curFrame = 1;
case 'winning':
if (winningIcon) {
//trace('winning :)');
animation.curAnim.curFrame = 2;
} else {
animation.curAnim.curFrame = 0;
}
}
state = charState;
}
Expand Down
1 change: 1 addition & 0 deletions source/ModSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ menuItems.push(new ModOption('Exit'));
if(FlxG.sound.music != null)
FlxG.sound.music.stop();
TitleState.initialized = false;
TitleState.onlyforabug = false;
FlxG.switchState(new StartStateSelector());
}
}
Expand Down
20 changes: 12 additions & 8 deletions source/MusicPlayerState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,18 @@ class MusicPlayerState extends MusicBeatState
}

if (healthBar.percent < 20)
iconP1.changeState('losing');
else
iconP1.changeState('normal');

if (healthBar.percent > 80)
iconP2.changeState('losing');
else
iconP2.changeState('normal');
iconP1.changeState('losing');
else if (healthBar.percent > 80)
iconP1.changeState('winning');
else
iconP1.changeState('normal');

if (healthBar.percent > 80)
iconP2.changeState('losing');
else if (healthBar.percent < 20)
iconP2.changeState('winning');
else
iconP2.changeState('normal');

if (upP)
{
Expand Down
29 changes: 8 additions & 21 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,7 @@ class Note extends FlxSprite
antialiasing = noteStyle != '3D';

case 'shape':
if (!isSustainNote)
{
frames = Paths.getSparrowAtlas(notePathLol, 'shared');
}
else
{
frames = Paths.getSparrowAtlas('notes/NOTE_assets_3D', 'shared');
}
frames = Paths.getSparrowAtlas(notePathLol, 'shared');

animation.addByPrefix('greenScroll', 'green0');
animation.addByPrefix('redScroll', 'red0');
Expand All @@ -267,24 +260,18 @@ class Note extends FlxSprite
animation.addByPrefix('darkScroll', 'dark0');


animation.addByPrefix('purpleholdend', 'pruple end hold');
animation.addByPrefix('greenholdend', 'green hold end');
animation.addByPrefix('redholdend', 'red hold end');
animation.addByPrefix('blueholdend', 'blue hold end');
animation.addByPrefix('whiteholdend', 'white hold end');
animation.addByPrefix('yellowholdend', 'yellow hold end');
animation.addByPrefix('violetholdend', 'violet hold end');
animation.addByPrefix('blackholdend', 'black hold end');
animation.addByPrefix('darkholdend', 'dark hold end');
animation.addByPrefix('purpleholdend', 'purple hold piece');
animation.addByPrefix('greenholdend', 'green hold piece');
animation.addByPrefix('redholdend', 'red hold piece');
animation.addByPrefix('blueholdend', 'blue hold piece');
animation.addByPrefix('yellowholdend', 'yellow hold piece');
animation.addByPrefix('darkholdend', 'dark hold piece');

animation.addByPrefix('purplehold', 'purple hold piece');
animation.addByPrefix('greenhold', 'green hold piece');
animation.addByPrefix('redhold', 'red hold piece');
animation.addByPrefix('bluehold', 'blue hold piece');
animation.addByPrefix('whitehold', 'white hold piece');
animation.addByPrefix('yellowhold', 'yellow hold piece');
animation.addByPrefix('violethold', 'violet hold piece');
animation.addByPrefix('blackhold', 'black hold piece');
animation.addByPrefix('darkhold', 'dark hold piece');

setGraphicSize(Std.int(width * noteSize));
Expand Down Expand Up @@ -574,7 +561,7 @@ class Note extends FlxSprite
// prevNote.scale.y *= (Conductor.stepCrochet / 100) * PlayState.SONG.speed * 0.75;
// prevNote.scale.x *= (Conductor.stepCrochet / 100) * PlayState.SONG.speed * 0.5;
prevNote.offset.y += prevNote.height / 3;
if (animation.exists(notesArray[noteData % Main.keyAmmo[mania]] + 'holdend') && animation.curAnim.name == notesArray[noteData % Main.keyAmmo[mania]] + 'holdend') {
if (noteStyle != 'shape' && animation.exists(notesArray[noteData % Main.keyAmmo[mania]] + 'holdend') && animation.curAnim.name == notesArray[noteData % Main.keyAmmo[mania]] + 'holdend') {
prevNote.scale.y = 0.7 + Conductor.stepCrochet / 100 + 0.75 + PlayState.SONG.speed + noteSpeed + (0.7 / noteSize);
prevNote.offset.y = 10;
}
Expand Down
Loading

0 comments on commit 2a26845

Please sign in to comment.