Collisions depend on order of moveTo and setCollideRect?

I'm using animators to move bullets with collisions, and calling self:moveTo before self:setCollideRect prevents collision detection, which seems odd to me. It seems like a bug, but maybe there's something I don't understand? SDK Versions 2.3.1, 2.2.0, and 2.0.0 all exhibit this behavior.

function Bullet:init(x, y)
	local startPoint <const> =, 240)
	local animator <const> = Animator(
		startPoint,, y),

	animator.reverses = true

	Bullet.super.init(self, IMAGE)

	-- Collisions do not work when calling moveTo before setCollideRect
	self:moveTo(startPoint.x, startPoint.y)
	self:setCollideRect(self.x, self.y, self.width, self.height)
	-- Collisions work when calling moveTo after setCollideRect rather than
	-- before calling setCollideRect
	self:moveTo(startPoint.x, startPoint.y)

	self:setAnimator(animator, true)


No collisions when calling self:moveTo before self:setCollideRect.

Collisions when calling self:moveTo after self:setCollideRect.

Collision rects need to be specified in sprite coordinates rather than world coordinates, so instead of self:setCollideRect(self.x, self.y, self.width, self.height) you probably want to do self:setCollideRect(0, 0, self.width, self.height).

I think the sprite's position was defaulted to 0, 0 before your first moveTo() call, which would have accidentally caused the correct behavior when you put the moveTo() call after the setCollideRect() call.

I should mention that you can also turn on "Show Sprite Collision Rects" under the Playdate menu in the simulator to help debug stuff like this.

Well, I feel sheepish. Thanks for debugging my code!