pheaset Posted February 21, 2017 Share Posted February 21, 2017 My latest game. Built with phaser from a tutorial. I then built on the tutorial by adding access to the localstorage api. Here is the link Positive criticism is much appreciated as well as tips for improvements Thanks Pheaset Quote Link to comment Share on other sites More sharing options...
kevdude Posted February 23, 2017 Share Posted February 23, 2017 Nice game, I think that having some sort of acceleration/physics to the ship would be nice, so when you click, you accelerate the ship instead of having it go at a constant speed. Also, the stars seem like they're just a tile-map across the world. Maybe try randomly distributing stars from a single star sprite. pheaset 1 Quote Link to comment Share on other sites More sharing options...
pheaset Posted February 23, 2017 Author Share Posted February 23, 2017 15 hours ago, kevdude said: Nice game, I think that having some sort of acceleration/physics to the ship would be nice, so when you click, you accelerate the ship instead of having it go at a constant speed. Also, the stars seem like they're just a tile-map across the world. Maybe try randomly distributing stars from a single star sprite. Any advice as how to make the starfield? Rather than using the tile map Thanks for the feedback Quote Link to comment Share on other sites More sharing options...
kevdude Posted February 23, 2017 Share Posted February 23, 2017 Yes, Try making a single star as a sprite (Like this one) and loading into your game. Then, when you create the world, have a for loop repeating a certain amount of times (the number of stars you want in the game) and in the loop add a star sprite with a random x position and y position. You can even add all those sprites into a group and update them collectively (ie: make them twinkle by modifying the opacity). Hope this helps Quote Link to comment Share on other sites More sharing options...
pheaset Posted February 24, 2017 Author Share Posted February 24, 2017 10 hours ago, kevdude said: Yes, Try making a single star as a sprite (Like this one) and loading into your game. Then, when you create the world, have a for loop repeating a certain amount of times (the number of stars you want in the game) and in the loop add a star sprite with a random x position and y position. You can even add all those sprites into a group and update them collectively (ie: make them twinkle by modifying the opacity). Hope this helps Thanks for the help again. Ill try that. Hopefully it will work out although im not sure due to my lack of knowledge with javacript and phaser Thanks again Pheaset Quote Link to comment Share on other sites More sharing options...
FakeWizard Posted February 24, 2017 Share Posted February 24, 2017 12 hours ago, kevdude said: Yes, Try making a single star as a sprite (Like this one) and loading into your game. Then, when you create the world, have a for loop repeating a certain amount of times (the number of stars you want in the game) and in the loop add a star sprite with a random x position and y position. You can even add all those sprites into a group and update them collectively (ie: make them twinkle by modifying the opacity). Hope this helps I tried similar approach and it downgraded the overal performance. Not mentioning that the initial start of the game was very choppy, as well as the movement around the map. So I ended up making a tileSprite (containing some random white dots) and then just update the tilePosition.x , tilePosition.y based on the ship movement which creates this effect similar as if the background was moving. Additionally you can add more layers with all variety sized stars , with lower increment/decrement rate of tilePosition the further away is the layer from the ship. thus making the stars in background look more authentic. IMHO performance wise it's way better approach than drawing the stars as particles or individual sprites. this.bg_layter1 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space1'); this.bg_layter2 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space2'); this.bg_layter3 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space3'); this.bg_layter1.tilePosition.y += 2; this.bg_layter2.tilePosition.y += 2.5; this.bg_layter3.tilePosition.y += 2.7; pheaset 1 Quote Link to comment Share on other sites More sharing options...
pheaset Posted February 24, 2017 Author Share Posted February 24, 2017 5 minutes ago, FakeWizzard said: I tried similar approach and it downgraded the overal performance. Not mentioning that the initial start of the game was very choppy, as well as the movement around the map. So I ended up making a tileSprite (containing some random white dots) and then just update the tilePosition.x , tilePosition.y based on the ship movement which creates this effect similar as if the background was moving. Additionally you can add more layers with all variety sized stars , with lower increment/decrement rate the further away is the layer from the ship ,which would make the stars in background look more authentic. IMHO performance wise it's way better approach than drawing the stars as particles or individual sprites. this.bg_layter1 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space1'); this.bg_layter2 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space2'); this.bg_layter3 = this.game.add.tileSprite(0, 0,this.game.world.width, this.game.world.height,'space3'); this.bg_layter1.tilePosition.y += 2; this.bg_layter2.tilePosition.y += 2.5; this.bg_layter3.tilePosition.y += 2.7; Ill try that so and ill let you know how it works out. Thanks again Pheaset Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.