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 Control the Flow with Conditional Statements

Ruben Lindskog
Ruben Lindskog
1,008 Points

Hey, all I get when i launch the game is a black screen. Been going through the code but brackets seem to be in order.

1 Answer

Missing Bracket

// create the winning badge and add to screen
function createBadge() {
  badges = game.add.physicsGroup();
  var badge = badges.create(750, 400, 'badge');
  badge.animations.play('spin', 10, true);
Need to add a } here

// when the player collects an item on the screen
function itemHandler(player, item) {
  if (item.key === 'coin') {
  currentScore = currentScore + 10; 
  } else if (item.key === 'star') {
    currentScore = currentScore + 40;
  if (currentScore === winningScore) {