Jump to content

Recommended Posts

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

Link to post
Share on other sites

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 position and 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

Link to post
Share on other sites
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 position and 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

Link to post
Share on other sites
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 position and 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; 
Link to post
Share on other sites
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

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...