Hi everyone, I'm currently developping a little pong as my first game. I want to have an animation for the background of the game.
I've exported an animation with a P5js sketch https://editor.p5js.org/Erjaeger42/sketches/Est8hm1x2
Just a black and white animation. I've add it to my game with this code :
class("GameScene").extends(gfx.sprite)
function GameScene:init()
GameScene.super.init(self)
local backgroundTable = gfx.imagetable.new("assets/background_anim.gif")
local animationLoop = gfx.animation.loop.new(10, backgroundTable, true)
local animatedSprite = gfx.sprite.new(animationLoop:image())
animatedSprite:setZIndex(0)
animatedSprite:setBounds(0, 0, 400, 240)
animatedSprite:add()
animatedSprite.update = function()
gfx.setImageDrawMode(gfx.kDrawModeCopy)
animatedSprite:setImage(animationLoop:image())
end
self:launchGame()
end
But the result looks like this :

I've tried to set different ImageDrawMode but it's not changing anything.
Am I missing something ? Is it better to generate multiple image and then create the animation with an ImageTable instead of using a GIF?
Thanks for your help!

