Do you like my tutorials?

Then consider supporting me on Ko-fi

Talking about MagOrMin game, Css, Game development, Html and Php.

This is an ooooooold (let’s call it) game I explained for a web programming class in 2003 or 2004.

It was made to explain some basics about Php, sessions, MySql and styles. All in one.

That’s how students learn… all in one and with a real world example.

It’s just a “guess if next number will be higher or slower than the current one” concept, the same that I applied to GuessNext last year.

It’s called MagOrMin and the name comes from the italian translation of “higher” (maggiore) and “lower” (minore).

MagOrMin

Simply click to say if next number will be higher or lower, gain extra lives and compete for the high scores.

I plan to port the game in Ajax, adding a so-called “Web 2.0” style and convert it into a Facebook application with all features… you know… I must monetize everything…

Meanwhile here it is the source code:

= $old_number)) or (($guess == "smaller") and ($actual_number <= $old_number))){
		$score ++;
		$class_to_show = "number";
		$game_status = "PLAYING";
		if ($score == $next_extra){
			$lives +=1;
			$next_extra = floor($next_extra*1.5);
		}
	}
	else{
		$lives -=1;
		$class_to_show = "number_wrong";
		if ($lives==0){
			$game_status = "GAME_OVER";
			$perso_ora = true;
		}
	}
}

if ($game_status == "GAME_OVER"){
	$class_to_show = "number_wrong";
	if(!$perso_ora){
		$actual_number = $old_number;
	}
}

//echo $game_status;

?>






WELCOME TO PHP-MAGORMIN v1.0

  • Score: $score
  • Lives: $lives
  • Extra life at $next_extra"; ?>

    CURRENT NUMBER
    I guess next number will be GAME OVER
    Enter your name:
    I guess next number will be
  • I’ll explain the entire process to convert it into a Facebook app.

    Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.