ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.15k stars 2.22k forks source link

Sprite Animation #3056

Closed MarkAwesomeness closed 2 years ago

MarkAwesomeness commented 2 years ago

Describe your problem here.

I have a sprite in a background using lua, but it will not animate. It has worked for other stages and other images, but not this specific image.

Heres the lua code:

`function onCreate() --for normal images and sprites. makeLuaSprite('yes','layer0', -200, -100) addLuaSprite('yes',false) --Do you want your image to be infront of the characters? setLuaSpriteScrollFactor('yes', 1, 1) --copy this and make changes to add other things.

--for animated things. makeAnimatedLuaSprite('SPEAKERS','spookers', -100, 500) addAnimationByPrefix('SPEAKERS','SPEAKERS','spookers',24,true) --do you want the animation to loop? addLuaSprite('SPEAKERS', false)

--for normal images and sprites.
makeLuaSprite('pretty lit','layer1', -200, -125)
addLuaSprite('pretty lit',false) --Do you want your image to be infront of the characters?
setLuaSpriteScrollFactor('pretty lit', 1, 1)
--copy this and make changes to add other things

makeLuaSprite('bg1', 'dancefloor0', -200, -100);
makeLuaSprite('bg2', 'dancefloor1', -200, -100);
makeLuaSprite('bg3', 'dancefloor2', -200, -100);
makeLuaSprite('bg4', 'dancefloor3', -200, -100);
makeLuaSprite('bg5', 'dancefloor4', -200, -100);        

end

local images = { [0] = function() addLuaSprite('bg1', false); end, [1] = function() addLuaSprite('bg2', false); end, [2] = function() addLuaSprite('bg3', false); end, [3] = function() addLuaSprite('bg4', false); end, [4] = function() addLuaSprite('bg5', false); end }

function onBeatHit() objectPlayAnimation('SPEAKERS','SPEAKERS',true)--Do you want this animation to be forced?

random = math.random(0, 4); images[random]();

end`

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

MarkAwesomeness commented 2 years ago

Here is the xml

`<?xml version="1.0" encoding="utf-8"?>

`
glitchygmr commented 2 years ago

addAnimationByPrefix('SPEAKERS','SPEAKERS','spookers',24,true) --do you want the animation to loop?

this should be addAnimationByPrefix('SPEAKERS','SPEAKERS','SPEAKERS',24,true) --do you want the animation to loop?

MarkAwesomeness commented 2 years ago

The name of the image is "spookers.png", if that clarifies anything.