I’m a teacher and I created a matching game with country flags. The first time it runs, the group images/sprites/animations appear fine. But after the game resets, the images/sprites/animations appear distorted. I’ve been having this problem in various forms as I’ve been working on this project. I tried searching for a solution but couldn’t find anything.
Any help would be appreciated!
I took a quick look at your code and it looks like in the beginning, you are coercing all of the images to be 35 x 50 (which isn’t the natural size), but when you reset, that code isn’t working anymore.
Generally, I try to avoid resizing images like this when I want all of them to always be the same size. One thing that may help you would be to use a free image editing website such as https://pixlr.com to resize all of the images to the same number of pixels wide and tall and then bring them into your project.
When you do that, you avoid the need for code that artificially resizes the images and you can avoid that code (and that problem) completely. It’s something I have my students do in web development as well. It also helps with load time when you make the images exactly the size you need them before importing them.
Hope this helps!
@mwood, Thanks for the reply! I will look into resizing the images. It sounds like from your quick look that it’s not an inherent problem with the code, which is my main concern. If anyone else sees a problem with the code, please let me know!
It is kind of a code issue because the code only works the first time through, so there is probably a way to fix it with code, but it would be easier to fix by using images that were already the correct size and dimension. Good luck!