Skip to content

Commit

Permalink
+dragon armor
Browse files Browse the repository at this point in the history
  • Loading branch information
parameterized committed Feb 28, 2019
1 parent 7c483e0 commit dfd549d
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 30 deletions.
108 changes: 84 additions & 24 deletions entityDefs/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,18 +342,33 @@ function player.client:draw()
lume.round(px), lume.round(py), 23)
-- pants
if pantsItem then
self:drawFrame(anims.player.armor.armor0.pants.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
if pantsItem.imageId == 'armor0Pants' then
self:drawFrame(anims.player.armor.armor0.pants.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
elseif pantsItem.imageId == 'armor1Pants' then
self:drawFrame(anims.player.armor.armor1.pants.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
-- chest
if chestItem then
self:drawFrame(anims.player.armor.armor0.chest.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
if chestItem.imageId == 'armor0Chest' then
self:drawFrame(anims.player.armor.armor0.chest.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
elseif chestItem.imageId == 'armor1Chest' then
self:drawFrame(anims.player.armor.armor1.chest.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
-- helmet
if helmetItem then
self:drawFrame(anims.player.armor.armor0.helmet.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
if helmetItem.imageId == 'armor0Helmet' then
self:drawFrame(anims.player.armor.armor0.helmet.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
elseif helmetItem.imageId == 'armor1Helmet' then
self:drawFrame(anims.player.armor.armor1.helmet.swing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
-- sword
if attackItem and isSword[attackItem.imageId] then
Expand All @@ -371,8 +386,13 @@ function player.client:draw()
lume.round(px), lume.round(py), 23)
-- pants
if pantsItem then
self:drawFrame(anims.player.armor.armor0.pants.walkAndSwing, walkFrameIdx,
lume.round(px), lume.round(py), 23)
if pantsItem.imageId == 'armor0Pants' then
self:drawFrame(anims.player.armor.armor0.pants.walkAndSwing, walkFrameIdx,
lume.round(px), lume.round(py), 23)
elseif pantsItem.imageId == 'armor1Pants' then
self:drawFrame(anims.player.armor.armor1.pants.walkAndSwing, walkFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
-- upper body
love.graphics.push()
Expand All @@ -382,13 +402,23 @@ function player.client:draw()
lume.round(px), lume.round(py), 23)
-- chest
if chestItem then
self:drawFrame(anims.player.armor.armor0.chest.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
if chestItem.imageId == 'armor0Chest' then
self:drawFrame(anims.player.armor.armor0.chest.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
elseif chestItem.imageId == 'armor1Chest' then
self:drawFrame(anims.player.armor.armor1.chest.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
-- helmet
if helmetItem then
self:drawFrame(anims.player.armor.armor0.helmet.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
if helmetItem.imageId == 'armor0Helmet' then
self:drawFrame(anims.player.armor.armor0.helmet.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
elseif helmetItem.imageId == 'armor1Helmet' then
self:drawFrame(anims.player.armor.armor1.helmet.walkAndSwing, swingFrameIdx,
lume.round(px), lume.round(py), 23)
end
end
love.graphics.pop()
-- sword
Expand All @@ -405,18 +435,33 @@ function player.client:draw()
lume.round(px), lume.round(py), 23)
-- pants
if pantsItem then
self:drawFrame(anims.player.armor.armor0.pants.swing, 1,
lume.round(px), lume.round(py), 23)
if pantsItem.imageId == 'armor0Pants' then
self:drawFrame(anims.player.armor.armor0.pants.swing, 1,
lume.round(px), lume.round(py), 23)
elseif pantsItem.imageId == 'armor1Pants' then
self:drawFrame(anims.player.armor.armor1.pants.swing, 1,
lume.round(px), lume.round(py), 23)
end
end
-- chest
if chestItem then
self:drawFrame(anims.player.armor.armor0.chest.swing, 1,
lume.round(px), lume.round(py), 23)
if chestItem.imageId == 'armor0Chest' then
self:drawFrame(anims.player.armor.armor0.chest.swing, 1,
lume.round(px), lume.round(py), 23)
elseif chestItem.imageId == 'armor1Chest' then
self:drawFrame(anims.player.armor.armor1.chest.swing, 1,
lume.round(px), lume.round(py), 23)
end
end
-- helmet
if helmetItem then
self:drawFrame(anims.player.armor.armor0.helmet.swing, 1,
lume.round(px), lume.round(py), 23)
if helmetItem.imageId == 'armor0Helmet' then
self:drawFrame(anims.player.armor.armor0.helmet.swing, 1,
lume.round(px), lume.round(py), 23)
elseif helmetItem.imageId == 'armor1Helmet' then
self:drawFrame(anims.player.armor.armor1.helmet.swing, 1,
lume.round(px), lume.round(py), 23)
end
end
-- sword
if attackItem and isSword[attackItem.imageId] then
Expand All @@ -430,18 +475,33 @@ function player.client:draw()
lume.round(px), lume.round(py), 8)
-- pants
if pantsItem then
self:drawFrame(anims.player.armor.armor0.pants.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
if pantsItem.imageId == 'armor0Pants' then
self:drawFrame(anims.player.armor.armor0.pants.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
elseif pantsItem.imageId == 'armor1Pants' then
self:drawFrame(anims.player.armor.armor1.pants.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
end
end
-- chest
if chestItem then
self:drawFrame(anims.player.armor.armor0.chest.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
if chestItem.imageId == 'armor0Chest' then
self:drawFrame(anims.player.armor.armor0.chest.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
elseif chestItem.imageId == 'armor1Chest' then
self:drawFrame(anims.player.armor.armor1.chest.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
end
end
-- helmet
if helmetItem then
self:drawFrame(anims.player.armor.armor0.helmet.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
if helmetItem.imageId == 'armor0Helmet' then
self:drawFrame(anims.player.armor.armor0.helmet.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
elseif helmetItem.imageId == 'armor1Helmet' then
self:drawFrame(anims.player.armor.armor1.helmet.walk, walkFrameIdx,
lume.round(px), lume.round(py), 8)
end
end
-- sword
if attackItem and isSword[attackItem.imageId] then
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added gfx/items/armor1_chest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/items/armor1_helmet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/items/armor1_pants.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/chest/swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/chest/walk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/chest/walk_and_swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/helmet/swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/helmet/walk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/helmet/walk_and_swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/pants/swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/pants/walk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/player/armor/armor1/pants/walk_and_swing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ items = {

function items.server.newItem(data)
data.id = lume.uuid()

data.type = data.imageId
if isSword[data.imageId] then
data.type = 'sword'
else
data.type = data.imageId
end
if data.imageId == 'armor0Helmet' or data.imageId == 'armor1Helmet' then
data.type = 'helmet'
end
if data.imageId == 'armor0Chest' or data.imageId == 'armor1Chest' then
data.type = 'chest'
end
if data.imageId == 'armor0Pants' or data.imageId == 'armor1Pants' then
data.type = 'pants'
end

items.server.container[data.id] = data
return data.id
end
Expand Down
43 changes: 40 additions & 3 deletions loadassets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ gfx = {
swing = love.graphics.newImage('gfx/player/armor/armor0/pants/swing.png'),
walkAndSwing = love.graphics.newImage('gfx/player/armor/armor0/pants/walk_and_swing.png')
}
},
armor1 = {
chest = {
walk = love.graphics.newImage('gfx/player/armor/armor1/chest/walk.png'),
swing = love.graphics.newImage('gfx/player/armor/armor1/chest/swing.png'),
walkAndSwing = love.graphics.newImage('gfx/player/armor/armor1/chest/walk_and_swing.png')
},
helmet = {
walk = love.graphics.newImage('gfx/player/armor/armor1/helmet/walk.png'),
swing = love.graphics.newImage('gfx/player/armor/armor1/helmet/swing.png'),
walkAndSwing = love.graphics.newImage('gfx/player/armor/armor1/helmet/walk_and_swing.png')
},
pants = {
walk = love.graphics.newImage('gfx/player/armor/armor1/pants/walk.png'),
swing = love.graphics.newImage('gfx/player/armor/armor1/pants/swing.png'),
walkAndSwing = love.graphics.newImage('gfx/player/armor/armor1/pants/walk_and_swing.png')
}
}
},
swords = {
Expand Down Expand Up @@ -143,9 +160,12 @@ gfx = {
sword4 = love.graphics.newImage('gfx/items/sword4.png'),
shield = love.graphics.newImage('gfx/items/shield.png'),
apple = love.graphics.newImage('gfx/items/apple.png'),
helmet = love.graphics.newImage('gfx/items/helmet.png'),
chest = love.graphics.newImage('gfx/items/chest.png'),
pants = love.graphics.newImage('gfx/items/pants.png')
armor0Helmet = love.graphics.newImage('gfx/items/armor0_helmet.png'),
armor0Chest = love.graphics.newImage('gfx/items/armor0_chest.png'),
armor0Pants = love.graphics.newImage('gfx/items/armor0_pants.png'),
armor1Helmet = love.graphics.newImage('gfx/items/armor1_helmet.png'),
armor1Chest = love.graphics.newImage('gfx/items/armor1_chest.png'),
armor1Pants = love.graphics.newImage('gfx/items/armor1_pants.png')
},
slimeBall = love.graphics.newImage('gfx/slime_ball.png')
}
Expand Down Expand Up @@ -196,6 +216,23 @@ anims.player = {
swing = newAnim(gfx.player.armor.armor0.pants.swing, 43, 34, 1, 5),
walkAndSwing = newAnim(gfx.player.armor.armor0.pants.walkAndSwing, 43, 34, 1, 5)
}
},
armor1 = {
chest = {
walk = newAnim(gfx.player.armor.armor1.chest.walk, 20, 31, 1, 5),
swing = newAnim(gfx.player.armor.armor1.chest.swing, 43, 34, 1, 5),
walkAndSwing = newAnim(gfx.player.armor.armor1.chest.walkAndSwing, 43, 34, 1, 5)
},
helmet = {
walk = newAnim(gfx.player.armor.armor1.helmet.walk, 20, 31, 1, 5),
swing = newAnim(gfx.player.armor.armor1.helmet.swing, 43, 34, 1, 5),
walkAndSwing = newAnim(gfx.player.armor.armor1.helmet.walkAndSwing, 43, 34, 1, 5)
},
pants = {
walk = newAnim(gfx.player.armor.armor1.pants.walk, 20, 31, 1, 5),
swing = newAnim(gfx.player.armor.armor1.pants.swing, 43, 34, 1, 5),
walkAndSwing = newAnim(gfx.player.armor.armor1.pants.walkAndSwing, 43, 34, 1, 5)
}
}
},
swords = {
Expand Down
4 changes: 3 additions & 1 deletion tempCommon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function serverEnemyDamage(self, d, clientId)
server.addXP(clientId, math.random(3, 5))
local bagItems = {}
local choices = {
none=20, apple=10, helmet=16, chest=16, pants=16, shield=5,
none=20, apple=10, shield=5,
armor0Helmet=8, armor0Chest=8, armor0Pants=8,
armor1Helmet=8, armor1Chest=8, armor1Pants=8,
sword0=4, sword1=4, sword2=3, sword3=3, sword4=3
}
for _=1, 3 do
Expand Down

0 comments on commit dfd549d

Please sign in to comment.