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

KAMRAN IMRANLI
KAMRAN IMRANLI
4,107 Points

Not more than 3 coins and platforms

Hi to everyone. I am trying to add nine platforms and coins. I have added already six, but when I preview, there are only three of each. Can anyone tell me what is my mistake? I am adding a link to the snapshot of my code. https://w.trhou.se/chq8dc2545

1 Answer

You are creating items. They are just off the screen. The dimensions of the game are 800 x 600:

game = new Phaser.Game(800, 600, ...

but all your items are beyond the 600 height

 createItem(100, 600, 'coin');
 createItem(400, 700, 'coin');
 createItem(600, 800, 'coin');

and

  platforms.create(30,  650, 'platform');
  platforms.create(330, 750, 'platform');
  platforms.create(530, 850, 'platform');