Skip to content

Commit

Permalink
New Custom Stage Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed Oct 27, 2024
1 parent e7628d1 commit 04a6bef
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
15 changes: 10 additions & 5 deletions mods/test/data/stages/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"animated": false,
"animation": "",
"voidShader": false,
"showsWhenLowQuality": true
"showsWhenLowQuality": true,
"shade": ""
},
{
"spriteName": "stageHills",
Expand All @@ -41,7 +42,8 @@
"animated": false,
"animation": "",
"voidShader": false,
"showsWhenLowQuality": false
"showsWhenLowQuality": false,
"shade": ""
},
{
"spriteName": "grassbg",
Expand All @@ -58,7 +60,8 @@
"animated": false,
"animation": "",
"voidShader": false,
"showsWhenLowQuality": false
"showsWhenLowQuality": false,
"shade": ""
},
{
"spriteName": "gate",
Expand All @@ -75,7 +78,8 @@
"animated": false,
"animation": "",
"voidShader": false,
"showsWhenLowQuality": false
"showsWhenLowQuality": false,
"shade": ""
},
{
"spriteName": "stageFront",
Expand All @@ -92,7 +96,8 @@
"animated": false,
"animation": "",
"voidShader": false,
"showsWhenLowQuality": true
"showsWhenLowQuality": true,
"shade": ""
}
]
}
20 changes: 18 additions & 2 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ typedef BackgroundJson =
var animation:String;
var voidShader:Bool;
var showsWhenLowQuality:Bool;
var shade:String;
}

typedef Settings = {
Expand Down Expand Up @@ -2461,7 +2462,7 @@ class PlayState extends MusicBeatState
}

for (i in jsonStage.backgrounds) {
createCustomBackground(i.spriteName, i.posX, i.posY, i.image, i.size, i.scrollX, i.scrollY, i.antialiasing, bgName, i.voidShader, i.updateHitBox, i.alpha, i.flying, i.animated, i.animation, i.showsWhenLowQuality);
createCustomBackground(i.spriteName, i.posX, i.posY, i.image, i.size, i.scrollX, i.scrollY, i.antialiasing, bgName, i.voidShader, i.updateHitBox, i.alpha, i.flying, i.animated, i.animation, i.showsWhenLowQuality, i.shade);
}

} else {
Expand Down Expand Up @@ -2493,7 +2494,7 @@ class PlayState extends MusicBeatState

return sprites;
}
private function createCustomBackground(spriteName:String = 'test', posX:Float = 1, posY:Float = 1, imageName:String = 'none', size:Float = 1, scrollX:Float = 1, scrollY:Float = 1, antialiasings:Bool = true, bgName:String, isVoid:Bool = false, updateHitBox:Bool = true, alphaa:Float = 1, flying:Bool = false, animated:Bool = false, animation:String = 'idle', lQ:Bool = false):Void
private function createCustomBackground(spriteName:String = 'test', posX:Float = 1, posY:Float = 1, imageName:String = 'none', size:Float = 1, scrollX:Float = 1, scrollY:Float = 1, antialiasings:Bool = true, bgName:String, isVoid:Bool = false, updateHitBox:Bool = true, alphaa:Float = 1, flying:Bool = false, animated:Bool = false, animation:String = 'idle', lQ:Bool = false, shade:String = ''):Void
{
if (FlxG.save.data.lowQ && !lQ) {
return;
Expand All @@ -2508,6 +2509,11 @@ class PlayState extends MusicBeatState
customBG.alpha = alphaa;
sprites.add(customBG);
add(customBG);
if (shade == 'dark') {
customBG.color = nightColor;
} else if (shade == 'sunset') {
customBG.color = sunsetColor;
}
if (isVoid) {
voidShader(customBG);
}
Expand All @@ -2524,6 +2530,11 @@ class PlayState extends MusicBeatState
customBG.alpha = alphaa;
sprites.add(customBG);
add(customBG);
if (shade == 'dark') {
customBG.color = nightColor;
} else if (shade == 'sunset') {
customBG.color = sunsetColor;
}
if (isVoid) {
voidShader(customBG);
}
Expand All @@ -2537,6 +2548,11 @@ class PlayState extends MusicBeatState
customBG.alpha = alphaa;
sprites.add(customBG);
add(customBG);
if (shade == 'dark') {
customBG.color = nightColor;
} else if (shade == 'sunset') {
customBG.color = sunsetColor;
}
if (isVoid) {
voidShader(customBG);
}
Expand Down

0 comments on commit 04a6bef

Please sign in to comment.