Code: Select all
require("Naruto")
require("Sasuke")
require("Kyubi")
require("Konoha")
local Quad = love.graphics.newQuad
function love.load()
--Carregar sprites naruto
Naruto_correndo = love.graphics.newImage(Naruto["Naruto_correndo"])
--Animação do naruto
Naruto_correndo_quads = {
a = {
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
};
d = {
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
Quad(0, 0, 40, 45, 275, 102);
};
}
iterator = 1
max = 4
timer = 0
moving = false
direction = "down"
--Carregar sprites Sasuke
corrida1_sasuke =love.graphics.newImage(Sasuke["sprites"])
--Carregar sprites Kyubi
invocacao_kyube =love.graphics.newImage(Kyubi["sprite"])
--Carregar imagem de fundo
imagem_fundo =love.graphics.newImage(Konoha["sprite"])
--Carregar som de fundo
musica_fundo = love.audio.newSource("sounds/musica_tema.mp3")
love.audio.play(musica_fundo)
end
function love.update(dt)
-- Movimento do Naruto
if moving then
timer = timer + dt
if timer > 0.2 then
timer = 0
iterator = iterator + 1
if iterator > max then
iterator = 1
end
end
end
end
function love.draw()
--Mostrar imagem de fundo
love.graphics.draw(imagem_fundo,Konoha.cordx,Konoha.cordy)
love.graphics.print("Naruto vs Sasuke",285,300,0,2,2)
--Mostrar imagem Sasuke
love.graphics.draw(corrida1_sasuke,Sasuke.cordx,Sasuke.cordy)
-- Oyabin invocação
if love.keyboard.isDown('i') then
love.graphics.print("kushiose no jutsu",100,100)
love.graphics.draw(invocacao_kyube,Kyubi.cordx,Kyubi.cordy)
end
--Animação do naruto ---------------------------------------
love.graphics.drawq(Naruto_correndo, Naruto_correndo_quads[direction][iterator], 5, 5)
end
----------------------------------------
function love.keypressed(key)
if Naruto_correndo_quads[key] then
moving = true
direction = key
end
end
function love.keyreleased(key)
if quads[key] and direction == key then
moving = false
direction = "down"
iterator = 1
end
end