Quindi mi chiedevo come modificare un'immagine del personaggio che ho creato a seconda del tasto che ho premuto/sto premendo?Come creare un'animazione a piedi in LOVE 2D
Il mio ultimo tentativo di avere un'animazione che si verifica quando viene premuto "d" (o uno qualsiasi dei tasti wasd), ma poi si ferma quando il tasto "d" è stato premuto, ecc. Tutte le immagini sono state create già.
Ho provato questo, ma non ha funzionato:
function love.load()
if love.keyboard.isDown("a") then
hero = love.graphics.newImage("/hero/11.png")
elseif love.keyboard.isDown("d") then
hero = love.graphics.newImage("/hero/5.png")
elseif love.keyboard.isDown("s") then
hero = love.graphics.newImage("/hero/fstand.png")
elseif love.keyboard.isDown("w") then
hero = love.graphics.newImage("/hero/1.png")
end
function love.draw()
love.graphics.draw(background)
love.graphics.draw(hero, x, y)
end
Grazie mille! – Switchkick