Codenburger Posted February 19, 2015 Share Posted February 19, 2015 Hi,I have built a prototype for a simple game.This game is used by parents and children.The next stage of the app, is the ability to create a simple user account for the child, managed by the paren.Steps:1. The parent would create an account and input the child's name.2. The account would keep simple data about the game and save the data to be retrieved, the next time that the game is played.Is this kind of thing possible in Phaser ?Thank you to anyone who can give me advice about this.Codenburger Link to comment Share on other sites More sharing options...
horkoda Posted February 19, 2015 Share Posted February 19, 2015 That kind of thing is possible in any modern browser independent of Phaser. Look into local storage. It's easy to use, but the data can potentially be erased and you are limited to a relatively small amount of space (which differs from browser to browser and user settings) of around 5 MB.For a more permanent solution you will need a server where the data would be stored. Link to comment Share on other sites More sharing options...
Codenburger Posted February 19, 2015 Author Share Posted February 19, 2015 Hi horkoda, Thank you, localStore is working fine with Phaser in my app. I am trying to use Javascript to dynamically build a html form, which I want to pass user input to a localStore variable, for a user's name. I basically want to have control of the dom using Javascript, so that I can call on a function which will act like a pop up window whenever called. Codenburger Link to comment Share on other sites More sharing options...
Codenburger Posted February 19, 2015 Author Share Posted February 19, 2015 I have also just learn't that json can be used to store the loca data. This would all be wonderful for my app, if I could manage to get it to work Link to comment Share on other sites More sharing options...
horkoda Posted February 19, 2015 Share Posted February 19, 2015 Yeah, JSON is great.Note that you can save _anything_ in localStorage you want. Even HTML code.But that might not be suitable for your scenario, since you've mentioned you're dynamically building the form. Decide for yourself! Link to comment Share on other sites More sharing options...
ptdnet Posted February 20, 2015 Share Posted February 20, 2015 Dynamic form stuff is pretty easy...var tbFirstName = document.createElement("input");tb.FirstName.name = "tbFirstName";tb.FirstName.placeholder = "Give me your name";tb.FirstName.style.top = "10px";tb.FirstName.style.etc.etc.etc;document.appendChild(tbFirstName);// later...console.log("somebody entered: " + tbFirstName.value); Link to comment Share on other sites More sharing options...
Recommended Posts