Hi I'm trying to put a small text field that the player can type text into and them submit the the text. I've seen so may complicated ( over my head ) ways to do this but I was hoping for a simple solution. Just need to click on a box and be able to type in it, then cluck "subScore".
this.subScore = game.add.sprite(this.game.world.centerX + 150, this.game.world.centerY + 100, 'subScore');
this.subScore.anchor.setTo(0.5, 0.5);
// Enable input on the subScore button
this.subScore.inputEnabled = true;
// Attach a function to the input down ( click/tap)
this.subScore.events.onInputDown.add(function() {
var name = "";
var score = "";
$.ajax (
{
url:"/vaultage/publicHTML/score.php",
data:{name:name, score:score},
type:"post",
success:function(result){
if (result === "success"){
alert ('yes');
} else {
alert ('no');
};
}
});
}, this);
full repo: https://github.com/craftycal/vaultage
thank you in advance for you help.