Running on both the playdate and on the mac simulator I am experiencing some unpredictable collision behaviour, and at this point i don't really know what the course is.
Here in the first gif I hit the meteor but it does not trigger the health bar:
Here is a couple of situations where sometimes it works, sometimes it does not:
I have tried various things, but I also don't have a very good understanding of how this works so I might have missed something obvious.
I have tried:
> playerSprite:setCollideRect( 0, 0, playerSprite:getSize() )
and I also tried setting it manually to values both above and below the sprite size
> playerSprite:setCollideRect( 0, 0, 16,11 )
I have tried having
> playerSprite:moveWithCollisions(playerSprite.x, playerSprite.y)
both in the playdate update and outside - when outside the update function the health bar function never runs.
I have the healthcare function running outside playdate update:
> function playerSprite:collisionResponse() > moveHpBar() > end
This is the function it runs
> function moveHpBar() > print('Collision! :(') > hpLevel = hpLevel - 10 > if hpBarInnerSprite.x > 83 then > hpBarInnerSprite:moveBy(-20,0) > end > if hpBarInnerSprite.x <= 83 then > hpBarInnerSprite:moveTo(83,16) > print('you are dead') > end > laserState = 'off' > print(hpBarInnerSprite.x,hpLevel) > end