Skip to content

Commit

Permalink
fix change stage layering on new flixel version
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed May 5, 2024
1 parent 0e3501b commit 76dd173
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
21 changes: 13 additions & 8 deletions assets/preload/data/events/changeStage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function changeStage(stageName)

stage.visible = true;
stage.active = true;

// Setup the layers crap
stage.__existsAddToLayer("bf", State.boyfriendGroup);
stage.__existsAddToLayer("dad", State.dadGroup);
stage.__existsAddToLayer("gf", State.gfGroup);

stage.applyData(State.boyfriend, State.dad, State.gf);
repositionChar(State.boyfriend, 770, 450);
Expand Down Expand Up @@ -66,10 +71,15 @@ function createPost() {
var initLevel = Paths.currentLevel; // Get the stage assets folder
var initStage = State.stage; // Needed so the script functions work correctly

for (event in State.notesGroup.events) {
if (event.name == "changeStage") {
for (event in State.notesGroup.events)
{
if (event.name == "changeStage")
{
var stage = event.values[0];
if (cachedStages.exists(stage)) continue; // Stage is already cached

// Check if stage is already cached
if (cachedStages.exists(stage))
continue;

var stageData = Stage.getJson(stage);
Paths.currentLevel = stageData.library;
Expand All @@ -78,11 +88,6 @@ function createPost() {
var stageObject = Stage.fromJson(stageData, stageScript);
State.stage = stageObject;

// Setup the layers crap
stageObject.__existsAddToLayer("bf", State.boyfriendGroup);
stageObject.__existsAddToLayer("dad", State.dadGroup);
stageObject.__existsAddToLayer("gf", State.gfGroup);

if (stageScript != null) {
stageScript.set("ScriptStage", stageObject);
stageScript.safeCall("create");
Expand Down
7 changes: 3 additions & 4 deletions assets/preload/data/stages/school.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ function createPost()
for (i in 0...4) {
var freak = new FunkinSprite("", [i * 500, 425], [0.95, 0.95]);

switch (i) {
case 0: freak.y += 25;
case 3: freak.y += 25;
}
if ((i == 0) || (i == 3))
freak.y += 25;

freak.loadImage(freaksPath, false, null, null, 0);
freak.antialiasing = false;
freak.setScale(6, false);

freak.addAnim('danceLeft', freaksAnim, 24, false, CoolUtil.numberArray(14));
Expand Down

0 comments on commit 76dd173

Please sign in to comment.