Add star field to main menu
This commit is contained in:
parent
ca88cfe32b
commit
a0d4ec6720
BIN
out/assets/images/menu/star.png
Normal file
BIN
out/assets/images/menu/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue