Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i make a animated freeplay background? #13040

Closed
jack-dutchie opened this issue Aug 8, 2023 · 33 comments
Closed

How do i make a animated freeplay background? #13040

jack-dutchie opened this issue Aug 8, 2023 · 33 comments
Labels
help wanted Extra attention is needed

Comments

@jack-dutchie
Copy link

Describe your problem here.

so i wanted to make a animated freeplay background but i dont know how to make that so i need help

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

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

No

@jack-dutchie jack-dutchie added the help wanted Extra attention is needed label Aug 8, 2023
@Chidubemmo
Copy link

Chidubemmo commented Aug 10, 2023

You can't . You have to use source. As far as I know Lua is usable only inside levels

@jack-dutchie
Copy link
Author

You can't . You have to use source. As far as I know Lua is usable only inside levels

then how do i do it in source?

@Chidubemmo
Copy link

  1. Make the background in animate/flash
  2. Export it as a spritesheet.
  3. Go inside FreeplayState.hx
  4. Around line 110 you should find this line of code bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));, replace it with
bg.frames = Paths.getSparrowAtlas('filepath of the bg');
bg.animation.addbyPrefix('a name for the animation', 'name on xml', framerate, true);

@jack-dutchie
Copy link
Author

  1. Make the background in animate/flash
  2. Export it as a spritesheet.
  3. Go inside FreeplayState.hx
  4. Around line 110 you should find this line of code bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));, replace it with
bg.frames = Paths.getSparrowAtlas('filepath of the bg');
bg.animation.addbyPrefix('a name for the animation', 'name on xml', framerate, true);

how do i get source?

@Chidubemmo
Copy link

Chidubemmo commented Aug 11, 2023

Download it here,
Install VS Code and follow the instrunction in the readme.md file.
After installing and editing the source code open the build_x64.bat or if you don't have a windows computer use 'lime build mac' or 'lime build linux' on the command prompt/powershell

@jack-dutchie
Copy link
Author

jack-dutchie commented Aug 11, 2023

Download it here, Install VS Code and follow the instrunction in the readme.md file. After installing and editing the source code open the build_x64.bat or if you don't have a windows computer use 'lime build mac' or 'lime build linux' on the command prompt/powershell

ok so uh how do i use the file path of the bg

in the
bg.frames = Paths.getSparrowAtlas('filepath of the bg');
bg.animation.addbyPrefix('a name for the animation', 'name on xml', framerate, true);

@Chidubemmo
Copy link

just replace 'filepath of the bg' with the name of the spritesheet, it should be shared/images

@jack-dutchie
Copy link
Author

just replace 'filepath of the bg' with the name of the spritesheet, it should be shared/images

is there any vids that could also help me

@Chidubemmo
Copy link

Do you have the animated spritesheet?

@jack-dutchie
Copy link
Author

Do you have the animated spritesheet?

yes

@Chidubemmo
Copy link

did you put it in the images subfolder inside the shared folder ?

@jack-dutchie
Copy link
Author

jack-dutchie commented Aug 11, 2023

did you put it in the images subfolder inside the shared folder ?

in the assets/images
i didnt know where else

@Chidubemmo
Copy link

if you name the bg for example 'stupid_bg' you should use
bg.frames = Paths.getSparrowAtlas('stupid_bg');
I hope you understand now

@jack-dutchie
Copy link
Author

jack-dutchie commented Aug 11, 2023

if you name the bg for example 'stupid_bg' you should use bg.frames = Paths.getSparrowAtlas('stupid_bg'); I hope you understand now

for some reason i did that but it doesnt show up in the freeplay it only show the normal bg
i putted this in
freeplaystate
102 bg.frames = Paths.getSparrowAtlas('testbg');
103 bg.animation.addbyPrefix('idle', 'idle', 1, true);
104 add(bg)
but i treid without the add bg and still nothing

@Chidubemmo
Copy link

Wait why is the framerate at 1fps?

@jack-dutchie
Copy link
Author

Wait why is the framerate at 1fps?

uh i am gonna change that i accidentally used 1

@Chidubemmo
Copy link

Chidubemmo commented Aug 11, 2023

Can you Pass me the spritesheet and the xml?

@jack-dutchie
Copy link
Author

Can you Pass me the spritesheet and the xml?

ok wait

@jack-dutchie
Copy link
Author

Can you Pass me the spritesheet and the xml?

wait how?

@Chidubemmo
Copy link

send me like drive or mega.nz link

@jack-dutchie
Copy link
Author

send me like drive or mega.nz link

ok

@jack-dutchie
Copy link
Author

@jack-dutchie
Copy link
Author

jack-dutchie commented Aug 11, 2023

dont mind it being clouds bc its a test bg
and im gonna change it soon

@Chidubemmo
Copy link

i don't have acess

@jack-dutchie
Copy link
Author

oh wait

@jack-dutchie
Copy link
Author

jack-dutchie commented Aug 11, 2023

@jack-dutchie
Copy link
Author

i don't have acess

hello you there?

@Chidubemmo
Copy link

Figured it out... I think. It plays for me.
The only thing wrong is that the xml is incorrect there's a line of code that says 'imagepath=sky.png' even though it should be imagepath=testbg.png since it's the name of the spritesheet. I was trying to figure out what was wrong since I'm not an expert. Just replace everything with the code below

bg = new FlxSprite().loadGraphic(Paths.image('testbg', 'shared'), true);
bg.frames = Paths.getSparrowAtlas('testbg', 'shared');
bg.animation.addByPrefix('idle', 'idle', 12); //Or whatever is the fps idgaf
bg.animation.play('idle');
bg.antialiasing = ClientPrefs.globalAntialiasing;
add(bg);
bg.screenCenter();

@jack-dutchie
Copy link
Author

sorry for wasting your time but can you help me with that

@Chidubemmo
Copy link

@jack-dutchie
Copy link
Author

nvm it worked
i had to reopen

@jack-dutchie
Copy link
Author

i couldnt use sources bc it wouldnt let me start or play

@jack-dutchie
Copy link
Author

You didn't install haxe 4.2.5 (or any version for that matter)

hey uh im having issues with my source it says
source/psychlua/CallbackHandler.hx:48: characters 18-33 : Class<llua.Lua_helper> has no field sendErrorsToLua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants