here is the code i have so far:
Code: Select all
--classes
Player = {}
Zombie = {}
MiniBoss = {}
zmt = {}
mbmt = {}
pmt = {}
--Objects/Buffers
local ThePlayer
local Bullets = {}
local Enemys = {}
local EBullets = {}
--Assets
Music1 = nil
Music2 = nil
ShootSound1 = nil
ShootSound2 = nil
ZombieTex = nil
PlayerTex = nil
MiniBossTex = nil
GameFont = nil
ReloadSound = nil
function Init()
ThePlayer = Player:new(300,400)
love.audio.play(Music2)
end
function Zombie:new(sx,sy)
return setmetatable({x=sx,y=sy,tex=ZombieTex,theta=0,health=20},zmt)
end
function MiniBoss:new(x,y)
return setmetatable({x=0,y=0,tex=MiniBossTex,theta=0,health=50},mbmt)
end
function Player:new(x,y)
return setmetatable({x=0,y=0,tex=PlayerTex,theta=0,health=35},pmt)
end
function FireBullet()
love.audio.play(ShootSound1)
end
function love.draw()
local fps = love.timer.getFPS( )
love.graphics.print(fps,20,20)
--love.graphics.setColor(33,33,40);
--love.graphics.quad("fill", 0, 300, 0, 600, 800, 600, 800, 300)
love.graphics.draw(ThePlayer.tex,ThePlayer.x,ThePlayer.y,0,1,1,0,0)
--draw all zombies
--draw all minibosses
--draw all bullets
--draw Player
--draw interface
end
function love.load()
love.graphics.setCaption( "Zombie Game" )
PlayerTex = love.graphics.newImage("Player.png")
--ZombieTex = love.graphics.newImage("Zombie.png")
--load MiniBoss Assets
--load Aimer
--load interface
ShootSound1 = love.audio.newSource("Shoot1.wav", "static")
--ReloadSound = love.audio.newSource("Reload.wav", "static")
--load shoot sound2
--Music1 = love.audio.newSource("labyrinth.mod", "static")
Music2 = love.audio.newSource("prondisk.xm")
--GameFont = love.graphics.newFont("Arcade.ttf", 15)
--Init()
Init()
end
function love.update(dt)
if love.mouse.isDown( "l" ) then
FireBullet()
end
if love.keyboard.isDown("w") then
ThePlayer.y = ThePlayer.y + 1;
end
if love.keyboard.isDown("a") then
ThePlayer.x = ThePlayer.x - 1;
end
if love.keyboard.isDown("s") then
ThePlayer.y = ThePlayer.y - 1;
end
if love.keyboard.isDown("d") then
ThePlayer.x = ThePlayer.x + 1;
end
--update player
--update enemys
--make new enemys if needed
--check for collisions and act as needed
end
function love.mousepressed(x,y,button)
--FireBullet()
--move curosr
--fire if button is down
--start fireing machine gun if needed
end
function love.mousereleased(x, y, button)
--relase fireing machine gun
end