I’m extremely new to coding and Phaser in general. I am trying to create a very simple scoring system with coins and was wondering what would be the best way. I’ve tried to follow some tutorials but it just gives me a black screen every time. At the moment all I have is this;
Phaser labs can be your rescue many times for examples of may aspects of Phaser usage (cause docs, are no offense, but not very beginner/game-developer friendly): https://labs.phaser.io/
Sorry for late response, had to take care of personal stuff.
As fselcukcan mentioned the Phaser official tutorial, I decided to try it out and it didn’t give me the black screen, yaay. However, I’m unable to move now and the coins just fly through the map.
First of all for the fiddles you need to add the scripts as well, from resources in the side panel
You simply need to call the player as this.player since this is the way you have created it. There is nothing defined as player in your code.
For the coins, stars, fly through do you mean through the world bounds. If so make the collide with the world bounds: star.setCollideWorldBounds(true); inside the stars.children.iterate you have written. Also there may be a way to do this with the group, stars for convenience. Not sure about those currently. But if you bound the bottom of the world by putting a ground platform which you set to collide with stars then you will not need this. Stars will hit the ground and not fly through. I guess you have some problem with placement or creation of your platforms but I do not know what ii is?
Thank you very much. I managed to successfully implement the stars and score counter. And yes, I do have some issues with my platforms, I can walk through the side of the platform inside the model itself.
At the moment I am trying to stop the game as soon as every single coin is collected and output a winning message but no luck in that.