Skip to content

Commit

Permalink
Final changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kobaltoxid committed Jan 21, 2021
1 parent dc94f9e commit e47c5d9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion conf.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function love.conf(w)
w.window.width=1280
w.window.height=768
w.window.title='Logonator'
w.window.title='Magus'
end
Binary file renamed logonator.lovec → magus.lovec
Binary file not shown.
2 changes: 1 addition & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local map = require 'map'
-- Load various things in love and the game itself.
function love.load()

love.window.setMode(1024, 720, {
love.window.setMode(1280, 720, {
resizable = true,
vsync = true,
minwidth = 400,
Expand Down
36 changes: 26 additions & 10 deletions map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ local spr_list = love.graphics.newImage('assets/dungeon/0x72_16x16DungeonTileset
-- Load specific player sprite.
local char_spr = love.graphics.newQuad(80, 144, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load specific enemy sprite.
-- Load generic enemy sprite.
local en_spr = love.graphics.newQuad(80, 176, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load second enemy sprite.
local en_spr_second = love.graphics.newQuad(32, 176, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load third enemy sprite.
local en_spr_third = love.graphics.newQuad(32, 160, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load fourth enemy sprite.
local en_spr_fourth = love.graphics.newQuad(48, 192, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load fifth enemy sprite.
local en_spr_fifth = love.graphics.newQuad(16, 192, 16, 16, spr_list:getWidth(), spr_list:getHeight())

-- Load health potion sprite
local health_pt = love.graphics.newQuad(112, 208, 16, 16, spr_list:getWidth(), spr_list:getHeight())

Expand Down Expand Up @@ -146,7 +158,7 @@ playerob:setSprite(char_spr)
layer.sprites = {
player = playerob
}
table.insert(layer.sprites, player)
--table.insert(layer.sprites, player)
-----------------------------------------------------------------------

-- Layer for setting all potions.
Expand All @@ -167,25 +179,31 @@ coord.x, coord.y = 200, 200
math.randomseed(os.clock() * 100000000000)
for i = 1, 220 do
enemies[i] = enemy:new()
enemies[i]:setSprite(en_spr)
enemies[i]:setPos(coord.x, coord.y)
if i % 2 == 0 or i % 5 == 0 then
enemies[i]:changeDir(-1)
end
table.insert(layer.sprites, enemies[i])

if i < 100 then
enemies[i]:setSprite(en_spr)
coord.x, coord.y = math.random(200, 1850), math.random(200, 1850)
elseif i < 130 then
enemies[i]:setSprite(en_spr)
coord.x, coord.y = math.random(2545, 3100), math.random(60, 746)
elseif i < 160 then
enemies[i]:setSprite(en_spr_third)
coord.x, coord.y = math.random(3704, 4432), math.random(36, 765)
elseif i < 200 then
enemies[i]:setSprite(en_spr_second)
coord.x, coord.y = math.random(2563, 3234), math.random(1175, 1758)
elseif i < 210 then
enemies[i]:setSprite(en_spr_fourth)
coord.x, coord.y = math.random(8864, 9216), math.random(8864, 9020)
else
enemies[i]:setSprite(en_spr_fifth)
coord.x, coord.y = math.random(9168, 9580), math.random(9425, 9566)
end
table.insert(layer.sprites, enemies[i])
end
enemies[221] = enemy:new()
enemies[221]:setPos(spawn.returning.a.x, spawn.returning.a.y)
Expand Down Expand Up @@ -462,7 +480,6 @@ function moveEnemy(e, p, dt)
enemy_attack:play()
p.health = e:attack(p)
impact:play()
print('Miss me with that gay shit.')
end
elseif e.name == 'enemy_troll' then
if dist(e.xPos + 16, e.yPos + 16, p.xPos, p.yPos) < 30 then
Expand All @@ -475,7 +492,6 @@ function moveEnemy(e, p, dt)
end
enemy_attack:play()
p.health = e:attack(p)
print('Miss me with that troll shit.')
end
end
local actualX, actualY, cols, len = world:move(e, goalX, goalY, playerFilter)
Expand Down Expand Up @@ -507,13 +523,13 @@ function enemySelector(p, dt)
if items[i].name == 'enemy' then
local target = items[i]
if dist(p.xPos, p.yPos, target.xPos, target.yPos) < 10 then
if items[i].health <= 0 then
if target.health <= 0 then
enemy_voice:play()
items[i].alive = false
world:remove(items[i])
target.alive = false
world:remove(target)
break
end
items[i].health = p:attack(items[i])
target.health = p:attack(target)
end
end
end
Expand Down
6 changes: 0 additions & 6 deletions player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ function Player:resetPos()
return self.originX, self.originY
end

-- Self explanatory.
function Player:updateSpritePos(p)
p.x, p.y = self.xPos, self.yPos
return p
end

-- Set player sprite.
function Player:setSprite(quad)
self.sprite = quad
Expand Down

0 comments on commit e47c5d9

Please sign in to comment.