Hello guys i decide to share my game i created with you guys.
This might help you create a game of your own have fun.
/////////////////////////////////////////////////////////
//Click Me games is dsi/Pc game only ////
//This game was created by Maleckjohnson as M.j king ////
//Please ask before using this game script to your own //
//CopyRight 2012 by maleckjohnson ////
/////////////////////////////////////////////////////////
var GameObj = new XMLHttpRequest();
var SObj = new XMLHttpRequest();
var clickCount =0;
var countStop =30;
/*------------Check to see if there a username-----------------*/
function Play() {
var usern = document.getElementById('username').value;
if(usern ==''){
alert('Note: It seem you are a guest you need to login');
}
else{
setInterval("CountStop()",1000);
setTimeout("Get_Game()",1000);
alert('Welcome ' +usern+ ' To Click Me the game!');
document.getElementById("Send").style.display = "none";
document.getElementById('Game').innerHTML="<div class=background:green;width:238px;border:1px inset black;>Loading.....</div>";
document.getElementById("Body").style.backgroundColor = "lightblue";
}
}
/*-------------Connecting you online------------------------*/
function Get_Game() {
document.getElementById("Body").style.backgroundColor = "lightgreen";
document.getElementById('Game').innerHTML="<div class=background:green;width:238px;border:1px inset black;>Please wait as we connect you online...</div>";
setTimeout("Set_up_Game()",2000);
}
/*----------------Set the game up----------------------*/
function Set_up_Game() {
if (GameObj.readyState==4 && GameObj.status==200) {
document.getElementById("Game").innerHTML=GameObj.responseText;
}
GameObj.open("GET","Game1_ready.php",true);
GameObj.send();
}
/*-----------Timer check------------------------------------*/
function CountStop() {
var checkTime = document.getElementById('clicked2').value = --countStop;
if(checkTime ==0){
alert('Sorry your time is up your score is ' +clickCount+ ' ');
document.getElementById("Stop").style.display = "none";
document.getElementById("clicked2").style.display = "none";
document.getElementById('Status').innerHTML="Please wait as we submit your score........";
document.getElementById("Body").style.backgroundColor = "red";
setTimeout("Score()",1000);
}
}
/*----------------------Submit the score------------------------*/
function Score() {
SObj.onreadystatechange=function() {
if (SObj.readyState==4 && SObj.status==200) {
document.getElementById('Status').innerHTML="Your score was submitted please refresh<br><a href=Game1.php>Restart</a>? | <a href=Home.php>No</a>";
SObj.responseText;
}
}
var score = document.getElementById('clicked').value=""+clickCount;
SObj.open("GET","Game_score.php?clicked="+score,true);
SObj.send();
}
/*---------------The Game it self----------------------*/
function Count_click() {
var checkcount = document.getElementById('clicked').value = ++clickCount;
if(checkcount == 10){
document.getElementById('Status').innerHTML="10 is your recorder";
}
if(checkcount == 50){
document.getElementById('Status').innerHTML="50 is your recorder";
}
if(checkcount == 100){
document.getElementById('Status').innerHTML="100 is your recorder";
}
if(checkcount == 200){
document.getElementById('Status').innerHTML="200 is your recorder";
}
if(checkcount == 300){
document.getElementById('Status').innerHTML="300 is your recorder";
}
if(checkcount == 1000){
document.getElementById('Status').innerHTML="1000 is your recorder";
}
if(checkcount == 2000){
document.getElementById('Status').innerHTML="2000 is your recorder";
}
if(checkcount == 3000){
document.getElementById('Status').innerHTML="3000 is your recorder";
}
if(checkcount == 4000){
document.getElementById('Status').innerHTML="4000 is your recorder";
}
if(checkcount == 5000){
document.getElementById('Status').innerHTML="5000 is your recorder";
}
if(checkcount == 7000){
document.getElementById('Status').innerHTML="7000 is your recorder";
}
if(checkcount == 10000){
alert('Wow you broke a new record 10000 is the max of the game you go in the book');
document.getElementById('Status').innerHTML="10000 is your recorder Wow";
}
}
window.onload = function() {
Set_up_Game();
}