Code: Select all
function love.load()
screen = {};
screen.width = 640;
screen.height = 480;
love.graphics.setMode(screen.width, screen.height, false, false, 0);
music = {};
--music.source = love.audio.newSource("14Confrontation.mp3");
--love.audio.play(music.source);
objects = {};
objects.mario = {};
objects.mario.graphics = love.graphics.newImage("mario.png");
objects.mario.graphicsWidth = objects.mario.graphics:getWidth(objects.mario.graphics);
objects.mario.graphicsHeight = objects.mario.graphics:getHeight(objects.mario.graphics);
objects.mario.quadStartX = 0;
objects.mario.quadStartY = 0;
objects.mario.quadWidth = 32;
objects.mario.quadHeight = 64;
objects.mario.originX = objects.mario.quadWidth / 2;
objects.mario.originY = objects.mario.quadHeight / 2;
objects.mario.quad = love.graphics.newQuad(objects.mario.quadStartX, objects.mario.quadStartY,
objects.mario.quadWidth, objects.mario.graphicsHeight, 96, 64);
end
function love.update(dt)
--PLACE HOLDER
end
function love.keypressed(key)
if key == "right" then
if not (objects.mario.quadStartX > (objects.mario.graphicsWidth - objects.mario.quadWidth * 2)) then
objects.mario.quadStartX = objects.mario.quadStartX + objects.mario.quadWidth;
else
objects.mario.quadStartX = 0;
end
end
end
function love.draw()
love.graphics.drawq(objects.mario.graphics, objects.mario.quad, (screen.width / 2), (screen.height / 2),
0, 1, 1, objects.mario.originX, objects.mario.originY, 0, 0);
love.graphics.print(objects.mario.graphicsWidth,0,0);
love.graphics.print(objects.mario.quadStartX,0,14);
end
can anyone tell me what i'm doing wrong? i would also prefer to use my own animation system rather than using a library such as AnAL simply because i think it'll help me get more familiar with the language.
thanks everyone.