Adjusting hitboxes using bounce
Posted: Sun Nov 12, 2023 1:37 am
Hello!
I am currently working on a game using bounce for collision detection and resolution. I am hoping to make the hitbox for the player a bit smaller than the actual sprite, however it appears that the hitbox is being reset when I call world:move. How can I keep the adjusted hitbox I created in world:add? Adjusting values in my movement code makes the player move rather than affecting the hitbox.
Thank you!
I am currently working on a game using bounce for collision detection and resolution. I am hoping to make the hitbox for the player a bit smaller than the actual sprite, however it appears that the hitbox is being reset when I call world:move. How can I keep the adjusted hitbox I created in world:add? Adjusting values in my movement code makes the player move rather than affecting the hitbox.
Thank you!
Code: Select all
world:add(player,player.x+1,player.y+1,player.width-1,player.height-1)
Code: Select all
local goalX = player.x + (player.speed*player.xdir*dt)
local goalY = player.y + (player.speed*player.ydir*dt)
local actualX, actualY, cols, len = world:move(player, goalX, goalY, playerFilter)
player.x, player.y = actualX, actualY