Jump to content

User input(e.g. username)


Faizy
 Share

Recommended Posts

Hey,

 

I have a very simple state:

var menu = {
	preload: function() {
		console.log("Starting menu.js")
		game.load.image('buttonPlay', 'assets/buttonPlay.png')
		game.load.image('buttonScores', 'assets/buttonScores.png')
		game.load.image('buttonNewGame', 'assets/buttonNewGame.png')
		game.load.image('buttonQuit', 'assets/buttonQuit.png')
	},
	create: function(){
		this.stage.backgroundColor = '#4A4A4A'
  		this.buttonPlay = this.add.button(game.width/2 - 100, 50, 'buttonPlay', this.play);
  		this.buttonScores = this.add.button(game.width/2 - 100, 120, 'buttonScores', this.scores);
  		this.buttonNewGame = this.add.button(game.width/2 - 100, 190, 'buttonNewGame', this.newGame);
  		this.buttonQuit = this.add.button(game.width/2 - 100, 260, 'buttonQuit', this.quit);
	},
	play: function() {
		console.log("play")
		game.state.start("Main");
	},
	scores: function() {
		console.log("scores")
	},
	newGame: function() {
		console.log("newGame")
	},
	quit: function() {
		console.log("quit")
	}
}

 

Now I want to create some kind of an inputfield(similar to HTML inputfields) so a user can type in his name. Is it possible to create fields inside(onside the) states? What would be a good solution?

 

Thanks :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...