Thread: Mys 1.3.4 Higher Or Lower Game
View Single Post
  #30  
Old 02-16-2016, 11:37 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,419
NobodysHero is on a distinguished road
Default Same issue: No Longer Displays Cards After 1st Turn.

I have that same issue. The only file I changed was the hilo_non.js to update the amount of money offered. Also, doesn't appear that my score is updating? Having the same issue with the Word Scramble game, which used your coding as a foundation.

Below is my hilo_non.js file and some screenshots for reference and piece of mind. Didn't included view and index file screenshots, but both are placed appropriately.

Code:

PHP Code:
$(function() {
    
checkPlays();
});

var 
plays 20;
var 
score 0;
var 
first Math.floor(Math.random()*16);

$(
'.first').html(first);

$(
'.guess').click(function(){
  if (
plays >= 0){
    var 
second Math.floor(Math.random()*16);
    $(
'.second').html(second);
    if ($(
this).hasClass('higher')){
      if (
first <= second){
        
resultIs('correct'second);
        
sendScore(150);
      } else {
        
resultIs('incorrect'second);
        
sendScore(0);
      }
    }
    if ($(
this).hasClass('lower')){
      if (
first >= second){
        
resultIs('correct'second);
        
sendScore(150);
      } else {
        
resultIs('incorrect'second);
        
sendScore(0);
      }
    }
  }
});

function 
resultIs(resultsecond){
  $(
'.result').html(result);
  $(
'.result').fadeIn(1000, function(){
    $(
'.first').fadeOut(500);
      $(
'.second').fadeOut(500, function(){    
      $(
'.first').html(second);
      
first second;
      
plays plays 1;
      $(
'.first').fadeIn(500);
      $(
'.second').html('?');
      $(
'.second').fadeIn(500);      
      $(
'.plays').html(plays);
      if (
result == 'correct'){
        
score score 150;
        
current parseFloat(window.parent.$('.money').text());
        
window.parent.$('.money').fadeTo(1000.1);
        
window.parent.$('.money').text((current score));
        
window.parent.$('.money').fadeTo(1001);
      }
      $(
'.score').html(score);
      if (
plays <= 0){
        
disableGame();
      }
    });
  }); 
  $(
'.result').fadeOut(500);
}

function 
sendScore(amt) {
  var 
values = {
    
'username': $("#username").text(),
    
'amt'amt
  
};
  $.
ajax({
    
url"sendscore.php",
    
type"POST",
    
datavalues,
  }).
done(function(status){
    if (
status == "GameOver"){
      
disableGame();
    } else {
      $(
'.plays').html(status);
      
plays status;
    }
  });
}

function 
disableGame(){
  $(
'.plays').html("0");
  $(
'.guess').off('click');
  $(
'.guess').css'cursor''not-allowed' );
  $(
'.arrow-box').fadeTo('slow'0.3);
  $(
'.first').html('game');
  $(
'.second').html('over');
  $(
'.finalscore').html("<b>Plays Left Today:</b> 0 of 20<h2>See You Tomorrow!</h2>");
}

function 
checkPlays(){
  var 
values = {
    
'username': $("#username").text(),
    
'plays''check'
  
};
  $.
ajax({
    
url"sendscore.php",
    
type"POST",
    
datavalues,
  }).
done(function(status){
    if (
status == "GameOver"){
      
disableGame();
    } else {
      $(
'.plays').html(status);
      
plays status;
    }
  });

Screenshots:




Reply With Quote