Bonjour, je suis en train de programmer sur Löve2d. Voici mon programme, tres simple :
debug = true
playerImg = love.graphics.newImage('im1.jp g')
playerImg = love.graphics.newImage('im2.jp g')
player = { x = 100, y = 110, speed = 150, img = nil }
player2 = {x = 400, y = 400, speed = 200, img = nil}
function love.load(arg)
player.img = love.graphics.newImage('cake.j pg')
player2.img = love.graphics.newImage('akari. jpg')
end
function love.update(dt)
if love.keyboard.isDown('escape') then
love.event.push('quit')
end
if love.keyboard.isDown('left') then
player.x = player.x - (player.speed*dt)
elseif love.keyboard.isDown('right') then
player.x = player.x + (player.speed*dt)
elseif love.keyboard.isDown('down') then
player.y = player.y + (player.speed*dt)
elseif love.keyboard.isDown('up') then
player.y = player.y - (player.speed*dt)
elseif love.keyboard.isDown('a') then
player2.x = player2.x - (player.speed*dt)
elseif love.keyboard.isDown('d') then
player2.x = player2.x + (player.speed*dt)
elseif love.keyboard.isDown('w') then
player2.y = player2.y - (player.speed*dt)
elseif love.keyboard.isDown('s') then
player2.y = player2.y + (player.speed*dt)
end
end
function love.draw(dt)
love.graphics.draw(player.img, player.x, player.y)
love.graphics.draw(player2.img , player2.x, player2.y)
end
Ce programme permet d'afficher deux images, les touches flechees permettent de bouger la premiere, et AWSD pour la seconde image. Seulement impossible de bouger les deux en meme temps ... Je voulais savoir s'il etait possible de regler ca, et de pouvoir bouger tout les deux images en simultane.
Merci d'avance.
-----