1
0
Fork 0

Add star field to main menu

This commit is contained in:
Michaël Lemaire 2017-01-22 18:41:32 +01:00
parent ca88cfe32b
commit a0d4ec6720
3 changed files with 12 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -9,6 +9,17 @@ module SpaceTac.View {
create() {
this.game.stage.backgroundColor = "#000000";
// Stars
for (let i = 0; i < 300; i++) {
let fade = Math.random() * 0.5 + 0.5;
let x = Math.random() * 0.998 + 0.001;
let star = this.add.image(1920 * x, Math.random() * 1080, "menu-star");
star.anchor.set(0.5, 0.5);
star.alpha = 0.7 * fade;
star.scale.set(0.1 * fade, 0.1 * fade);
this.tweens.create(star).to({ x: -30 }, 30000 * x / fade).to({ x: 1950 }, 0.00001).to({ x: 1920 * x }, 30000 * (1 - x) / fade).loop().start();
}
// Menu buttons
this.button_new_game = this.addButton(322, 674, "New Game", this.onNewGame);
this.button_load_game = this.addButton(960, 674, "Load Game", this.onLoadGame);

View file

@ -13,6 +13,7 @@ module SpaceTac.View {
// Load images
this.loadImage("menu/title.png");
this.loadImage("menu/button.png");
this.loadImage("menu/star.png");
this.loadImage("battle/waiting.png");
this.loadImage("battle/shiplist-background.png");
this.loadImage("battle/shiplist-own.png");