threepointonefourone
Posts: 18
Joined: Thu Aug 30, 2012 8:51 am

Scratch bug with sprite scaling

Wed Mar 30, 2016 6:27 pm

I believe I've found a bug in the latest version of Scratch on the Raspberry Pi. I've compared it with Scratch 1.4 on PC and Scratch 2.0 on PC.

Here's how to replicate it:
- Change the background to the x-y grid (for reference)
- Edit the cat's costume. Add a black dot to the left of the cat.
- Change the costume centre so that it is on this dot.
- Add this script: when green flag clicked / set size to 70% / go to x:0 y:0
- Run the script

What should happen is the black dot should sit on the 0,0 point in the grid, because it's the centre of the sprite and the sprite's position is 0,0. What actually happens is the black dot sits between the 0,0 point and the cat image, which I think means the centre point isn't scaling when the sprite image is. So the sprite is shown at 70%, but the centre point now sits outside the sprite and hasn't scaled. When you run this test on a PC in 1.4 or 2.0, the black dot remains at 0,0 after running the script.

I've got a really cool project that works great on the PC but not on the Pi as a result of this. Please let me know if I've overlooked anything on my end, or if it can be fixed! Thank you for your time!

timrowledge
Posts: 1077
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch bug with sprite scaling

Wed Mar 30, 2016 11:38 pm

Some pictures would be really helpful to make sure I completely get what the problem is.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ghp
Posts: 1155
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Scratch bug with sprite scaling

Thu Mar 31, 2016 1:59 pm

Hello,
nice topic. Have placed a scratch project to http://heppg.de/rotate_zoom.sb which demonstrates the effect.
On windows scratch 1.4, the black dot == center stays iside the red circle. In scratch on raspberry, the center moves out when zooming; and the next rotation is not around black dot, but around a point where it was before.
Regards,
Gerhard

timrowledge
Posts: 1077
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch bug with sprite scaling

Thu Mar 31, 2016 5:17 pm

Gerhard that is a quite lovely demonstration. Thank you!

I see what you mean; clear difference between original MIT 1.4 and current Pi 1.4. That's a surprise since I'm reasonably sure I didn't change anything in that area, but let's see what I can dig up.

Created https://github.com/raspberrypi/scratch/issues/184 to cover this.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

threepointonefourone
Posts: 18
Joined: Thu Aug 30, 2012 8:51 am

Re: Scratch bug with sprite scaling

Fri Apr 01, 2016 9:17 am

Sorry for the delay - I've been away from the Pi. Thanks for that great demo Gerhard, and to Tim for looking into it.

I've attached here a picture too that shows what happens when the sprite shrinks to less than 100%, where the effect can be even more pronounced. In the picture, the costume centre is the black dot to the left of the cat. When the sprite is scaled to 50%, none of the sprite actually touches its x,y position on the grid and the costume's centre spot is clearly some distance away.
Attachments
snapshot3-9.png
Black dot is costume centre. With scaling at 70%, none of sprite touches its x,y position on the Stage.
snapshot3-9.png (6.02 KiB) Viewed 1752 times

timrowledge
Posts: 1077
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch bug with sprite scaling

Wed May 18, 2016 4:38 pm

I haven't given up on this, I'm just swamped! It will be solved...
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1077
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Scratch bug with sprite scaling

Wed Jun 08, 2016 5:26 pm

Fixed it at last. Not because it was terribly complex (any more than any rotate and scale about arbitrary centre work) but because so many things got in the way. Ready for next release!
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

threepointonefourone
Posts: 18
Joined: Thu Aug 30, 2012 8:51 am

Re: Scratch bug with sprite scaling

Sat Sep 17, 2016 8:02 pm

Thank you for fixing this! :-)

Return to “Scratch”

Who is online

Users browsing this forum: No registered users and 1 guest