Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

can i make a game with a database for highscores? working on one tablet without a LMS?

Community Beginner ,
May 12, 2015 May 12, 2015

can i make a game with a database for highscores? working on one tablet without a LMS?

252
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 12, 2015 May 12, 2015

Do you have a webserver that you can you a database on?

Do you have a PHP programmer that can read/write information from Captivate and the database?

What do you mean "working on one tablet"?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 12, 2015 May 12, 2015

The tablet/laptop is going to use in a area without any internet.

no we have no php programmer

the tablet is going to use by  more then one person to play the game

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 13, 2015 May 13, 2015
LATEST

This code should get you started.

create a user variable isHighScore = 0;

to trigger the function, call javascript: setScore("youVariableScore"); which will set the isHighScore accordingly.

In an advanced action show or hide your high score message absed on isHighScore = 1 for true.

Put the following code in the head section of your html or js file .

function setScore(sentScore)
{
var gs = Number(localStorage.getItem("highScore"));
var ss = Number(sentScore);

if (ss > gs)
{
  localStorage.setItem("highScore", sentScore);
  window.isHighScore = 1;
}
else
{
  window.isHighScore = 0;
}
}

function setStorage()
{
if (localStorage.getItem("highScore") === null)
{
  localStorage.setItem("highScore", 0);
}
}

var interfaceObj;
var eventEmitterObj;

window.addEventListener("moduleReadyEvent", function(evt)
{
interfaceObj = evt.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
    initializeEventListeners();
});

function initializeEventListeners()
{
if(interfaceObj)
{
     if(eventEmitterObj)
  {
         eventEmitterObj.addEventListener("CPAPI_SLIDEENTER",function(e){  
   setStorage();
            });
  }
}
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources