Thank you for the detailed post and the test project, that makes looking at stuff like this a lot easier!
The second issue - AABB behavior - is explained by the fact that :checkCollisions()
behaves just like :moveWithCollisions()
without actually moving the sprite. Since your player sprite does not have a collision response type set, it defaults to kCollisionTypeFreeze
. So, when it collides with one of the box sprites it stops moving and doesn't "collide" with the second.
To detect all collisions you would need to add sprite.collisionResponse = gfx.sprite.kCollisionTypeOverlap
to your Player:_initSprite()
function, OR use playdate.graphics.sprite.allOverlappingSprites()
instead.
As for the Alpha Behavior issue, I agree it seems like something odd is going on there, but it's going to take some more investigation to figure out what exactly is going on. The code path is different for images with an alpha mask, so it makes some sense that the weirdness doesn't exist in the sprite using the image with the clear pixel.
As a workaround while until we can get this fixed, adding a mask to the image seems to fix the issue:
local image = tileImages:getImage(1)
image:addMask()
local spr1 <const> = gfx.sprite.new(image)