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