Skip to content

Commit

Permalink
Merge pull request #961 from NimbusBP1729/player_attack_box
Browse files Browse the repository at this point in the history
increased punching bounding box
  • Loading branch information
kyleconroy committed Mar 11, 2013
2 parents 34616b1 + 7e3c381 commit a9c6916
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function Player:refreshPlayer(collider)
self.collider:remove(self.attack_box.bb)
end

self.attack_box = PlayerAttack.new(collider,self)
self.collider = collider
self.top_bb = collider:addRectangle(0,0,self.bbox_width,self.bbox_height/2)
self.bottom_bb = collider:addRectangle(0,self.bbox_height/2,self.bbox_width,self.bbox_height/2)
Expand Down Expand Up @@ -197,6 +198,7 @@ function Player:moveBoundingBox()
self.position.y + (self.height / 4) + 2)
self.bottom_bb:moveTo(self.position.x + self.width / 2,
self.position.y + (3*self.height / 4) + 2)
self.attack_box:update()
end


Expand Down
6 changes: 3 additions & 3 deletions src/playerAttack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ function PlayerAttack.new(collider,plyr)

setmetatable(attack, PlayerAttack)

attack.width = 5
attack.height = 5
attack.width = 18
attack.height = 18
attack.radius = 10
attack.collider = collider
attack.bb = collider:addCircle(plyr.position.x+attack.width/2,(plyr.position.y+28)+attack.height/2,attack.width,attack.radius)
attack.bb = collider:addRectangle(0,0,attack.width,attack.height)
attack.bb.node = attack
attack.damage = 1
attack.player = plyr
Expand Down

0 comments on commit a9c6916

Please sign in to comment.