Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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');