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 trialTrevor Schliefer
Full Stack JavaScript Techdegree Student 222 PointsWhenI 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
13,293 PointsHi 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.