From 1b8ec8fafa84615f9a678bcdf2e9f2cee517caa6 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 14 Jan 2017 18:07:52 +0100 Subject: Adjusted fixture sizes and sprite offset to draw correctly --- player.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/player.lua b/player.lua index 364efbd..1818e48 100644 --- a/player.lua +++ b/player.lua @@ -72,10 +72,14 @@ function Player:new (game, world, x, y, name) o.current = o.animations.idle o:createEffect("respawn") -- New punch mechanics - o.hitbox_fixture = love.physics.newFixture(o.body, love.physics.newPolygonShape(6,-8,28,-8,28,8,6,8), 0) + o.hitbox_fixture = love.physics.newFixture(o.body, love.physics.newPolygonShape(6,-6,20,-6,20,6,6,6), 0) o.hitbox_fixture:setSensor(true) o.hitbox_fixture:setCategory(3) o.hitbox_fixture:setMask(1) + local fixture = love.physics.newFixture(o.body, love.physics.newPolygonShape(-6,-6,-20,-6,-20,6,-6,6), 0) + fixture:setSensor(true) + fixture:setCategory(3) + fixture:setMask(1) -- Portrait load for first object created if self.portrait_sprite == nil then self.portrait_sprite = love.graphics.newImage("assets/portraits.png") @@ -309,7 +313,7 @@ function Player:draw(offset_x, offset_y, scale, debug) local draw_y = (math.floor(y) + offset_y) * scale -- sprite draw love.graphics.setColor(255,255,255,255) - love.graphics.draw(self.sprite, self.current[self.frame], draw_x, draw_y, self.rotate, self.facing*scale, 1*scale, 12, 14) + love.graphics.draw(self.sprite, self.current[self.frame], draw_x, draw_y, self.rotate, self.facing*scale, 1*scale, 12, 15) -- debug draw if debug then for _,fixture in pairs(self.body:getFixtureList()) do -- cgit v1.1