https://github.com/SavageDogg/UntidyTid ... Lua/Game02
"badie" above is called in "game" below which is referenced in main.luabadie = class:new()
function badie:init( x, y)
self.x = x
self.y = y
self.dx = 1
self.dy = 1
self.alive = true
end
function badie:update(dt)
self.x = self.x + self.dx*dt
self.y = self.y + self.dy*dt
end
function badie:draw()
love.graphics.circle("fill", self.x, self.y, 10, 8)
end
return badie
You'll see that I'm going for the game opening in a splash screen which will then enter a menu and subsequent game map - form there, I'm trying to call objects, bad guys, or anything via object oriented methods.require "badie"
function game_load(map)
love.graphics.setBackgroundColor(100,100,100)
b.badie:init( math.random(800), math.random(600))
end
function game_update(dt)
b.badie:update(dt)
end
function game_draw()
love.graphics.printf("GAME " .. map, 0, 0, 800)
b.badie:draw()
end
function game_keypressed(key)
if key == "escape" then
state = "menu"
menu_load()
end
end
Anyways, I'm stuck. Thanks again!