Jump to content

Need to load my game with some predefined vars - score, profile data


montane
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

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