diff --git a/entityDefs/player.lua b/entityDefs/player.lua index 4838842..24baf0c 100644 --- a/entityDefs/player.lua +++ b/entityDefs/player.lua @@ -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 @@ -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() @@ -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 @@ -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 @@ -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 diff --git a/gfx/items/chest.png b/gfx/items/armor0_chest.png similarity index 100% rename from gfx/items/chest.png rename to gfx/items/armor0_chest.png diff --git a/gfx/items/helmet.png b/gfx/items/armor0_helmet.png similarity index 100% rename from gfx/items/helmet.png rename to gfx/items/armor0_helmet.png diff --git a/gfx/items/pants.png b/gfx/items/armor0_pants.png similarity index 100% rename from gfx/items/pants.png rename to gfx/items/armor0_pants.png diff --git a/gfx/items/armor1_chest.png b/gfx/items/armor1_chest.png new file mode 100644 index 0000000..10ff533 Binary files /dev/null and b/gfx/items/armor1_chest.png differ diff --git a/gfx/items/armor1_helmet.png b/gfx/items/armor1_helmet.png new file mode 100644 index 0000000..74dd826 Binary files /dev/null and b/gfx/items/armor1_helmet.png differ diff --git a/gfx/items/armor1_pants.png b/gfx/items/armor1_pants.png new file mode 100644 index 0000000..40bdbee Binary files /dev/null and b/gfx/items/armor1_pants.png differ diff --git a/gfx/player/armor/armor1/chest/swing.png b/gfx/player/armor/armor1/chest/swing.png new file mode 100644 index 0000000..148273c Binary files /dev/null and b/gfx/player/armor/armor1/chest/swing.png differ diff --git a/gfx/player/armor/armor1/chest/walk.png b/gfx/player/armor/armor1/chest/walk.png new file mode 100644 index 0000000..f28b6bf Binary files /dev/null and b/gfx/player/armor/armor1/chest/walk.png differ diff --git a/gfx/player/armor/armor1/chest/walk_and_swing.png b/gfx/player/armor/armor1/chest/walk_and_swing.png new file mode 100644 index 0000000..14fe10c Binary files /dev/null and b/gfx/player/armor/armor1/chest/walk_and_swing.png differ diff --git a/gfx/player/armor/armor1/helmet/swing.png b/gfx/player/armor/armor1/helmet/swing.png new file mode 100644 index 0000000..51d6ef6 Binary files /dev/null and b/gfx/player/armor/armor1/helmet/swing.png differ diff --git a/gfx/player/armor/armor1/helmet/walk.png b/gfx/player/armor/armor1/helmet/walk.png new file mode 100644 index 0000000..ae5c5a1 Binary files /dev/null and b/gfx/player/armor/armor1/helmet/walk.png differ diff --git a/gfx/player/armor/armor1/helmet/walk_and_swing.png b/gfx/player/armor/armor1/helmet/walk_and_swing.png new file mode 100644 index 0000000..ff2f8e1 Binary files /dev/null and b/gfx/player/armor/armor1/helmet/walk_and_swing.png differ diff --git a/gfx/player/armor/armor1/pants/swing.png b/gfx/player/armor/armor1/pants/swing.png new file mode 100644 index 0000000..69db9dc Binary files /dev/null and b/gfx/player/armor/armor1/pants/swing.png differ diff --git a/gfx/player/armor/armor1/pants/walk.png b/gfx/player/armor/armor1/pants/walk.png new file mode 100644 index 0000000..c553e2d Binary files /dev/null and b/gfx/player/armor/armor1/pants/walk.png differ diff --git a/gfx/player/armor/armor1/pants/walk_and_swing.png b/gfx/player/armor/armor1/pants/walk_and_swing.png new file mode 100644 index 0000000..755cf17 Binary files /dev/null and b/gfx/player/armor/armor1/pants/walk_and_swing.png differ diff --git a/items.lua b/items.lua index af99c62..d04b7da 100644 --- a/items.lua +++ b/items.lua @@ -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 diff --git a/loadassets.lua b/loadassets.lua index 4ce0abb..325cb03 100644 --- a/loadassets.lua +++ b/loadassets.lua @@ -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 = { @@ -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') } @@ -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 = { diff --git a/tempCommon.lua b/tempCommon.lua index 3e12f1a..bd2aba2 100644 --- a/tempCommon.lua +++ b/tempCommon.lua @@ -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