GameLab setAnimation not working

https://studio.code.org/projects/gamelab/EJ3OYzYgJfu018lQ_3YeA7QuVqHBpzqHfGzxdTuhCKo/

I’m trying to make an OS-like program.
To open the program, swipe up and enter “3333” (Press “3” 4 times.)
Here’s what’s going wrong:
On line 441, I’m setting the animation of the sprite app1icon to screens[currentScreen][0].iconscreens[currentScreen][0].icon. If you console.log this value, you will recieve “calculator icon” which is an actual animation.
image
(It looks blank, but it isn’t, it’s just that all of the pixels are white.)
I don’t understand why the sprite is still grey (it’s shapeColor). It’s supposed to be drawing the sprite’s animation, that I set using app1icon.setAnimation(screens[currentScreen][0].icon)
I tried doing app1icon.setAnimation(“calculator icon”) directly, and it still didn’t work.

@IMPixel,

Is it perhaps because app2icon was created in the exact same place as app1icon, and after app1icon, but it was never animated?

I’m not 100% sure as I haven’t spend the time necessary to fully understand what you are doing, but I don’t see anywhere where you have made app2icon invisible and it would be drawn on top of app1icon…

Let me know if I’m wrong … (which is entirely possible).

Mike

1 Like

Thank you so much for answering. That’s probably why this is happening, and I don’t know why i didn’t notice this. I will try this and tell you if this is why it’s happening