Is there a size limit on an image assigned to a sprite?


#1

Helping a student clean up her code. She created a landscape with grass in the foreground, mountains in the background, sun and some clouds in the sky. Will be adding animation to the project. Used snip-it tool to create an image (400 x 400) of the finished background, attached to a sprite and only 200 x 200 px displays. The image isn’t proportionately reduced in size rather it leaves the lower left quadrant of the image. She can increase the size of the cropped quadrant and that displays nicely but she would like the whole background she created to show.

Is there a size limit on sprite image size?
Is there another way to do this so her focus can be on her animation now and less on keeping up with her landscape?

Thank you and Happy New Year!!!


#2

Adamsr,

I’m not the developer so I can’t give an official answer - but I tried to replicate what you mentioned and found when I took a 400x400 screenshot on my Mac, then imported it (after some size reduction to below 100 KB) it came out as 800x800. I ended up using the .scale method to reduce the image by .5 and it ended up taking up the entire screen (with an origin point at 200,200… you might have to play with that).

I know that there have been a lot of questions around animations and sprites and Code.org is attempting to improve that feature to give the students more “authentic choice”. I have had a few advanced students that go above and beyond (like it sounds she did) so I made sure they had the documentation site handy that they could explore code to make their vision come true (you can also get to documentation by hovering over the block in Code Studio and click on “See examples”).

Let me know if you have any additional questions!
Brad