When changing a sprite's image with setImage the sprite's scale is also reset

As the title says, having set a sprite's scale prior to changing its image the scale is also reset.

Here is a minimal project that reproduces the bug. Press A to set the sprites scale to 2. Press B to call setImage again.

local img = playdate.graphics.image.new("player.png")
local sprite = playdate.graphics.sprite.new()
sprite:add()
sprite:moveTo(200, 120)
sprite:setImage(img)

function playdate.AButtonDown()
	sprite:setScale(2)
end

function playdate.BButtonDown()
	sprite:setImage(img)
end

function playdate.update()
	playdate.graphics.sprite.update()
end

Source.zip (806 Bytes)

playdate-20230423-173421
As can be seen when pressing B the scale is also reset.

Oh no. This is new in 1.13.5, so I'll bet I broke it when fixing [Regression] Image scaling is broken in 1.13.3

I'll get a fix in asap and see if we can squeeze it into the next update :bowing_man:

4 Likes

Saw that the patch notes says this is fixed in 1.13.6, but I'm still getting the same behaviour after downloading the update.

1 Like

It's working for me, both in the simulator and on the device. Are you sure you're running this in 1.13.6?

Did a reinstall to see if that would fix it, but it’s still the same behaviour. And checking the 'about playdate simulator' confirms that 1.13.6 is installed.

I’m on windows, don’t know if that has anything to do with it?

playdate-20230504-023202

image

I'm sorry, I was wrong--it's not working in the 1.13.6 mac sim after all. It looks like we accidentally merged the fix to the main branch instead of the release branch. Usually we merge our fixes ready for release to the main branch then fork off the release when it's ready to go, but this time there was some parallel development going on and things got confused. (Then, somehow, the fix wound up getting merged back into the release branch after we built the SDK and I was testing that branch instead of the actual SDK build.)

What a mess. So sorry for the trouble. :frowning: I don't think we'll have any updates coming out in the next couple weeks because James is on vacation, but I'd be happy to whip up a hotfix build for you if you'd like. That would just be for the simulator, but I could also push that version to memfault and put your device on a test cohort until the next release. Let me know if you'd like a patched build!

It is noew fixed with 1.13.7: Playdate OS/SDK 1.13.7 is out - #2

4 Likes