Error With Object Oriented Things
Posted: Mon Mar 26, 2018 3:10 pm
I'm fairly new to LUA and LOVE2D both.
I've been getting this for a while and need to finish it to continue.
The code is bellow.
main.lua:
monster.lua:
Obviously the classic.lua is in the .love as well.
I've been getting this for a while and need to finish it to continue.
The code is bellow.
main.lua:
Code: Select all
camera = {}
camera.x = 0
camera.y = 0
camera.scaleX = 1
camera.scaleY = 1
camera.rotation = 0
function camera:set()
love.graphics.push()
love.graphics.rotate(-self.rotation)
love.graphics.scale(1 / self.scaleX, 1 / self.scaleY)
love.graphics.translate(-self.x, -self.y)
end
function camera:unset()
love.graphics.pop()
end
function camera:move(dx, dy)
self.x = self.x + (dx or 0)
self.y = self.y + (dy or 0)
end
function camera:rotate(dr)
self.rotation = self.rotation + dr
end
function camera:scale(sx, sy)
sx = sx or 1
self.scaleX = self.scaleX * sx
self.scaleY = self.scaleY * (sy or sx)
end
function camera:setPosition(x, y)
self.x = x or self.x
self.y = y or self.y
end
function camera:setScale(sx, sy)
self.scaleX = sx or self.scaleX
self.scaleY = sy or self.scaleY
end
function love.load()
setup = {
placeholder = 0
}
player = {
grid_x = 672,
grid_y = 160,
act_x = 200,
act_y = 200,
speed = 10,
canmove = false,
movetimer = 0,
health = 640,
maxhealth = 640,
blink = 300,
mana = 640,
maxmana = 640,
spell = 0,
sptrturns = 0
}
map = {
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 5, 5, 5, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 1, 5, 5, 5, 5, 1, 5, 5, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}
Object = require "classic"
require "monster"
goblin = Monster(544, 192, 50, 160)
--troll = Monster(608, 384, 300, 250)
love.window.setMode(640, 640)
end
function love.update(dt)
if player.blink > 0 then
player.blink = player.blink - 1
end
if player.blink < 1 then
player.blink = 300
end
if player.health < 0 then
player.health = 0
end
camera.x = (player.act_x + 16) - 320
camera.y = (player.act_y + 16) - 320
if player.movetimer < 60 then
player.movetimer = player.movetimer + 1
end
if player.movetimer == 60 then
player.canmove = true
player.movetimer = 0
end
if player.movetimer == 40 then
player.canmove = false
end
player.act_y = player.act_y - ((player.act_y - player.grid_y) * player.speed * dt)
player.act_x = player.act_x - ((player.act_x - player.grid_x) * player.speed * dt)
goblin:update(dt)
--troll:update(dt)
end
function love.draw()
camera:set()
for y=1, #map do
for x=1, #map[y] do
if map[y][x] == 0 then
love.graphics.setColor(150, 150, 150)
love.graphics.line(x * 32, y * 32 + 8, x * 32 + 32, y * 32 + 8)
love.graphics.line(x * 32, y * 32 + 16, x * 32 + 32, y * 32 + 16)
love.graphics.line(x * 32, y * 32 + 24, x * 32 + 32, y * 32 + 24)
love.graphics.line(x * 32, y * 32 + 32, x * 32 + 32, y * 32 + 32)
love.graphics.line(x * 32 + 16, y * 32, x * 32 + 16, y * 32 + 8)
love.graphics.line(x * 32 + 16, y * 32 + 16, x * 32 + 16, y * 32 + 24)
love.graphics.line(x * 32, y * 32 + 8, x * 32, y * 32 + 16)
love.graphics.line(x * 32 + 32, y * 32 + 8, x * 32 + 32, y * 32 + 16)
love.graphics.line(x * 32, y * 32 + 24, x * 32, y * 32 + 32)
love.graphics.line(x * 32 + 32, y * 32 + 24, x * 32 + 32, y * 32 + 32)
end
if map[y][x] == 1 then
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("line", x * 32, y * 32, 32, 32)
love.graphics.rectangle("line", x * 32 + 8, y * 32 + 8, 16, 16)
end
if map[y][x] == 4 then
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("line", x * 32, y * 32, 32, 32)
love.graphics.line(x * 32, y * 32, x * 32 + 32 , y * 32 + 32)
love.graphics.line(x * 32 + 32, y * 32, x * 32, y * 32 + 32)
end
if map[y][x] == 5 then
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("line", x * 32, y * 32, 32, 32)
love.graphics.line(x * 32, y * 32 + 16, x * 32 + 32 , y * 32 + 16)
end
if map[y][x] == 6 then
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("line", x * 32, y * 32, 32, 32)
love.graphics.line(x * 32, y * 32 + 16, x * 32 + 16 , y * 32 + 32, x * 32 + 32, y * 32 + 16, x * 32 + 16, y * 32, x * 32, y * 32 + 16)
end
end
end
if player.movetimer > 25 then
love.graphics.setColor(0, 255, 255)
end
if player.movetimer < 26 then
love.graphics.setColor(255, 0, 0)
end
if player.health < 1 then
love.graphics.setColor(0, 255, 255)
end
love.graphics.rectangle("fill", player.act_x, player.act_y, 32, 32)
if player.blink > 199 and player.blink < 221 and player.health > 0 then
-- Dummy code!
else
if player.health > 0 then
love.graphics.setColor(255, 255, 255)
end
if player.health < 1 then
love.graphics.setColor(0, 0, 0)
end
love.graphics.rectangle("fill", player.act_x + 4, player.act_y + 8, 8, 4)
love.graphics.rectangle("fill", player.act_x + 20, player.act_y + 8, 8, 4)
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", player.act_x + 4, player.act_y + 8, 2, 2)
love.graphics.rectangle("fill", player.act_x + 20, player.act_y + 8, 2, 2)
end
goblin:draw()
camera:unset()
love.graphics.setColor(75, 75, 75)
love.graphics.rectangle("fill", 0, 0, player.maxhealth, 32)
love.graphics.setColor(200, 0, 0)
love.graphics.rectangle("fill", 0, 0, player.health, 32)
love.graphics.setColor(75, 75, 75)
love.graphics.rectangle("fill", 0, 32, player.maxmana, 16)
love.graphics.setColor(0, 0, 200)
love.graphics.rectangle("fill", 0, 32, player.mana, 16)
end
function love.keypressed(key)
if key == "0" then
player.spell = 0
end
if key == "1" then
player.spell = 1
end
if key == "2" then
player.spell = 2
end
if key == "3" then
player.spell = 3
end
if key == "4" then
player.spell = 4
end
if player.health > 0 then
if key == "w" and player.canmove == true then
if player.spell == 1 and testMap(0, -1) and player.mana > 39 then
map[(player.grid_y / 32 - 1)][(player.grid_x / 32)] = 1
player.mana = player.mana - 40
player.canmove = false
end
if player.spell == 2 and testMap(0, -1) and player.mana > 79 then
map[(player.grid_y / 32 - 1)][(player.grid_x / 32)] = 5
player.mana = player.mana - 80
player.canmove = false
end
if player.spell == 3 and testBuilt(0, -1) and player.mana > 4 then
map[(player.grid_y / 32 - 1)][(player.grid_x / 32)] = 0
player.mana = player.mana - 5
player.canmove = false
end
if player.spell == 4 and player.mana > 24 then
player.sptrturns = 10
player.mana = player.mana - 125
player.canmove = false
end
elseif key == "s" and player.canmove == true then
if player.spell == 1 and testMap(0, 1) and player.mana > 39 then
map[(player.grid_y / 32 + 1)][(player.grid_x / 32)] = 1
player.mana = player.mana - 40
player.canmove = false
end
if player.spell == 2 and testMap(0, 1) and player.mana > 79 then
map[(player.grid_y / 32 + 1)][(player.grid_x / 32)] = 5
player.mana = player.mana - 80
player.canmove = false
end
if player.spell == 3 and testBuilt(0, 1) and player.mana > 4 then
map[(player.grid_y / 32 + 1)][(player.grid_x / 32)] = 0
player.mana = player.mana - 5
player.canmove = false
end
if player.spell == 4 and player.mana > 24 then
player.sptrturns = 10
player.mana = player.mana - 125
player.canmove = false
end
elseif key == "a" and player.canmove == true then
if player.spell == 1 and testMap(-1, 0) and player.mana > 39 then
map[(player.grid_y / 32)][(player.grid_x / 32 - 1)] = 1
player.mana = player.mana - 40
player.canmove = false
end
if player.spell == 2 and testMap(-1, 0) and player.mana > 79 then
map[(player.grid_y / 32)][(player.grid_x / 32 - 1)] = 5
player.mana = player.mana - 80
player.canmove = false
end
if player.spell == 3 and testBuilt(-1, 0) and player.mana > 4 then
map[(player.grid_y / 32)][(player.grid_x / 32 - 1)] = 0
player.mana = player.mana - 5
player.canmove = false
end
if player.spell == 4 and player.mana > 24 then
player.sptrturns = 10
player.mana = player.mana - 125
player.canmove = false
end
elseif key == "d" and player.canmove == true then
if player.spell == 1 and testMap(1, 0) and player.mana > 39 then
map[(player.grid_y / 32)][(player.grid_x / 32 + 1)] = 1
player.mana = player.mana - 40
player.canmove = false
end
if player.spell == 2 and testMap(1, 0) and player.mana > 79 then
map[(player.grid_y / 32)][(player.grid_x / 32 + 1)] = 5
player.mana = player.mana - 80
player.canmove = false
end
if player.spell == 3 and testBuilt(1, 0) and player.mana > 4 then
map[(player.grid_y / 32)][(player.grid_x / 32 + 1)] = 0
player.mana = player.mana - 5
player.canmove = false
end
if player.spell == 4 and player.mana > 24 then
player.sptrturns = 10
player.mana = player.mana - 125
player.canmove = false
end
elseif key == "up" and testMap(0, -1) and player.canmove == true then
if testTrap(0, -1) then
player.health = player.health - 10
map[(player.grid_y / 32 - 1)][(player.grid_x / 32)] = 0
end
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 0
player.grid_y = player.grid_y - 32
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 3
if player.sptrturns > 0 then
map[(player.grid_y / 32 + 1)][(player.grid_x / 32)] = 4
player.sptrturns = player.sptrturns - 1
end
player.canmove = false
elseif key == "down" and testMap(0, 1) and player.canmove == true then
if testTrap(0, 1) then
player.health = player.health - 10
map[(player.grid_y / 32) + 1][(player.grid_x / 32)] = 0
end
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 0
player.grid_y = player.grid_y + 32
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 3
if player.sptrturns > 0 then
map[(player.grid_y / 32 - 1)][(player.grid_x / 32)] = 4
player.sptrturns = player.sptrturns - 1
end
player.canmove = false
elseif key == "left" and testMap(-1, 0) and player.canmove == true then
if testTrap(-1, 0) then
player.health = player.health - 10
map[(player.grid_y / 32)][(player.grid_x / 32 - 1)] = 0
end
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 0
player.grid_x = player.grid_x - 32
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 3
if player.sptrturns > 0 then
map[(player.grid_y / 32)][(player.grid_x / 32 + 1)] = 4
player.sptrturns = player.sptrturns - 1
end
player.canmove = false
elseif key == "right" and testMap(1, 0) and player.canmove == true then
if testTrap(1, 0) then
player.health = player.health - 10
map[(player.grid_y / 32)][(player.grid_x / 32 + 1)] = 0
end
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 0
player.grid_x = player.grid_x + 32
emap[(player.grid_y / 32)][(player.grid_x / 32)] = 3
if player.sptrturns > 0 then
map[(player.grid_y / 32)][(player.grid_x / 32 - 1)] = 4
player.sptrturns = player.sptrturns - 1
end
player.canmove = false
elseif key == "up" and player.canmove == false then
player.health = player.health - 40
elseif key == "down" and player.canmove == false then
player.health = player.health - 40
elseif key == "left" and player.canmove == false then
player.health = player.health - 40
elseif key == "right" and player.canmove == false then
player.health = player.health - 40
elseif key == "space" and player.canmove == true then
if testEnemy(1, 0) then
if goblin:TestPlayer(-1, 0) then
goblin.health = goblin.health - 20
if goblin:TestMap(1, 0) then
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 0
goblin.grid_x = goblin.grid_x + 32
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 2
end
end
end
if testEnemy(-1, 0) then
if goblin:TestPlayer(1, 0) then
goblin.health = goblin.health - 20
if goblin:TestMap(-1, 0) then
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 0
goblin.grid_x = goblin.grid_x - 32
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 2
end
end
end
if testEnemy(0, 1) then
if goblin:TestPlayer(0, -1) then
goblin.health = goblin.health - 20
if goblin:TestMap(0, 1) then
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 0
goblin.grid_y = goblin.grid_y + 32
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 2
end
end
end
if testEnemy(0,-1) then
if goblin:TestPlayer(0, 1) then
goblin.health = goblin.health - 20
if goblin:TestMap(0, -1) then
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 0
goblin.grid_y = goblin.grid_y - 32
emap[(goblin.grid_y / 32)][(goblin.grid_x / 32)] = 2
end
end
end
player.canmove = false
elseif key == "space" and player.canmove == false then
player.health = player.health - 40
end
end
end
function testMap(x, y)
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 1 then
return false
end
if emap[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 2 then
return false
end
if emap[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 3 then
return false
end
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 5 then
return false
end
return true
end
function testEnemy(x, y)
if emap[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 2 then
return true
end
return false
end
function testTrap(x, y)
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 4 then
return true
end
return false
end
function testBuilt(x, y)
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 5 then
return true
end
return false
end
Code: Select all
Monster = Object:extend()
function Monster:new(grid_x, grid_y, health, damage)
self.grid_x = grid_x
self.grid_y = grid_y
self.act_x = grid_x
self.act_y = grid_y
self.speed = 10
self.maxhealth = health
self.health = health
self.damage = damage
self.trapdamage = 30
end
function Monster:update(dt)
if self.health < 0 then
self.health = 0
end
if self.health > self.maxhealth then
self.health = self.maxhealth
end
if player.movetimer == 10 and self.health > 0 then
if player.grid_x > self.grid_x and self.TestMap(1, 0) then
if self.TestTrap(1, 0) then
self.health = self.health - self.trapdamage
map[(self.grid_y / 32 + 1)][(self.grid_x / 32)] = 0
end
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 0
self.grid_x = self.grid_x + 32
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 2
elseif player.grid_x < self.grid_x and self.TestMap(-1, 0) then
if self.TestTrap(-1, 0) then
self.health = self.health - self.trapdamage
map[(self.grid_y / 32 - 1)][(self.grid_x / 32)] = 0
end
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 0
self.grid_x = self.grid_x - 32
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 2
elseif player.grid_y > self.grid_y and self.TestMap(0, 1) then
if self.TestTrap(0, 1) then
self.health = self.health - self.trapdamage
map[(self.grid_y / 32)][(self.grid_x / 32 + 1)] = 0
end
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 0
self.grid_y = self.grid_y + 32
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 2
elseif player.grid_y < self.grid_y and self.TestMap(0, -1) then
if self.TestTrap(0, -1) then
self.health = self.health - self.trapdamage
map[(self.grid_y / 32)][(self.grid_x / 32 - 1)] = 0
end
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 0
self.grid_y = self.grid_y - 32
emap[(self.grid_y / 32)][(self.grid_x / 32)] = 2
else
if self.TestPlayer(1, 0) then
player.health = player.health - self.damage
end
if self.TestPlayer(-1, 0) then
player.health = player.health - self.damage
end
if self.TestPlayer(0, 1) then
player.health = player.health - self.damage
end
if self.TestPlayer(0, -1) then
player.health = player.health - self.damage
end
end
end
self.act_y = self.act_y - ((self.act_y - self.grid_y) * self.speed * dt)
self.act_x = self.act_x - ((self.act_x - self.grid_x) * self.speed * dt)
end
function Monster:draw()
love.graphics.setColor(255, 0, 0)
love.graphics.rectangle("fill", self.act_x, self.act_y, 32, 32)
if self.health > 0 then
love.graphics.setColor(255, 200, 0)
end
if self.health < 1 then
love.graphics.setColor(0, 0, 0)
end
love.graphics.rectangle("fill", self.act_x + 4, self.act_y + 8, 8, 4)
love.graphics.rectangle("fill", self.act_x + 20, self.act_y + 8, 8, 4)
end
function Monster:TestMap(x, y)
if clone.map[self:grid_x / 32 + x][self:grid_y / 32 + y] == 1 then
return false
end
if clone.emap[self:grid_x / 32 + x][self:grid_y / 32 + y] == 2 then
return false
end
if clone.emap[self:grid_x / 32 + x][self:grid_y / 32 + y] == 3 then
return false
end
if clone.map[self:grid_x / 32 + x][self:grid_y / 32 + y] == 5 then
return false
end
return true
end
function Monster:TestPlayer(x, y)
if emap[self.grid_x / 32 + x][self.grid_y / 32 + y] == 3 then
return true
end
return false
end
function Monster:TestTrap(x, y)
if emap[self.grid_x / 32 + x][self.grid_y / 32 + y] == 4 then
return true
end
return false
end