ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.1k stars 2.16k forks source link

Needing some help with issues on my code. #9007

Closed BlooDerg closed 2 years ago

BlooDerg commented 2 years ago

Describe your problem here.

I have coded a function thats supposed to place an animated background that will change textures as the song progresses. Nothing in the PlayState.hx code is wrong except for this 1 error i keep getting and I have no idea how to fix it. Google searches didn't help.

The code is located with the stages setup, "switch (curStage)". It will render when the stage is called by the song.

My Code:

                        case '1upbg': //Skyball goes beep boop skedop bop
                //THIS IS THE BG SHIT!!!!!!!!!!! Its so swagger bro
                var 1UPBG:FlxSprite = new FlxSprite();                                    <<This is the line the cmd has an issue with.
                1UPBG.frames = Paths.getSparrowAtlas('BGs');
                1UPBG.animation.addByPrefix('1UP', 'BG1', 24, true);
                1UPBG.animation.addByPrefix('MUTINY', 'BG2', 24, true);
                1UPBG.animation.addByPrefix('8BITS', 'BG3', 24, true);
                1UPBG.setGraphicSize(2, 2));
                1UPBG.scrollFactor.set();
                1UPBG.updateHitbox();
                1UPBG.screenCenter();
                1UPBG.animation.play('1UP');

                var Bee1:FlxSprite = new FlxSprite();                                     <<I assume the cmd will bring up an error here too.
                Bee1.frames = Paths.getSparrowAtlas('BGs');
                Bee1.animation.addByPrefix('DanceGreyLEFTA', 'BBGreyDANCE1', 24, true);
                Bee1.animation.addByPrefix('DanceGreyRIGHTA', 'BBGreyDANCE2', 24, true);
                Bee1.updateHitbox();
                Bee1.screenCenter();

                var Bee2:FlxSprite = new FlxSprite();                                    <<and also here.
                Bee2.frames = Paths.getSparrowAtlas('BGs');
                Bee2.animation.addByPrefix('DanceGreyRIGHTB', 'BBGreyDANCE1', 24, true);
                Bee2.animation.addByPrefix('DanceGreyLEFTB', 'BBGreyDANCE2', 24, true);
                Bee2.setGraphicSize(-1, 1));
                Bee1.updateHitbox();
                Bee2.screenCenter();

                Bee1.animation.play('DanceGreyLEFTA');
                Bee2.animation.play('DanceGreyRIGHTB');
                var COLOURVAL:String = "Grey";

                //SOUNDS
                precacheList.set('controller', 'sound');
                precacheList.set('rockets', 'sound');
                precacheList.set('blaster', 'sound');
                precacheList.set('crusher', 'sound');

The error provided by cmd:

C:\Users\OTFT\Desktop\FNF-PsychEngine-main>lime test windows -debug
source/PlayState.hx:800: characters 5-8 : Missing variable identifier

C:\Users\OTFT\Desktop\FNF-PsychEngine-main>

Are you modding a build from source or with Lua?

Source

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

Yes, Added a new stage, a new song "1up", a new week "Week Skyball", a new character "Skyball".

Itz-Miles commented 2 years ago

I dunno what could be causing issues. Did you declare the FlxSprite's location before attempting to add it? Sometimes, the Sprite's variable will declare the position separately. Otherwise, the variable will declare it in the same line.

Itz-Miles commented 2 years ago

since Bee1 and Bee2 aren't giving the compiler any errors, search for the earliest those words are mentioned/declared to see any differences between 1UPBG.

BlooDerg commented 2 years ago

I have no idea why, but renamming 1UPBG to UpBg fixed the issue...

BlooDerg commented 2 years ago

it might've been a cross reference issue since the stage name is also 1upbg

Itz-Miles commented 2 years ago

I didn't think of that! I've been guessing vars in haxe are case specific, but now I know otherwise.

Wither362 commented 2 years ago

WHEN DECLARING VARS, THE FIRST LETTER MUST BE A LETTER

Wither362 commented 2 years ago

WHEN DECLARING VARS, THE FIRST LETTER MUST BE A LETTER

And is better to have vars with few upper case letters