montane Posted March 21, 2016 Share Posted March 21, 2016 The website I am working on has a game embedded in a page. Between levels the player navigates away from the game and is shown some page content (the game incentivises the customer to view the content using game play between viewing the pages. The user has a logged in status in a user table in Wordpress and they score points, playing the game, I save these in the database with e..g an ajax call from the game and php script. Then the user views a page of content. AFter viewing this page of content they get to play the game again, build on their score and the game has a new level. I could do an ajax call from the game to see if there are some variables for that player, such as their score, name etc from their profile. My game is split into states - preload, boot, game. I was planning on putting the ajax call in the create function of the game state. Does anyone have any experience with this? and can advise. Link to comment Share on other sites More sharing options...
Alexalten Posted March 21, 2016 Share Posted March 21, 2016 Hi, could You consider the use of localStorage or sessionStorage (maybe better in this case)? Link to comment Share on other sites More sharing options...
montane Posted March 22, 2016 Author Share Posted March 22, 2016 HI, Thanks for the response. The main thing is that I have a little bit of work to do saving a user in a database and leaving the game to view a standard page with content before restarting the game. In Wordpress it is possible to use wp_localize_script to pass variables to javascript from php so that is a starting point I have been looking into. Andy Link to comment Share on other sites More sharing options...
Recommended Posts