"Java Objects (Retired)" was retired on January 31, 2017. You are now viewing the recommended replacement.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introducing JavaScript Finishing the Game Adding Animated Characters

WhenI type the load sprite for the bottle of poison the code for my numbers is green and not red. When I go to preview

when I go to preview the game after changing the coin to poison the game will not load.

1 Answer

Rajashree Madan
Rajashree Madan
13,293 Points

Hi Trevor,

Can you please share the code snippet you are having trouble with? I would be able to better assist you if I could see the exact code.

But here's something to try.

In the function call, where you load the sprites, make sure you are not putting quotes around the numbers. That could be the reason they are turning green (due to Workspace's syntax highlighting). The spritesheet function requires numbers for the sizes, but adding quotes converts those values into strings.

The following code should work.

game.load.spritesheet('poison', 'poison.png', 32, 32);
game.load.spritesheet('star', 'star.png', 32, 32);

Hope this helps.