Add title text
This commit is contained in:
parent
8426b5069d
commit
254d161bf2
1 changed files with 14 additions and 2 deletions
16
js/game.js
16
js/game.js
|
@ -220,13 +220,23 @@ function preload() {
|
|||
function create() {
|
||||
|
||||
// Add the background sprite
|
||||
background = game.add.sprite(0, 0, "bg");
|
||||
var background = game.add.sprite(0, 0, "bg");
|
||||
|
||||
// create our player
|
||||
player = new Player(myId, Math.random() * 100, Math.random() * 100);
|
||||
player = new Player(myId, game.world.centerX + (25 - Math.random() * 50),game.world.centerY + (25 - Math.random() * 50) );
|
||||
|
||||
// Get controls
|
||||
controls = game.input.keyboard.createCursorKeys();
|
||||
|
||||
// Create the text group
|
||||
textGroup = game.add.group();
|
||||
|
||||
// Create our title text
|
||||
var titleText= game.add.text(game.world.centerX,10,"FOODICATOR", {font: "65px Arial", fill: "#FFFFFF" });
|
||||
titleText.anchor.x = Math.round(titleText.width * 0.5) / titleText.width;
|
||||
|
||||
// Add to our group
|
||||
textGroup.add(titleText);
|
||||
}
|
||||
|
||||
// On update
|
||||
|
@ -238,4 +248,6 @@ function update() {
|
|||
// update our player
|
||||
player.update();
|
||||
|
||||
// Bring the text group to the top
|
||||
game.world.bringToTop(textGroup);
|
||||
}
|
Loading…
Add table
Reference in a new issue