Feature: add Word Fighter

This commit is contained in:
2017-09-28 13:20:33 +02:00
parent 6d8d52a934
commit 036ceb8def
52 changed files with 14294 additions and 21 deletions

View File

@@ -0,0 +1,40 @@
**Word Fighters** is a word game where you must find a maximum words to get the highscore.
How to :
---
When you click on the "Start" button, a combinaison of letters is generated.
The goal is to retrieve a maximum of words with these letters using your keyboard.
To validate a word, simply press the "Enter" key.
To get new letters, press the "Space" bar.
* Easy : Search words between 3 and 7 letters
* Medium : Search words between 3 and 6 letters
* Hard : Search words between 4 and 7 letters
* Extreme : No escape ! You can\'t have new letters before reach all words !
If you are blocked, you can switch letters but be careful : you loose 5 points per words not found !!
A live demo is avalaible here
Under the hood :
---
Originally designed to run with a server, it's playable such as.
If running with a server, 2 modes are availables :
* 1 player : Try to beat your highscore. Include the *wordfighters_single.js* to enable the server pipe.
* 2 players : Try to defeat your opponent hitting him/her. The longest the word found is, the stongest damages are !! Include the *wordfighters_multplayer.js* to enable the server pipe.
Words dictionary is provided by the [Scrabble-Resolver](https://github.com/Febbweiss/scrabble-resolver) project.
Currently, only english and french dictionaries are provided.
Credits :
---
+ Graphics : Namco™ from "Super Puzzle Fighters 2" and "Super Gems Fighters
+ Code : Fabrice Ecaille aka Febbweiss
+ Tools : gameQuery
Licences :
---
Source code is under MIT Licence Sprite is under CC BY-SA 3.0

View File

@@ -0,0 +1,414 @@
.letter {
width: 62px;
height: 62px;
background-image: url( "../images/scrabble_sprite.png" );
background-position: -372px -186px;
display: inline-block;
}
.blank {
width: 16px;
height: 16px;
display: block;
float: left;
}
.a {
background-position: 0px 0px;
}
.b {
background-position: -62px 0px;
}
.c {
background-position: -124px 0px;
}
.d {
background-position: -186px 0px;
}
.e {
background-position: -248px 0px;
}
.f {
background-position: -310px 0px;
}
.g {
background-position: -372px 0px;
}
.h {
background-position: 0px -62px;
}
.i {
background-position: -62px -62px;
}
.j {
background-position: -124px -62px;
}
.k {
background-position: -186px -62px;
}
.l {
background-position: -248px -62px;
}
.m {
background-position: -310px -62px;
}
.n {
background-position: -372px -62px;
}
.o {
background-position: 0px -124px;
}
.p {
background-position: -62px -124px;
}
.q {
background-position: -124px -124px;
}
.r {
background-position: -186px -124px;
}
.s {
background-position: -248px -124px;
}
.t {
background-position: -310px -124px;
}
.u {
background-position: -372px -124px;
}
.v {
background-position: 0px -186px;
}
.w {
background-position: -62px -186px;
}
.x {
background-position: -124px -186px;
}
.y {
background-position: -186px -186px;
}
.z {
background-position: -248px -186px;
}
.hideLetter {
visibility: hidden;
}
.showLetter {
visibility: visible;
}
#typed {
height: 62px;
}
#typed span img {
display: none;
}
#valid div {
float: none;
clear: both;
}
#valid span {
font-weight: bold;
}
#valid ul {
list-style-type:none;
}
#valid li {
display: block;
float: left ;
margin-left:2px;
margin-bottom:2px;
padding:2px;
height: 1em;
text-align: center;
}
#valid3 li {
width: 2em;
}
#valid4 li {
width: 3em;
}
#valid5 li {
width: 4em;
}
#valid6 li {
width: 5em;
}
#valid7 li {
width: 6em;
}
#howtoLayout {
}
#howto {
position:fixed;
_position:absolute; /* hack for internet explorer 6*/
z-index:1;
}
.levelChoice {
height: 60%;
opacity: 0.85;
position:relative;
width: 100%;
height: 40px;
margin-bottom: 5px;
}
.levelChoice:HOVER {
cursor: pointer;
}
.levelChoice .character {
float: left;
}
#playground {
height: 96px;
clear: both;
}
.character {
width: 40px;
height: 40px;
background-image: url( "../images/characters.png" );
opacity: 0.6;
}
.character.box_center {
position:absolute;
left: 50%;
top: 50%;
margin-top: -20px; /* moiti<74> de la hauteur */
margin-left: -20px; /* moiti<74> de la largeur */
}
.character.E {
background-position: 0px 0px;
}
.character.M {
background-position: -40px 0px;
}
.character.H {
background-position: -80px 0px;
}
.character.X {
background-position: -120px 0px;
}
.character.VS {
background-position: -160px 0px;
}
#countdown {
position: relative;
margin-left: auto;
margin-right: auto;
width: 48px;
top: 2px;
}
.clock {
background: transparent url( "../images/font.png" ) no-repeat top left;
height:16px;
width:16px;
float:left;
}
.n0 {
background-position : 0 0px;
}
.n1 {
background-position : -16px 0;
}
.n2 {
background-position : -32px 0;
}
.n3 {
background-position : -48px 0;
}
.n4 {
background-position : -64px 0;
}
.n5 {
background-position : -80px 0;
}
.n6 {
background-position : -96px 0;
}
.n7 {
background-position : -112px 0;
}
.n8 {
background-position : -128px 0;
}
.n9 {
background-position : -144px 0;
}
#scoreboard {
position: absolute;
left: 10px;
top: 2px;
width: 96px;
height: 16px;
}
#scoreboard .n0 {
background-position : -160px 0;
}
#scoreboard .n1 {
background-position : -176px 0;
}
#scoreboard .n2 {
background-position : -192px 0;
}
#scoreboard .n3 {
background-position : -208px 0;
}
#scoreboard .n4 {
background-position : -224px 0;
}
#scoreboard .n5 {
background-position : -240px 0;
}
#scoreboard .n6 {
background-position : -256px 0;
}
#scoreboard .n7 {
background-position : -272px 0;
}
#scoreboard .n8 {
background-position : -288px 0;
}
#scoreboard .n9 {
background-position : -304px 0;
}
#step_title {
height: 16px;
position: absolute;
left: 50%;
top: 50%;
margin-top: -8px;
}
.portrait {
width: 264px;
height: 225px;
visibility: hidden;
background-image: url( "../images/portraits.png" );
background-repeat: no-repeat;
position: relative;
margin-top: -130px;
margin-left: -100px;
top: 50%;
left: 50%;
}
.portrait.E {
background-position: 0px 0px;
}
.portrait.M {
background-position: -264px 0px;
}
.portrait.H {
background-position: -528px 0px;
}
.portrait.X {
background-position: -792px 0px;
}
.levelDescription {
position: relative;
clear: both;
padding: 15px;
}
.levelDescription div.level {
height: 16px;
float: left;
}
.desc {
position: absolute;
top: 32px;
left: 60px;
}
.health_bar {
height: 10px;
width: 100px;
position: absolute;
top: 5px;
background-color: black;
}
.health_level {
height: 8px;
position: relative;
margin: 1px;
}
.health_level.good {
background-color: green;
}
.health_level.middle {
background-color: yellow;
}
.health_level.bad {
background-color: red;
}
.level {
position: relative;
top: 7px;
left: 7px;
float: right;
}
.highlight {
display: none;
}
body {
position: fixed;
width: 550px;
left: 50%;
margin-left: -275px;
}
#waitingGame > div {
display: inline-block;
height: 261px;
float: left;
}
#level {
width:100%;
float: both;
}
#label {
width: 100%;
}
.button {
background-color: white;
border: 2px solid #e7e7e7;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border-radius: 12%;
margin: auto;
margin-top: 25px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -0,0 +1,192 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/wordfighters.css" />
<script src="lib/jquery-1.7.1.js" type="application/javascript"></script>
<script src="lib/jquery.i18n.js" type="application/javascript"></script>
<script src="lib/jquery.mockjax.min.js" type="application/javascript"></script>
<script src="lib/gamequery-0.7.1.js" type="application/javascript"></script>
<script src="lib/utf.js" type="application/javascript"></script>
<script src="lib/gunzip.min.js" type="application/javascript"></script>
<script src="js/mock.js" type="application/javascript"></script>
<script src="js/countdown.js" type="application/javascript"></script>
<script src="js/scoreboard.js" type="application/javascript"></script>
<script src="js/wordfighters.js" type="application/javascript"></script>
<script src="js/fighters.js" type="application/javascript"></script>
<script src="js/dictionary.js" type="application/javascript"></script>
<script type="application/javascript">
if( (navigator.language || navigator.userLanguage) == 'fr' ) {
$.i18n.load(dictionary.fr);
} else {
$.i18n.load(dictionary.en);
}
WordFighter.id = 0; // Used for multiplayer mode
WordFighter.mode = "single"; // 'dual' if multiplayer
var opponent = "/";
var game_waiting_ready=$.i18n._('game.waiting.ready');
var game_start=$.i18n._('game.start');
var game_win=$.i18n._('game.win');
var game_loose=$.i18n._('game.loose');
var game_draw=$.i18n._('game.draw');
</script>
</head>
<body>
<div id="waitingGame">
<div>
<div id="level" class="levelChoice"></div>
<div id="E" class="levelChoice">
<div id="easy" class="character E"></div>
<div id="levelE" class="level unfocus"></div>
<div id="levelEHighlight" class="level highlight"></div>
</div>
<div id="M" class="levelChoice">
<div id="medium" class="character M"></div>
<div id="levelM" class="level unfocus"></div>
<div id="levelMHighlight" class="level highlight"></div>
</div>
<div id="H" class="levelChoice">
<div id="hard" class="character H"></div>
<div id="levelH" class="level unfocus"></div>
<div id="levelHHighlight" class="level highlight"></div>
</div>
<div id="X" class="levelChoice">
<div id="extreme" class="character X"></div>
<div id="levelX" class="level unfocus"></div>
<div id="levelXHighlight" class="level highlight"></div>
</div>
</div>
<div>
<div id="fighter1portrait" class="portrait" style="visibility: visible;"></div>
</div>
<div id="label" style="bottom: 0px; position: relative; text-align: center;">
Search words between 3 and 7 letters
</div>
</div>
<div id="gamePanel" style="display: none;">
<div class="span7">
<div style="width: 384px; height: 125px; margin-left: auto; margin-right: auto;">
<div id="playground"></div>
</div>
<div id="letters">
<div id="typed">
<span> <img id="typed1" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed2" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed3" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed4" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed5" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed6" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="typed7" class="letter" src="images/0_dot.gif" /> </span>
</div>
<div id="suggested">
<span> <img id="letter1" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter2" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter3" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter4" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter5" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter6" class="letter" src="images/0_dot.gif" /> </span>
<span> <img id="letter7" class="letter" src="images/0_dot.gif" /> </span>
</div>
</div>
</div>
<div id="valid">
<div id="valid3column">
<span id="3lettersWords">3 letters</span>
<ul id="valid3"></ul>
</div>
<div id="valid4column">
<span id="4lettersWords">4 letters</span>
<ul id="valid4"></ul>
</div>
<div id="valid5column">
<span id="5lettersWords">5 letters</span>
<ul id="valid5"></ul>
</div>
<div id="valid6column">
<span id="6lettersWords">6 letters</span>
<ul id="valid6"></ul>
</div>
<div id="valid7column">
<span id="7lettersWords">7 letters</span>
<ul id="valid7"></ul>
</div>
</div>
</div>
<span class="button" style="display: none;">
<div id="replay" >
</div>
</span>
<script type="application/javascript">
$(document).ready(function () {
display_text($.i18n._('game.choose.level'), '#level', 1, false);
display_text($.i18n._('game.level.E'), '#levelE', 2);
display_text($.i18n._('game.level.E'), '#levelEHighlight', 1);
display_text($.i18n._('game.level.M'), '#levelM', 2);
display_text($.i18n._('game.level.M'), '#levelMHighlight', 1);
display_text($.i18n._('game.level.H'), '#levelH', 2);
display_text($.i18n._('game.level.H'), '#levelHHighlight', 1);
display_text($.i18n._('game.level.X'), '#levelX', 2);
display_text($.i18n._('game.level.X'), '#levelXHighlight', 1);
display_text($.i18n._('game.replay'), '#replay', 1, false);
$('#3lettersWords').html($.i18n._('wordfighter.letters', 3));
$('#4lettersWords').html($.i18n._('wordfighter.letters', 4));
$('#5lettersWords').html($.i18n._('wordfighter.letters', 5));
$('#6lettersWords').html($.i18n._('wordfighter.letters', 6));
$('#7lettersWords').html($.i18n._('wordfighter.letters', 7));
var currentLevel = null;
var labels = new Array();
labels[ "E" ] = $.i18n._('wordfighter.howto.E');
labels[ "M" ] = $.i18n._('wordfighter.howto.M');
labels[ "H" ] = $.i18n._('wordfighter.howto.H');
labels[ "X" ] = $.i18n._('wordfighter.howto.X');
$("#label").html( labels[ 'E'] );
$( ".levelChoice" ).hover(
function () {
$(this).find("div.character").css({ opacity: 1 });
$(this).find("div.unfocus").toggle();
$(this).find("div.highlight").toggle();
$("#fighter1portrait").addClass(this.id);
$("#label").html( labels[ this.id] );
},
function () {
$(this).find("div.character").css({ opacity: 0.6 });
$(this).find("div.unfocus").toggle();
$(this).find("div.highlight").toggle();
$("#fighter1portrait").removeClass(this.id);
}
);
$('.levelChoice').click(function() {
WordFighter.change_level( this.id );
WordFighter.notify_dual();
});
if( $.browser.webkit ) {
$(document).keydown(WordFighter.prevent_backspace);
}
$(document).keypress(WordFighter.keypressedHandler);
$(".button").bind( "click", function() {
window.location.reload();
} );
});
</script>
</body>
</html>

View File

@@ -0,0 +1,84 @@
var COUNTDOWN = {
mustStop: false,
init: function( minutes, seconds ) {
COUNTDOWN.minutes = minutes;
COUNTDOWN.seconds = seconds;
COUNTDOWN.mustStop = false;
// $( "#countdown" ).width( ( minutes > 0 ? 90 : 0 ) + 90);
// $( "#countdown" ).css( "background-color", "black" );
},
start: function() {
if( COUNTDOWN.mustStop )
return;
COUNTDOWN.running = true;
var currentMinutes = "";
var currentSeconds = "";
var imageMinutes = "";
var imageSeconds = "";
currentMinutes = COUNTDOWN.minutes;
currentSeconds = COUNTDOWN.seconds;
var nextMinutes = COUNTDOWN.minutes;
var nextSeconds = COUNTDOWN.seconds - 1;
if( nextSeconds < 0 && nextMinutes > 0 ) {
nextSeconds = 59;
nextMinutes = Math.min(0, nextMinutes -1);
}
COUNTDOWN.minutes = nextMinutes;
COUNTDOWN.seconds = nextSeconds;
if( currentMinutes <= 0 && currentSeconds < 10 )
$( "#countdown" ).css( "background-color", "red" );
if(parseInt(currentMinutes) < 10 ) currentMinutes = "0" + currentMinutes;
if(parseInt(currentSeconds) < 10 ) currentSeconds = "0" + currentSeconds;
for(i = 0; i < String(currentMinutes).length; i++) {
imageMinutes += "<div class='clock n"+ String(currentMinutes)[i]+"'></div>";
}
for(i = 0; i < String(currentSeconds).length; i++) {
imageSeconds += "<div class='clock n"+ String(currentSeconds)[i]+"'></div>";
}
if( COUNTDOWN.minutes > 0) {
$("#subMinutes").empty().removeClass( "hide" ).append( imageMinutes );;
$(".clock.clock.separator").removeClass( "hide" );
} else {
$("#subMinutes").empty().addClass( "hide" );
$(".clock.clock.separator").addClass( "hide" );
}
$("#subSeconds").empty().append( imageSeconds );
if( nextMinutes >= 0 && nextSeconds >= 0 )
setTimeout( "COUNTDOWN.start()", 1000 );
else
COUNTDOWN.callback();
},
add: function(seconds) {
console.log( "Adding " + seconds + " seconds to countdown" );
COUNTDOWN.seconds = COUNTDOWN.seconds + seconds;
},
setTime: function( seconds ) {
console.log( "Setting " + seconds + " seconds to countdown" );
COUNTDOWN.seconds = seconds;
},
stop: function() {
COUNTDOWN.mustStop = true;
},
callback: function() {
console.log( "COUNTDOWN.callback" );
}
};

View File

@@ -0,0 +1,52 @@
var dictionary = {
'en' : {
'wordfighter.howto.1' : 'When you click on the "Start" button, a combinaison of letters is generated.',
'wordfighter.howto.2' : 'The goal is to retrieve a maximum of words with these letters using your keyboard.',
'wordfighter.howto.3' : 'To validate a word, simply press the "Enter" key.',
'wordfighter.howto.4' : 'To get new letters, press the "Space" bar.',
'wordfighter.howto.E' : 'Search words between 3 and 7 letters',
'wordfighter.howto.M' : 'Search words between 3 and 6 letters',
'wordfighter.howto.H' : 'Search words between 4 and 7 letters',
'wordfighter.howto.X' : 'No escape ! You can\'t have new letters before reach all words !',
'wordfighter.title' : 'Word Fighters',
'wordfighter.letters' : '%s letters',
'game.no.score' : 'No highscore',
'game.waiting.opponent' : 'Waiting for your opponent',
'game.waiting.ready' : 'Get ready !!',
'game.start' : 'Start !!',
'game.win' : 'You win !!',
'game.loose' : 'You loose !!',
'game.draw' : 'Draw !!',
'game.replay' : 'Play again',
'game.level.E' : 'Easy',
'game.level.M' : 'Medium',
'game.level.H' : 'Hard',
'game.level.X' : 'Extrem',
'game.choose.level' : 'Choose your level'
},
'fr' : {
'wordfighter.howto.1' : 'Dès que vous cliquez sur le bouton "Jouer", une combinaison de lettres est générée.',
'wordfighter.howto.2' : 'Le but est de retrouver le maximum de mots avec ces lettres en utilisant le clavier.',
'wordfighter.howto.3' : 'Pour valider un mot, utilisez simplement la touche "Entrer".',
'wordfighter.howto.4' : 'Pour avoir un nouveau tirage, pressez la touche "Espace".',
'wordfighter.howto.E' : 'Trouver des mots de 3 à 7 lettres',
'wordfighter.howto.M' : 'Trouver des mots de 3 à 6 lettres',
'wordfighter.howto.H' : 'Trouver des mots de 4 à 7 lettres',
'wordfighter.howto.X' : 'Il n\'y a pas déchappatoire! Vous ne pouvez pas changer vos lettres tant que tous les mots n\'ont pas été trouvés!',
'wordfighter.title' : 'Word Fighters',
'wordfighter.letters' : '%s lettres',
'game.no.score' : 'Aucun score',
'game.waiting.opponent' : 'En attente de votre adversaire',
'game.waiting.ready' : 'Pret !!',
'game.start' : 'Partez !!',
'game.win' : 'Victoire !!',
'game.loose' : 'Vous avez perdu !!',
'game.draw' : 'Match nul !!',
'game.replay' : 'Rejouer',
'game.level.E' : 'Facile',
'game.level.M' : 'Intermediaire',
'game.level.H' : 'Diffile',
'game.level.X' : 'Extreme',
'game.choose.level' : 'Choisissez votre niveau'
}
}

View File

@@ -0,0 +1,563 @@
var PLAYGROUND_WIDTH = 384;
var PLAYGROUND_HEIGHT = 96;
var FIGHTER_STD_WIDTH = 82;
var FIGHTER_EXT_WIDTH = 126;
var FIGHTER_EXT_WIDTH_2 = 136;
var FIGHTER_EXT_WIDTH_3 = 95;
var FIGHTER_EXT_WIDTH_4 = 105;
var FIGHTER_EXT_WIDTH_5 = 86;
var FIGHTER1_POSX = PLAYGROUND_WIDTH / 2 - (FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH) / 2 - FIGHTER_STD_WIDTH;
var FIGHTER2_POSX = PLAYGROUND_WIDTH / 2 + (FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH) / 2;
var COUNTDOWN_WIDTH = 48;
var COUNTDOWN_POSX = (PLAYGROUND_WIDTH - COUNTDOWN_WIDTH) / 2;
var HEALTH_REFRESH_RATE = 15;
var FIGHTER_HEALTH = 60;
var LOOP_COUNT_REFRESH = 66;
var fighter1 = null;
var fighter2 = null;
var loopCount = 0;
var fighters = new Array();
$(function(){
//Playground Sprites
var background = new $.gameQuery.Animation({imageURL: "images/background.png", offsety: PLAYGROUND_HEIGHT * Math.floor(Math.random()*11)});
$("#playground").playground({height: PLAYGROUND_HEIGHT, width: PLAYGROUND_WIDTH, keyTracker: true});
$.playground().addGroup("background", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
.addSprite( "background1",
{posx: 0, posy: 0,
height: PLAYGROUND_HEIGHT, width: PLAYGROUND_WIDTH,
animation: background})
.end()
.addGroup("fighters", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
.end()
.addGroup( "hud", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
.end();
$("#hud").append("<div id='countdown'><div id='subSeconds'></div></div>");
$("#hud").append("<div id='step_title'></div>");
$.playground().registerCallback(function(){
if( fighter1 )
updateHealth( $("#player1_health_level"), fighter1.health / fighter1.maxHealth );
if( fighter2 ) {
updateHealth( $("#player2_health_level"), fighter2.health / fighter2.maxHealth );
//$("#player2_health_level").css( "margin-left", ( 100 - (fighter2.health / fighter2.maxHealth) * 100) );
}
loopCount++;
if( loopCount == LOOP_COUNT_REFRESH ) {
loopCount = 0;
var fighter = fighters[ "fighter1" ];
if( fighter && fighter.isIdle() ) {
fighter.node.width( FIGHTER_STD_WIDTH );
fighter.node.x( FIGHTER1_POSX );
}
fighter = fighters[ "fighter2" ];
if( fighter && fighter.isIdle() ) {
fighter.node.width( FIGHTER_STD_WIDTH );
fighter.node.x( FIGHTER2_POSX );
}
}
}, HEALTH_REFRESH_RATE);
$.playground().startGame( function() {});
addFighter = function( fighter) {
$("#fighters").addSprite("fighter1", {animation: fighter.animations["idle"], posx:FIGHTER1_POSX, posy: 15, width: FIGHTER_STD_WIDTH, height: FIGHTER_STD_WIDTH});
fighter.node = $("#fighter1");
fighter1 = fighter;
fighters[ "fighter1" ] = fighter;
};
addFighter2 = function( fighter ) {
$("#fighters").addSprite("fighter2", {animation: fighter.animations["idle"], posx:FIGHTER2_POSX, posy: 15, width: FIGHTER_STD_WIDTH, height: FIGHTER_STD_WIDTH});
fighter.node = $("#fighter2");
$("#fighter2").fliph(true);
fighter2 = fighter;
fighters[ "fighter2" ] = fighter;
};
addScoreBoard = function() {
$("#hud").append("<div id='scoreboard' class='scoreboard'><div class='subScoreboard'></div></div>");
};
addHealthBars = function() {
$("#hud").append("<div id='player1_health' style='left: 10px;' class='health_bar'><div id='player1_health_level' class='health_level good'></div></div>");
$("#hud").append("<div id='player2_health' style='left: " + (PLAYGROUND_WIDTH - 100 - 10) + "px;'class='health_bar'><div id='player2_health_level' class='health_level good reverse'></div></div>");
};
updateHealth = function( HTMLDiv, health ) {
HTMLDiv.removeClass();
HTMLDiv.addClass("health_level");
if( health > 2/3)
HTMLDiv.addClass("good");
else if( health > 1/3)
HTMLDiv.addClass("middle");
else
HTMLDiv.addClass("bad");
HTMLDiv.width( (health * 100) + "%" );
};
display_text = function( text, divId = "#step_title", offset = 1, changePosition = true ) {
var message = text.toLowerCase();
var divHTML = $(divId);
var html = "";
var yPos = offset * 16;
for( var i = 0; i < message.length; i++ ) {
var letter = message[i];
var x = ((97 - message.charCodeAt(i)) * 16);
if( letter == " " )
html += "<div class='blank'></div>";
else if( letter == "!" )
html += "<div class='clock' style='background-position: -416px -" + yPos + "px'></div>";
else
html += "<div class='clock' style='background-position: " + x + "px -" + yPos + "px'></div>";
}
divHTML.empty();
divHTML.width( (text.length * 16) + "px");
if( changePosition ) {
divHTML.css( "margin-left", "-" + (text.length * 8) + "px");
}
divHTML.append( html );
};
hide_text = function() {
$("#step_title").empty();
};
});
//Game objects:
function Fighter(){
this.node = null;
this.animations = new Array();
this.maxHealth = FIGHTER_HEALTH;
this.health = FIGHTER_HEALTH;
this.idle_state = false;
this.isIdle = function() {
return this.idle_state;
};
this.setIdle = function( state ) {
this.idle_state = state;
};
this.start = function() {
this.node.setAnimation(this.animations["start"],
function(node) {
fighters[ node.id ].idle();
});
};
this.idle = function() {
this.node.setAnimation(this.animations["idle"]);
this.setIdle( true );
};
this.punch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["punch"],
function(node) {
fighters[ node.id ].idle();
});
};
this.kick = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["kick"],
function(node) {
fighters[ node.id ].idle();
});
};
this.special = function() {};
this.victory = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["victory"]);
};
this.loose = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["loose"]);
};
this.ouch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["ouch"],
function(node) {
fighters[ node.id ].idle();
});
};
this.laught = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["laught"],
function(node) {
fighters[ node.id ].idle();
});
};
};
function Ryu(){
this.animations["start"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 8, offsety: 0, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 7, offsety: 82, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory2"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 4, offsety: 82, offsetx: 246, delta: FIGHTER_STD_WIDTH, rate: 200, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["idle"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 6, offsety: 164, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL});
this.animations["punch"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 6, offsety: 246, delta: FIGHTER_EXT_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["kick"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 7, offsety: 328, delta: FIGHTER_EXT_WIDTH_2, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["ouch"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 4, offsety: 410, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["laught"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 7, offsety: 492, delta: FIGHTER_EXT_WIDTH_3, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 9, offsety: 574, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose2"] = new $.gameQuery.Animation({imageURL: "images/ryu.png", numberOfFrame: 6, offsety: 656, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE});
};
Ryu.prototype = new Fighter();
Ryu.prototype.punch = function() {
this.node.width( FIGHTER_EXT_WIDTH );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["punch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Ryu.prototype.kick = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_2 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_2 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["kick"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x( FIGHTER_EXT_WIDTH_2 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Ryu.prototype.laught = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_3 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_3 - FIGHTER_STD_WIDTH),true);
}
this.node.setAnimation(this.animations["laught"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH_3 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Ryu.prototype.loose = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["loose"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["loose2"]);
});
}
Ryu.prototype.victory = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["victory"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["victory2"]);
});
}
function Sakura(){
this.animations["start"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 9, offsety: 334, delta: FIGHTER_EXT_WIDTH_3, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 7, offsety: 82, delta: FIGHTER_EXT_WIDTH_5, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory2"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 4, offsety: 82, offsetx: 258, delta: FIGHTER_EXT_WIDTH_5, rate: 200, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["idle"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 5, offsety: 0, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL});
this.animations["punch"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 5, offsety: 166, delta: FIGHTER_EXT_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["kick"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 6, offsety: 252, delta: FIGHTER_EXT_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["ouch"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 4, offsetx: 492, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
// this.animations["laught"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 7, offsety: 492, delta: FIGHTER_EXT_WIDTH_3, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 10, offsety: 412, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE });
// this.animations["loose2"] = new $.gameQuery.Animation({imageURL: "images/sakura.png", numberOfFrame: 6, offsety: 656, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE});
};
Sakura.prototype = new Fighter();
Sakura.prototype.victory = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["victory"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["victory2"]);
});
}
Sakura.prototype.punch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["punch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Sakura.prototype.kick = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["kick"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Sakura.prototype.laught = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_3 );
if( this.node.fliph() ) {
this.node.x(-(FIGHTER_EXT_WIDTH_3 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["start"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnodex(FIGHTER_EXT_WIDTH_3 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Sakura.prototype.loose = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["loose"]);
}
function Akuma(){
this.animations["start"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 11, offsety: 82, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 10, offsety: 328, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory2"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 8, offsety: 328, offsetx: 162, delta: FIGHTER_STD_WIDTH, rate: 200, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["idle"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 11, offsety: 0, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL});
this.animations["punch"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 5, offsety: 164, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["kick"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 7, offsety: 246, delta: FIGHTER_EXT_WIDTH_2, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["ouch"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 7, offsety: 576, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
// this.animations["laught"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 7, offsety: 492, delta: FIGHTER_EXT_WIDTH_3, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 9, offsety: 412, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose2"] = new $.gameQuery.Animation({imageURL: "images/akuma.png", numberOfFrame: 3, offsety: 494, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE});
};
Akuma.prototype = new Fighter();
Akuma.prototype.punch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["punch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Akuma.prototype.kick = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_2 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_2 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["kick"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH_2 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Akuma.prototype.victory = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["victory"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["victory2"]);
});
}
Akuma.prototype.loose = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["loose"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["loose2"]);
});
}
Akuma.prototype.ouch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x(-(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["ouch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
function Felicia(){
this.animations["start"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 10, offsety: 82, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 10, offsety: 328, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["victory2"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 5, offsety: 328, offsetx: 410, delta: FIGHTER_STD_WIDTH, rate: 200, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["idle"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 8, offsety: 0, delta: FIGHTER_STD_WIDTH, rate: 200, type: $.gameQuery.ANIMATION_HORIZONTAL});
this.animations["punch"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 6, offsety: 164, delta: FIGHTER_EXT_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["kick"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 7, offsety: 246, delta: FIGHTER_EXT_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["ouch"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 5, offsety: 492, delta: FIGHTER_EXT_WIDTH_4, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
// this.animations["laught"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 7, offsety: 492, delta: FIGHTER_EXT_WIDTH_3, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE | $.gameQuery.ANIMATION_CALLBACK});
this.animations["loose"] = new $.gameQuery.Animation({imageURL: "images/felicia.png", numberOfFrame: 6, offsety: 410, delta: FIGHTER_STD_WIDTH, rate: 150, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_ONCE });
};
Felicia.prototype = new Fighter();
Felicia.prototype.punch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["punch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Felicia.prototype.kick = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH );
if( this.node.fliph() ) {
this.node.x(-(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["kick"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}
Felicia.prototype.victory = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.setAnimation(this.animations["victory"],
function(node) {
fighters[ node.id ].node.setAnimation(fighters[ node.id ].animations["victory2"]);
});
}
Felicia.prototype.ouch = function() {
if( !this.isIdle() )
return;
this.setIdle( false );
this.node.width( FIGHTER_EXT_WIDTH_4 );
if( this.node.fliph() ) {
this.node.x( -(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH), true);
}
this.node.setAnimation(this.animations["ouch"],
function(node) {
var HTMLnode = fighters[ node.id ].node;
HTMLnode.width( FIGHTER_STD_WIDTH );
if( HTMLnode.fliph() ) {
HTMLnode.x(FIGHTER_EXT_WIDTH_4 - FIGHTER_STD_WIDTH, true);
}
fighters[ node.id ].idle();
});
}

View File

View File

@@ -0,0 +1,207 @@
var lexik = null;
var enigma = null;
var score = 0;
var time = 0;
$(document).ready(function() {
var oReq = new XMLHttpRequest();
oReq.open("GET", "resources/french", true);
oReq.responseType = "arraybuffer";
oReq.onload = function(oEvent) {
var arrayBuffer = oReq.response;
// if you want to access the bytes:
var byteArray = new Uint8Array(arrayBuffer);
var gunzip = new Zlib.Gunzip(new Uint8Array(byteArray));
var plain = gunzip.decompress();
lexik = JSON.parse(Utf8ArrayToStr(plain));
};
oReq.send();
});
function generateEnigma(level) {
var min = 3, max = 7;
switch( level ) {
case 'E' :
min = 3;
max = 7;
break;
case 'M' :
min = 3;
max = 6;
break;
case 'H' :
min = 4;
max = 7;
break;
default :
min = 3;
max = 6;
}
var mustRun = false;
var letters;
var allWords = {};
do {
letters = getRandomSet(max);
allWords = getWords2param(letters, min);
var wordsCount = 0;
for (var i = min; i < max + 1; i++) {
var words = allWords[i];
if (words != null) {
wordsCount += words.length;
}
}
mustRun = wordsCount < (max + min) * 0.7;
} while (mustRun);
return {letters: letters, words: allWords, minLength: min, maxLength: max};
}
function getRandomSet( maxLetter) {
var statistics = lexik.statistics;
var max = 0.0;
for (var i = 0; i < 26; i++) {
max += statistics[i];
}
var letters = [];
for (var i = 0; i < maxLetter; i++) {
letters[i] = getRandomLetter(max, statistics);
}
return letters.sort();
}
function getRandomLetter(max, statistics) {
var r = Math.random() * max;
max = 0.0;
for (var i = 0; i < 26; i++) {
max += statistics[i];
if (r < max) {
return String.fromCharCode(i + 97);
}
}
return 'z';
}
function getWords2param(letters, minimum) {
var words = [];
for (var i = letters.length; i > 2; i--) {
var newWords = getWords(letters, minimum, i);
if (newWords != null && newWords.length > 0 ) {
for( var j = 0; j < newWords.length; j++) {
if( words.indexOf(newWords[j]) == -1 ) {
words.push(newWords[j]);
}
}
}
}
var lists = {};
for (var i = 0; i < words.length; i++) {
var word = words[i];
var list = lists[word.length];
if (list === undefined) {
list = [];
lists[word.length] = list;
}
list.push(word);
}
for (var i = letters.length; i > 2; i--) {
var list = lists[i];
if (list !== undefined) {
list = list.sort();
}
}
return lists;
}
function getWords(letters, minimum, size) {
if (size < minimum) {
return null;
}
var setSize = letters.length;
if (size == setSize) {
var currentNode = lexik.nodes.nodes[letters[0]];
if (currentNode == null) {
return null;
}
for (var i = 1; i < setSize; i++) {
currentNode = currentNode.nodes[letters[i]];
if (currentNode == null) {
return null;
}
if (i == setSize - 1) {
return currentNode.words;
}
}
return null;
}
var results = [];
for (var i = 0; i < setSize - size; i++) {
for (var j = 0; j < setSize; j++) {
var words = getWords(letters.slice(0,j).concat(letters.slice(j+1)), minimum, size - i);
if (words != null && words.length > 0) {
results = results.concat(words);
}
}
}
return results.sort();
}
$.mockjax({
url: "/wordFighter/levelChoice",
status: 200
});
$.mockjax({
url: "/wordFighter/ready",
status: 200
});
$.mockjax({
url: "/wordFighter/newEnigma",
contentType: "application/json",
response: function(data) {
enigma = generateEnigma(data.data.level);
if( time != 0 ) {
enigma.remaining_time = 60 - (new Date().getTime() - time) / 1000;
score = 0;
} else {
enigma.remaining_time = 60;
}
time = new Date().getTime();
this.responseText = JSON.stringify(enigma)
}
});
$.mockjax( {
url: '/wordFighter/get_ready',
contentType: 'text/html',
responseText: '<div>\
<div style="height: 261px;">\
<div id="fighter1portrait" class="portrait"></div>\
</div>\
</div>\
<div style="height: 261px;width: 96px;">\
<div id="versus" style="width: 96px;height: 16px;margin-left: -48px;margin-top: -8px;position: relative;left: 50%;top: 50%;">\
<div id="howToPlay"></div>\
</div>\
</div>\
<div>\
<div style="height: 261px;">\
<div id="fighter2portrait" class="portrait"></div>\
</div>\
</div>'
})
$.mockjax( {
url: '/wordFighter/gameOver',
contentType: 'text/html',
responseText: ''
});

View File

@@ -0,0 +1,44 @@
var SCOREBOARD = {
score: 0,
scoreLength: 6,
init: function(size) {
if( typeof size !== "undefined" )
SCOREBOARD.scoreLength = size;
SCOREBOARD.score = 0;
SCOREBOARD.set_score( 0 );
},
add: function(addToScore, div) {
SCOREBOARD.set_score( SCOREBOARD.score + addToScore, div);
},
set_score: function( score, div ) {
var currentScore = "";
var imageScore = "";
SCOREBOARD.score = score;
currentScore = SCOREBOARD.pad();
for(i = 0; i < String(currentScore).length; i++) {
imageScore += "<div class='clock n"+ String(currentScore)[i]+"'></div>";
}
if( typeof div === "undefined" )
div = $(".subScoreboard");
div.empty();
div.append( imageScore );
},
pad: function() {
var str = '' + SCOREBOARD.score;
while (str.length < SCOREBOARD.scoreLength) {
str = '0' + str;
}
return str;
},
callback: function() {
console.log( "SCOREBOARD.callback" );
}
};

View File

@@ -0,0 +1,440 @@
var DURATION = 60;
var WordFighter = {
id: null,
word: "",
started: false,
activeKeypress: false,
level: 'E',
answers: null,
letters: null,
score: 0,
combo: 0,
opponentCombo: 0,
first: true,
opponentLevel: null,
startDate: null,
toggle_howto: function() {
$('#howto').slideToggle();
},
change_level: function( chosenLevel ) {
WordFighter.level = chosenLevel;
switch( chosenLevel ) {
case 'E' :
$("#valid3header").show();
$("#valid3column").show();
$("#valid7header").show();
$("#valid7column").show();
break;
case 'M' :
$("#valid3header").show();
$("#valid3column").show();
$("#valid7header").hide();
$("#valid7column").hide();
break;
case 'H' :
$("#valid3header").hide();
$("#valid3column").hide();
$("#valid7header").show();
$("#valid7column").show();
break;
case 'X' :
$("#valid3header").show();
$("#valid3column").show();
$("#valid7header").hide();
$("#valid7column").hide();
break;
}
},
notify_dual: function() {
$.ajax({
url: '/wordFighter/levelChoice',
data: { level: WordFighter.level },
success: function(data){
$("#waitingGame").load('/wordFighter/get_ready', function() {
console.log( "Current opponent : " + WordFighter.opponentLevel );
console.log( data );
display_text('versus', '#howToPlay', 1, false);
$("#fighter1portrait").addClass( WordFighter.level );
$("#fighter1portrait").css( "visibility", "visible");
addFighter( WordFighter.get_fighter( WordFighter.level) );
addScoreBoard();
WordFighter.opponentLevel = WordFighter.get_random_fighter();
setTimeout( function() {
WordFighter.start_game();
}, 3000 );
WordFighter.set_opponent();
});
}
});
},
get_fighter : function(level) {
switch( level ) {
case 'E' :
return new Sakura();
case 'M' :
return new Ryu();
case 'H' :
return new Felicia();
case 'X' :
return new Akuma();
}
},
get_random_fighter : function() {
var levels = new Array();
levels[ 0 ] = 'E';
levels[ 1 ] = 'M';
levels[ 2 ] = 'H';
levels[ 3 ] = 'X';
return levels[ Math.floor(Math.random() * 4) ];
},
set_opponent: function() {
var fighter2Div = $("#fighter2portrait");
if( fighter2Div != "undefined" && WordFighter.opponentLevel != null ){
fighter2Div.addClass(WordFighter.opponentLevel);
fighter2Div.css( "visibility", "visible");
addFighter2( WordFighter.get_fighter( WordFighter.opponentLevel ) );
}
},
hit_opponent: function( hit ) {
fighter2.ouch();
fighter2.health = fighter2.health - hit;
},
start_game: function() {
$("#waitingGame").hide();
$("#gamePanel").show();
$("#start").attr("disabled","disabled");
$("#level").attr("disabled","disabled");
fighter1.start();
fighter2.start();
display_text(game_waiting_ready);
WordFighter.activeKeypress = false;
WordFighter.clean();
WordFighter.first = true;
WordFighter.init_score();
COUNTDOWN.init(0, DURATION);
SCOREBOARD.init();
setTimeout( function() {
WordFighter.new_word();
COUNTDOWN.callback = function() {
$('#start').removeAttr('disabled');
$('#level').removeAttr('disabled');
WordFighter.game_over();
};
}, 3000)
},
setLetter: function( index, character ) {
$( "#letter" + index ).removeClass();
$( "#letter" + index ).addClass( "letter" );
$( "#letter" + index ).addClass( character );
},
keypressedHandler: function( event ) {
if( WordFighter.activeKeypress )
return false;
WordFighter.activeKeypress = true;
if( event.which == 32 && WordFighter.level != 'X' ) { // space
while( WordFighter.erase() );
WordFighter.started = false;
WordFighter.new_word();
WordFighter.activeKeypress = false;
return true;
}
if( event.which == 13 ) { // enter
WordFighter.check_word();
WordFighter.activeKeypress = false;
return true;
}
if( event.which == 8 && !$.browser.safari) { // backspace
if( WordFighter.word.length > 0 ) {
WordFighter.erase();
WordFighter.activeKeypress = false;
}
return false;
}
var character = String.fromCharCode(event.which);
for( var index = 1; index < 8; index++ )
{
if( WordFighter.process( index, character, "hide" ) ) {
$( "#typed" + (WordFighter.word.length + 1) ).show();
$( "#typed" + (WordFighter.word.length + 1) ).addClass( character );
WordFighter.word += character;
WordFighter.activeKeypress = false;
return true;
}
}
WordFighter.activeKeypress = false;
return true;
},
// Hack for Chrome
prevent_backspace: function( event ) {
if( event.which == 8 ) { // backspace
if( WordFighter.word.length > 0 ) {
WordFighter.erase();
WordFighter.activeKeypress = false;
}
return false;
}
},
clean: function() {
for( var index = 1; index < 8; index++ ) {
var character = WordFighter.word.charAt( index );
$( "#typed" + WordFighter.word.length ).removeClass( character );
$( "#letter" + index ).removeClass();
$( "#letter" + index ).addClass( "letter" );
}
},
erase: function() {
var character = WordFighter.word.charAt( WordFighter.word.length - 1);
for( var index = 1; index < 8; index++ )
{
if( WordFighter.process( index, character, "show" ) ) {
$( "#typed" + WordFighter.word.length ).hide();
$( "#typed" + WordFighter.word.length ).removeClass( character );
WordFighter.word = WordFighter.word.substring(0, WordFighter.word.length - 1);
return true;
}
}
return false;
},
process: function( index, character, visibility ) {
if( $( "#letter" + index ).hasClass( character ) )
{
if( ( visibility === "hide" && $( "#letter" + index ).hasClass( "hideLetter" ) )
|| ( visibility === "show" && $( "#letter" + index ).hasClass( "showLetter" ) ) ) {
return false;
}
$( "#letter" + index ).addClass( visibility + "Letter");
$( "#letter" + index ).removeClass( visibility === "show" ? "hideLetter" : "showLetter" );
return true;
}
return false;
},
new_word: function() {
if( WordFighter.started ) {
return false;
}
WordFighter.combo = 0;
$.ajax({
url: '/wordFighter/newEnigma',
data: {level: WordFighter.level},
success: function(data){
console.log("Ajax : ");
console.log(data);
WordFighter.letters = data.letters;
for( i = 1; i < WordFighter.letters.length + 1; i++ )
{
WordFighter.setLetter( i, data.letters[ i - 1 ] )
}
WordFighter.answers = data.words;
var rest = 0;
var total = 0;
for( var i = 3; i < 8; i++ ) {
total += $( "#valid" + i).length;
rest += $( "#valid" + i).find( ":empty" ).length;
}
if( !WordFighter.first ) {
if( rest == 0) {
COUNTDOWN.add( total * 5 );
WordFighter.change_score( WordFighter.score + total * 5 );
} else {
if( rest / total < 0.5 )
fighter2.kick();
else
fighter2.punch();
fighter1.ouch();
WordFighter.change_score( Math.max( 0, WordFighter.score -5 * rest ) );
}
}
for( i = data.minLength; i < data.maxLength +1; i++ )
{
$( "#valid" + i ).empty();
var obj = data.words[i];
var count = 0;
if( obj != undefined )
count = obj.length;
for( j = 0; j < count; j++ )
{
$( "#valid" + i ).append( "<li id=\"valid" + i + "-" + j + "\" style=\"background-color:yellow\"></li>");
}
}
WordFighter.started = true;
if( WordFighter.first ) {
WordFighter.startDate = new Date();
COUNTDOWN.start();
display_text( game_start );
setTimeout( function() {
hide_text();
}, 1500);
WordFighter.first = false;
}
}
});
},
check_word: function() {
var lAnswers = WordFighter.answers[ WordFighter.word.length ];
var position = -1;
if( lAnswers )
position = lAnswers.indexOf( WordFighter.word );
if( position == -1 ) {
WordFighter.combo = 0;
WordFighter.activeKeypress = true;
while(WordFighter.erase());
WordFighter.activeKeypress = false;
return false;
}
else {
WordFighter.activeKeypress = true;
if( $("#valid" + WordFighter.word.length + "-" + position).text().length == 0 ) {
WordFighter.combo++;
if( ( WordFighter.combo % 3 ) == 0 )
fighter1.kick();
else
fighter1.punch();
WordFighter.hit_opponent( WordFighter.word.length );
$("#valid" + WordFighter.word.length + "-" + position).append( WordFighter.word );
WordFighter.change_score( WordFighter.score + 10 * WordFighter.word.length );
WordFighter.check_validated();
}
}
while(WordFighter.erase());
WordFighter.activeKeypress = false;
},
check_validated: function() {
var rest = 0;
for( var i = 3; i < 8; i++ ) {
rest += $( "#valid" + i).find( ":empty" ).length;
}
if( rest == 0 ) {
while( WordFighter.erase() );
WordFighter.started = false;
WordFighter.new_word();
WordFighter.activeKeypress = false;
}
},
game_over: function() {
COUNTDOWN.stop();
WordFighter.show_game_over();
WordFighter.activeKeypress = true;
var highscore = true;
var win = WordFighter.score > 0;
for( i = 3; i < 8; i++ )
{
var words = WordFighter.answers[i];
if( words != undefined )
{
for( j = 0; j < words.length; j++ )
{
var id = "#valid" + ( words[ j ].length ) + "-" + j;
$( id ).empty();
$( id ).append( words[ j ] );
}
}
}
WordFighter.started = false;
},
show_game_over: function() {
$('.button').show();
/*
$.ajax({
url: "/wordFighter/gameOver",
data: {level: WordFighter.level},
success: function(data){
$("#modalDialog").prepend(data).modal({backdrop: false, show: true});
$(".replayButton").bind( "click", function() {
if( WordFighter.mode!="dual")
window.location.href = "/wordFighter/game";
else
window.location.href = "/wordFighter/invite/" + opponent;
} );
}
});
*/
},
init_score: function() {
WordFighter.score = 0;
SCOREBOARD.init();
},
change_score: function(score) {
WordFighter.score = score;
SCOREBOARD.set_score( WordFighter.score );
}
};
function drawText( divHTML, message ) {
var html = "";
for( var i = 0; i < message.length; i++ ) {
var letter = message[i];
var x = ((97 - message.charCodeAt(i)) * 16);
if( letter == " " )
html += "<div class='blank'></div>";
else if( letter == "!" )
html += "<div class='clock' style='background-position: -416px -16px'></div>";
else
html += "<div class='clock' style='background-position: " + x + "px -16px'></div>";
}
divHTML.css( "width", (message.length * 16) + "px");
divHTML.css( "margin-left", "-" + (message.length * 8) + "px");
divHTML.css( "margin-top", "20px");
divHTML.css( "position", "relative");
divHTML.css( "left", "50%");
divHTML.css( "top", "50%");
divHTML.append( html );
};

View File

@@ -0,0 +1,235 @@
WordFighter.notify_dual = function() {
$.ajax({
url: '/wordFighter/levelChoice',
data: { level: WordFighter.level },
success: function(data){
$("#waitingGame").load('/wordFighter/ready', function() {
console.log( "Current opponent : " + WordFighter.opponentLevel );
console.log( data );
$("#fighter1portrait").addClass( WordFighter.level );
$("#fighter1portrait").css( "visibility", "visible");
addFighter( WordFighter.get_fighter( WordFighter.level) );
if( data.opponentLevel != "undefined" ) {
WordFighter.opponentLevel = data.opponentLevel;
}
WordFighter.set_opponent();
});
}
});
}
WordFighter.new_word = function() {
if( WordFighter.started ) {
return false;
}
WordFighter.combo = 0;
$.ajax({
url: '/wordFighter/newEnigma',
data: {level: WordFighter.level, mode: WordFighter.mode },
success: function(data){
WordFighter.letters = data.letters;
for( i = 1; i < WordFighter.letters.length + 1; i++ )
{
WordFighter.setLetter( i, data.letters[ i - 1 ] )
}
WordFighter.answers = data.words;
var rest = 0;
var total = 0;
for( var i = 3; i < 8; i++ ) {
total += $( "#valid" + i).length;
rest += $( "#valid" + i).find( ":empty" ).length;
}
console.log( data.remaining_time + " seconds" );
COUNTDOWN.setTime( data.remaining_time);
for( i = data.minLength; i < data.maxLength +1; i++ )
{
$( "#valid" + i ).empty();
var obj = data.words[i];
var count = 0;
if( obj != undefined ) {
if( WordFighter.mode == "offline" )
count = obj.length;
else
count = obj;
}
for( j = 0; j < count; j++ )
{
$( "#valid" + i ).append( "<li id=\"valid" + i + "-" + j + "\" style=\"background-color:yellow\"></li>");
}
}
WordFighter.started = true;
if( WordFighter.first ) {
WordFighter.startDate = new Date();
COUNTDOWN.start();
display_text( game_start );
setTimeout( function() {
hide_text();
}, 1500);
WordFighter.first = false;
}
}
});
}
WordFighter.check_word = function() {
$.ajax({
type: "POST",
url: '/wordFighter/check',
data: {suggested: WordFighter.word },
success: function(data){
if( data.valid )
{
WordFighter.combo++;
if( ( WordFighter.combo % 3 ) == 0 )
fighter1.kick();
else
fighter1.punch();
WordFighter.activeKeypress = true;
$("#valid" + WordFighter.word.length + "-" + data.position).append( WordFighter.word );
WordFighter.change_score( data.score );
fighter1.punch();
WordFighter.hit_opponent(WordFighter.word.length );
while(WordFighter.erase());
WordFighter.activeKeypress = false;
WordFighter.check_validated();
} else {
WordFighter.combo = 0;
WordFighter.activeKeypress = true;
while(WordFighter.erase());
WordFighter.activeKeypress = false;
}
fighter1.health = data.fighter1;
fighter2.health = data.fighter2;
if( fighter1.health == 0 || fighter2.health == 0 )
WordFighter.game_over();
if( data.remaining_time )
COUNTDOWN.setTime( data.remaining_time );
}
});
}
WordFighter.game_over = function() {
COUNTDOWN.stop();
WordFighter.activeKeypress = true;
var highscore = true;
var win = WordFighter.score > 0;
$.ajax({
url: '/wordFighter/answers',
data: {action: "answers"},
success: function(data){
$("#modalDialog").prepend(data.modal).modal({backdrop: false, show: true});
$(".replayButton").bind( "click", function() {
if( WordFighter.mode!="dual")
window.location.href = "/wordFighter/game";
else
window.location.href = "/wordFighter/invite/" + opponent;
} );
for( i = data.minLength; i < data.maxLength +1; i++ )
{
var words = data.answers[i];
if( words != undefined )
{
for( j = 0; j < words.length; j++ )
{
var id = "#valid" + ( words[ j ].length ) + "-" + j;
$( id ).empty();
$( id ).append( words[ j ] );
}
}
}
WordFighter.answers = null;
fighter1.health = data.fighter1;
fighter2.health = data.fighter2;
console.log( fighter1.health + " vs " + fighter2.health );
switch( data.state ) {
case "win" :
fighter1.victory();
fighter2.loose();
display_text( game_win );
break;
case "loose" :
fighter1.loose();
fighter2.victory();
display_text( game_loose );
break;
default :
display_text( game_draw );
}
}
});
WordFighter.started = false;
}
WordFighter.callback = function(data) {
if( data.id != WordFighter.id && data.action != "replay" )
return;
if( data.action != undefined ) {
if( data.fighter1 != undefined )
fighter1.health = data.fighter1;
if( data.fighter2 != undefined )
fighter2.health = data.fighter2;
switch( data.action ) {
case "start" :
addHealthBars();
$("#waitingGame").show();
WordFighter.start_game();
break;
case "join" :
break;
case "opponentLevel" :
WordFighter.opponentLevel = data.level;
WordFighter.set_opponent();
break;
case "hit" :
case "beat" :
WordFighter.opponentCombo++;
if( (WordFighter.opponentCombo % 3 ) == 0 )
fighter2.kick();
else
fighter2.punch();
fighter1.ouch();
if( data.action == "beat" )
WordFighter.game_over();
break;
case "timeout" :
if( WordFighter.started ) {
var endDate = new Date();
console.log( WordFighter.startDate.toTimeString() + " - " + endDate.toTimeString() + " = Timeout in " + ( (endDate.getSeconds() - WordFighter.startDate.getSeconds())) + " / " + (endDate.getTime() - WordFighter.startDate.getTime()));
WordFighter.game_over();
}
break;
case "replay" :
$(".replayButton").bind( "click", function() {
window.location.href = '/wordFighter/game/' + data.id;
})
break;
}
}
}

View File

@@ -0,0 +1,172 @@
WordFighter.notify_dual = function() {
$.ajax({
url: '/wordFighter/levelChoice',
data: { level: WordFighter.level },
success: function(data){
$("#waitingGame").load('/wordFighter/ready', function() {
console.log( "Current opponent : " + WordFighter.opponentLevel );
console.log( data );
$("#fighter1portrait").addClass( WordFighter.level );
$("#fighter1portrait").css( "visibility", "visible");
addFighter( WordFighter.get_fighter( WordFighter.level) );
addScoreBoard();
WordFighter.opponentLevel = WordFighter.get_random_fighter();
setTimeout( function() {
WordFighter.start_game();
}, 3000 );
WordFighter.set_opponent();
});
}
});
}
WordFighter.new_word = function() {
if( WordFighter.started ) {
return false;
}
WordFighter.combo = 0;
$.ajax({
url: '/wordFighter/newEnigma',
data: {level: WordFighter.level},
success: function(data){
console.log(data);
WordFighter.letters = data.letters;
for( i = 1; i < WordFighter.letters.length + 1; i++ )
{
WordFighter.setLetter( i, data.letters[ i - 1 ] )
}
WordFighter.answers = data.words;
var rest = 0;
var total = 0;
for( var i = 3; i < 8; i++ ) {
total += $( "#valid" + i).length;
rest += $( "#valid" + i).find( ":empty" ).length;
}
console.log( data.remaining_time + " seconds" );
COUNTDOWN.setTime( data.remaining_time);
if( rest / total < 0.5 )
fighter2.kick();
else
fighter2.punch();
fighter1.ouch();
WordFighter.change_score( data.score );
for( i = data.minLength; i < data.maxLength +1; i++ )
{
$( "#valid" + i ).empty();
var obj = data.words[i];
var count = 0;
if( obj != undefined )
count = obj;
for( j = 0; j < count; j++ )
{
$( "#valid" + i ).append( "<li id=\"valid" + i + "-" + j + "\" style=\"background-color:yellow\"></li>");
}
}
WordFighter.started = true;
if( WordFighter.first ) {
WordFighter.startDate = new Date();
COUNTDOWN.start();
display_text( game_start );
setTimeout( function() {
hide_text();
}, 1500);
WordFighter.first = false;
}
}
});
}
WordFighter.check_word = function() {
$.ajax({
type: "POST",
url: '/wordFighter/check',
data: {suggested: WordFighter.word },
success: function(data){
if( data.valid )
{
WordFighter.combo++;
if( ( WordFighter.combo % 3 ) == 0 )
fighter1.kick();
else
fighter1.punch();
WordFighter.activeKeypress = true;
$("#valid" + WordFighter.word.length + "-" + data.position).append( WordFighter.word );
WordFighter.change_score( data.score );
fighter1.punch();
WordFighter.hit_opponent(WordFighter.word.length );
while(WordFighter.erase());
WordFighter.activeKeypress = false;
WordFighter.check_validated();
} else {
WordFighter.combo = 0;
WordFighter.activeKeypress = true;
while(WordFighter.erase());
WordFighter.activeKeypress = false;
}
if( data.remaining_time )
COUNTDOWN.setTime( data.remaining_time );
}
});
}
WordFighter.game_over = function() {
COUNTDOWN.stop();
WordFighter.activeKeypress = true;
var highscore = true;
var win = WordFighter.score > 0;
$.ajax({
url: '/wordFighter/answers',
data: {action: "answers"},
success: function(data){
console.log(data);
$("#modalDialog").prepend(data.modal).modal({backdrop: false, show: true});
$(".replayButton").bind( "click", function() {
if( WordFighter.mode!=="dual")
window.location.href = "/wordFighter/game";
else
window.location.href = "/wordFighter/invite/" + opponent;
} );
for( i = data.minLength; i < data.maxLength +1; i++ )
{
var words = data.answers[i];
if( words != undefined )
{
for( j = 0; j < words.length; j++ )
{
var id = "#valid" + ( words[ j ].length ) + "-" + j;
$( id ).empty();
$( id ).append( words[ j ] );
}
}
}
WordFighter.answers = null;
SCOREBOARD.set_score( data.score );
}
});
WordFighter.started = false;
}

File diff suppressed because it is too large Load Diff

26
demo/wordfighters/lib/gunzip.min.js vendored Normal file
View File

@@ -0,0 +1,26 @@
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function n(e){throw e;}var p=void 0,aa=this;function t(e,b){var d=e.split("."),c=aa;!(d[0]in c)&&c.execScript&&c.execScript("var "+d[0]);for(var a;d.length&&(a=d.shift());)!d.length&&b!==p?c[a]=b:c=c[a]?c[a]:c[a]={}};var x="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;new (x?Uint8Array:Array)(256);var y;for(y=0;256>y;++y)for(var A=y,ba=7,A=A>>>1;A;A>>>=1)--ba;function B(e,b,d){var c,a="number"===typeof b?b:b=0,f="number"===typeof d?d:e.length;c=-1;for(a=f&7;a--;++b)c=c>>>8^C[(c^e[b])&255];for(a=f>>3;a--;b+=8)c=c>>>8^C[(c^e[b])&255],c=c>>>8^C[(c^e[b+1])&255],c=c>>>8^C[(c^e[b+2])&255],c=c>>>8^C[(c^e[b+3])&255],c=c>>>8^C[(c^e[b+4])&255],c=c>>>8^C[(c^e[b+5])&255],c=c>>>8^C[(c^e[b+6])&255],c=c>>>8^C[(c^e[b+7])&255];return(c^4294967295)>>>0}
var D=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,
2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,
2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,
2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,
3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,
936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],C=x?new Uint32Array(D):D;function E(){}E.prototype.getName=function(){return this.name};E.prototype.getData=function(){return this.data};E.prototype.G=function(){return this.H};function G(e){var b=e.length,d=0,c=Number.POSITIVE_INFINITY,a,f,k,l,m,r,q,g,h,v;for(g=0;g<b;++g)e[g]>d&&(d=e[g]),e[g]<c&&(c=e[g]);a=1<<d;f=new (x?Uint32Array:Array)(a);k=1;l=0;for(m=2;k<=d;){for(g=0;g<b;++g)if(e[g]===k){r=0;q=l;for(h=0;h<k;++h)r=r<<1|q&1,q>>=1;v=k<<16|g;for(h=r;h<a;h+=m)f[h]=v;++l}++k;l<<=1;m<<=1}return[f,d,c]};var J=[],K;for(K=0;288>K;K++)switch(!0){case 143>=K:J.push([K+48,8]);break;case 255>=K:J.push([K-144+400,9]);break;case 279>=K:J.push([K-256+0,7]);break;case 287>=K:J.push([K-280+192,8]);break;default:n("invalid literal: "+K)}
var ca=function(){function e(a){switch(!0){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n("invalid length: "+a)}}var b=[],d,c;for(d=3;258>=d;d++)c=e(d),b[d]=c[2]<<24|c[1]<<
16|c[0];return b}();x&&new Uint32Array(ca);function L(e,b){this.i=[];this.j=32768;this.d=this.f=this.c=this.n=0;this.input=x?new Uint8Array(e):e;this.o=!1;this.k=M;this.w=!1;if(b||!(b={}))b.index&&(this.c=b.index),b.bufferSize&&(this.j=b.bufferSize),b.bufferType&&(this.k=b.bufferType),b.resize&&(this.w=b.resize);switch(this.k){case N:this.a=32768;this.b=new (x?Uint8Array:Array)(32768+this.j+258);break;case M:this.a=0;this.b=new (x?Uint8Array:Array)(this.j);this.e=this.D;this.q=this.A;this.l=this.C;break;default:n(Error("invalid inflate mode"))}}
var N=0,M=1;
L.prototype.g=function(){for(;!this.o;){var e=P(this,3);e&1&&(this.o=!0);e>>>=1;switch(e){case 0:var b=this.input,d=this.c,c=this.b,a=this.a,f=b.length,k=p,l=p,m=c.length,r=p;this.d=this.f=0;d+1>=f&&n(Error("invalid uncompressed block header: LEN"));k=b[d++]|b[d++]<<8;d+1>=f&&n(Error("invalid uncompressed block header: NLEN"));l=b[d++]|b[d++]<<8;k===~l&&n(Error("invalid uncompressed block header: length verify"));d+k>b.length&&n(Error("input buffer is broken"));switch(this.k){case N:for(;a+k>c.length;){r=
m-a;k-=r;if(x)c.set(b.subarray(d,d+r),a),a+=r,d+=r;else for(;r--;)c[a++]=b[d++];this.a=a;c=this.e();a=this.a}break;case M:for(;a+k>c.length;)c=this.e({t:2});break;default:n(Error("invalid inflate mode"))}if(x)c.set(b.subarray(d,d+k),a),a+=k,d+=k;else for(;k--;)c[a++]=b[d++];this.c=d;this.a=a;this.b=c;break;case 1:this.l(da,ea);break;case 2:for(var q=P(this,5)+257,g=P(this,5)+1,h=P(this,4)+4,v=new (x?Uint8Array:Array)(Q.length),s=p,F=p,H=p,w=p,z=p,O=p,I=p,u=p,Z=p,u=0;u<h;++u)v[Q[u]]=P(this,3);if(!x){u=
h;for(h=v.length;u<h;++u)v[Q[u]]=0}s=G(v);w=new (x?Uint8Array:Array)(q+g);u=0;for(Z=q+g;u<Z;)switch(z=R(this,s),z){case 16:for(I=3+P(this,2);I--;)w[u++]=O;break;case 17:for(I=3+P(this,3);I--;)w[u++]=0;O=0;break;case 18:for(I=11+P(this,7);I--;)w[u++]=0;O=0;break;default:O=w[u++]=z}F=x?G(w.subarray(0,q)):G(w.slice(0,q));H=x?G(w.subarray(q)):G(w.slice(q));this.l(F,H);break;default:n(Error("unknown BTYPE: "+e))}}return this.q()};
var S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Q=x?new Uint16Array(S):S,fa=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],ga=x?new Uint16Array(fa):fa,ha=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],T=x?new Uint8Array(ha):ha,ia=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ja=x?new Uint16Array(ia):ia,ka=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,
11,12,12,13,13],U=x?new Uint8Array(ka):ka,V=new (x?Uint8Array:Array)(288),W,la;W=0;for(la=V.length;W<la;++W)V[W]=143>=W?8:255>=W?9:279>=W?7:8;var da=G(V),X=new (x?Uint8Array:Array)(30),Y,ma;Y=0;for(ma=X.length;Y<ma;++Y)X[Y]=5;var ea=G(X);function P(e,b){for(var d=e.f,c=e.d,a=e.input,f=e.c,k=a.length,l;c<b;)f>=k&&n(Error("input buffer is broken")),d|=a[f++]<<c,c+=8;l=d&(1<<b)-1;e.f=d>>>b;e.d=c-b;e.c=f;return l}
function R(e,b){for(var d=e.f,c=e.d,a=e.input,f=e.c,k=a.length,l=b[0],m=b[1],r,q;c<m&&!(f>=k);)d|=a[f++]<<c,c+=8;r=l[d&(1<<m)-1];q=r>>>16;q>c&&n(Error("invalid code length: "+q));e.f=d>>q;e.d=c-q;e.c=f;return r&65535}
L.prototype.l=function(e,b){var d=this.b,c=this.a;this.r=e;for(var a=d.length-258,f,k,l,m;256!==(f=R(this,e));)if(256>f)c>=a&&(this.a=c,d=this.e(),c=this.a),d[c++]=f;else{k=f-257;m=ga[k];0<T[k]&&(m+=P(this,T[k]));f=R(this,b);l=ja[f];0<U[f]&&(l+=P(this,U[f]));c>=a&&(this.a=c,d=this.e(),c=this.a);for(;m--;)d[c]=d[c++-l]}for(;8<=this.d;)this.d-=8,this.c--;this.a=c};
L.prototype.C=function(e,b){var d=this.b,c=this.a;this.r=e;for(var a=d.length,f,k,l,m;256!==(f=R(this,e));)if(256>f)c>=a&&(d=this.e(),a=d.length),d[c++]=f;else{k=f-257;m=ga[k];0<T[k]&&(m+=P(this,T[k]));f=R(this,b);l=ja[f];0<U[f]&&(l+=P(this,U[f]));c+m>a&&(d=this.e(),a=d.length);for(;m--;)d[c]=d[c++-l]}for(;8<=this.d;)this.d-=8,this.c--;this.a=c};
L.prototype.e=function(){var e=new (x?Uint8Array:Array)(this.a-32768),b=this.a-32768,d,c,a=this.b;if(x)e.set(a.subarray(32768,e.length));else{d=0;for(c=e.length;d<c;++d)e[d]=a[d+32768]}this.i.push(e);this.n+=e.length;if(x)a.set(a.subarray(b,b+32768));else for(d=0;32768>d;++d)a[d]=a[b+d];this.a=32768;return a};
L.prototype.D=function(e){var b,d=this.input.length/this.c+1|0,c,a,f,k=this.input,l=this.b;e&&("number"===typeof e.t&&(d=e.t),"number"===typeof e.z&&(d+=e.z));2>d?(c=(k.length-this.c)/this.r[2],f=258*(c/2)|0,a=f<l.length?l.length+f:l.length<<1):a=l.length*d;x?(b=new Uint8Array(a),b.set(l)):b=l;return this.b=b};
L.prototype.q=function(){var e=0,b=this.b,d=this.i,c,a=new (x?Uint8Array:Array)(this.n+(this.a-32768)),f,k,l,m;if(0===d.length)return x?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);f=0;for(k=d.length;f<k;++f){c=d[f];l=0;for(m=c.length;l<m;++l)a[e++]=c[l]}f=32768;for(k=this.a;f<k;++f)a[e++]=b[f];this.i=[];return this.buffer=a};
L.prototype.A=function(){var e,b=this.a;x?this.w?(e=new Uint8Array(b),e.set(this.b.subarray(0,b))):e=this.b.subarray(0,b):(this.b.length>b&&(this.b.length=b),e=this.b);return this.buffer=e};function $(e){this.input=e;this.c=0;this.m=[];this.s=!1}$.prototype.F=function(){this.s||this.g();return this.m.slice()};
$.prototype.g=function(){for(var e=this.input.length;this.c<e;){var b=new E,d=p,c=p,a=p,f=p,k=p,l=p,m=p,r=p,q=p,g=this.input,h=this.c;b.u=g[h++];b.v=g[h++];(31!==b.u||139!==b.v)&&n(Error("invalid file signature:"+b.u+","+b.v));b.p=g[h++];switch(b.p){case 8:break;default:n(Error("unknown compression method: "+b.p))}b.h=g[h++];r=g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24;b.H=new Date(1E3*r);b.N=g[h++];b.M=g[h++];0<(b.h&4)&&(b.I=g[h++]|g[h++]<<8,h+=b.I);if(0<(b.h&8)){m=[];for(l=0;0<(k=g[h++]);)m[l++]=String.fromCharCode(k);
b.name=m.join("")}if(0<(b.h&16)){m=[];for(l=0;0<(k=g[h++]);)m[l++]=String.fromCharCode(k);b.J=m.join("")}0<(b.h&2)&&(b.B=B(g,0,h)&65535,b.B!==(g[h++]|g[h++]<<8)&&n(Error("invalid header crc16")));d=g[g.length-4]|g[g.length-3]<<8|g[g.length-2]<<16|g[g.length-1]<<24;g.length-h-4-4<512*d&&(f=d);c=new L(g,{index:h,bufferSize:f});b.data=a=c.g();h=c.c;b.K=q=(g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24)>>>0;B(a,p,p)!==q&&n(Error("invalid CRC-32 checksum: 0x"+B(a,p,p).toString(16)+" / 0x"+q.toString(16)));b.L=
d=(g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24)>>>0;(a.length&4294967295)!==d&&n(Error("invalid input size: "+(a.length&4294967295)+" / "+d));this.m.push(b);this.c=h}this.s=!0;var v=this.m,s,F,H=0,w=0,z;s=0;for(F=v.length;s<F;++s)w+=v[s].data.length;if(x){z=new Uint8Array(w);for(s=0;s<F;++s)z.set(v[s].data,H),H+=v[s].data.length}else{z=[];for(s=0;s<F;++s)z[s]=v[s].data;z=Array.prototype.concat.apply([],z)}return z};t("Zlib.Gunzip",$);t("Zlib.Gunzip.prototype.decompress",$.prototype.g);t("Zlib.Gunzip.prototype.getMembers",$.prototype.F);t("Zlib.GunzipMember",E);t("Zlib.GunzipMember.prototype.getName",E.prototype.getName);t("Zlib.GunzipMember.prototype.getData",E.prototype.getData);t("Zlib.GunzipMember.prototype.getMtime",E.prototype.G);}).call(this);

9266
demo/wordfighters/lib/jquery-1.7.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
/*!
* jQuery i18n plugin
* @requires jQuery v1.1 or later
*
* See https://github.com/recurser/jquery-i18n
*
* Licensed under the MIT license.
*
* Version: <%= pkg.version %> (<%= meta.date %>)
*/
(function($) {
/**
* i18n provides a mechanism for translating strings using a jscript dictionary.
*
*/
var __slice = Array.prototype.slice;
/*
* i18n property list
*/
var i18n = {
dict: null,
missingPattern: null,
/**
* load()
*
* Load translations.
*
* @param property_list i18nDict : The dictionary to use for translation.
*/
load: function(i18nDict, missingPattern) {
if (this.dict !== null) {
$.extend(this.dict, i18nDict);
} else {
this.dict = i18nDict;
}
if (missingPattern) {
this.missingPattern = missingPattern;
}
},
/**
* unload()
*
* Unloads translations and clears the dictionary.
*/
unload: function() {
this.dict = null;
this.missingPattern = null;
},
/**
* _()
*
* Looks the given string up in the dictionary and returns the translation if
* one exists. If a translation is not found, returns the original word.
*
* @param string str : The string to translate.
* @param property_list params.. : params for using printf() on the string.
*
* @return string : Translated word.
*/
_: function (str) {
dict = this.dict;
if (dict && dict.hasOwnProperty(str)) {
str = dict[str];
} else if (this.missingPattern !== null) {
return this.printf(this.missingPattern, str);
}
args = __slice.call(arguments);
args[0] = str;
// Substitute any params.
return this.printf.apply(this, args);
},
/*
* printf()
*
* Substitutes %s with parameters given in list. %%s is used to escape %s.
*
* @param string str : String to perform printf on.
* @param string args : Array of arguments for printf.
*
* @return string result : Substituted string
*/
printf: function(str, args) {
if (arguments.length < 2) return str;
args = $.isArray(args) ? args : __slice.call(arguments, 1);
return str.replace(/([^%]|^)%(?:(\d+)\$)?s/g, function(p0, p, position) {
if (position) {
return p + args[parseInt(position)-1];
}
return p + args.shift();
}).replace(/%%s/g, '%s');
}
};
/*
* _t()
*
* Allows you to translate a jQuery selector.
*
* eg $('h1')._t('some text')
*
* @param string str : The string to translate .
* @param property_list params : Params for using printf() on the string.
*
* @return element : Chained and translated element(s).
*/
$.fn._t = function(str, params) {
return $(this).html(i18n._.apply(i18n, arguments));
};
$.i18n = i18n;
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
// http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt
/* utf.js - UTF-8 <=> UTF-16 convertion
*
* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
function Utf8ArrayToStr(array) {
var out, i, len, c;
var char2, char3;
out = "";
len = array.length;
i = 0;
while(i < len) {
c = array[i++];
switch(c >> 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += String.fromCharCode(c);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = array[i++];
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = array[i++];
char3 = array[i++];
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
break;
}
}
return out;
}

Binary file not shown.

Binary file not shown.

View File

@@ -188,6 +188,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -186,6 +186,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -186,6 +186,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -184,6 +184,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -198,6 +198,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -184,6 +184,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -184,6 +184,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -182,6 +182,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -186,6 +186,13 @@
<li class="toctree-l1 ">
<a class="" href="../../games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../../games/yahtzee/">Yahtzee</a> <a class="" href="../../games/yahtzee/">Yahtzee</a>

View File

@@ -186,6 +186,13 @@
<li class="toctree-l1 ">
<a class="" href="../wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../yahtzee/">Yahtzee</a> <a class="" href="../yahtzee/">Yahtzee</a>

View File

@@ -188,6 +188,13 @@
<li class="toctree-l1 ">
<a class="" href="../wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../yahtzee/">Yahtzee</a> <a class="" href="../yahtzee/">Yahtzee</a>

View File

@@ -188,6 +188,13 @@
<li class="toctree-l1 ">
<a class="" href="../wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="../yahtzee/">Yahtzee</a> <a class="" href="../yahtzee/">Yahtzee</a>
@@ -269,7 +276,7 @@ Cards sprite is under <a href="http://creativecommons.org/publicdomain/zero/1.0/
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../yahtzee/" class="btn btn-neutral float-right" title="Yahtzee">Next <span class="icon icon-circle-arrow-right"></span></a> <a href="../wordfighters/" class="btn btn-neutral float-right" title="Wordfighters">Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../pacman/" class="btn btn-neutral" title="Pacman"><span class="icon icon-circle-arrow-left"></span> Previous</a> <a href="../pacman/" class="btn btn-neutral" title="Pacman"><span class="icon icon-circle-arrow-left"></span> Previous</a>
@@ -303,7 +310,7 @@ Cards sprite is under <a href="http://creativecommons.org/publicdomain/zero/1.0/
<span><a href="../pacman/" style="color: #fcfcfc;">&laquo; Previous</a></span> <span><a href="../pacman/" style="color: #fcfcfc;">&laquo; Previous</a></span>
<span style="margin-left: 15px"><a href="../yahtzee/" style="color: #fcfcfc">Next &raquo;</a></span> <span style="margin-left: 15px"><a href="../wordfighters/" style="color: #fcfcfc">Next &raquo;</a></span>
</span> </span>
</div> </div>

View File

@@ -0,0 +1,331 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wordfighters - Febbweiss</title>
<link rel="shortcut icon" href="../../img/favicon.ico">
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="../../css/highlight.css">
<link href="../../extra/css/extra.css" rel="stylesheet">
<link href="../../extra/css/sis.css" rel="stylesheet">
<script>
// Current page data
var mkdocs_page_name = "Wordfighters";
var mkdocs_page_input_path = "games/wordfighters.md";
var mkdocs_page_url = "/games/wordfighters/";
</script>
<script src="../../js/jquery-2.1.1.min.js"></script>
<script src="../../js/modernizr-2.8.3.min.js"></script>
<script type="text/javascript" src="../../js/highlight.pack.js"></script>
<script src="../../js/theme.js"></script>
<script src="../../extra/js/pacman.js"></script>
<script src="../../extra/js/pyramid.js"></script>
<script src="../../extra/js/sis.js"></script>
<script src="../../extra/js/yahtzee.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="../.." class="icon icon-home"> Febbweiss</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li>
<li class="toctree-l1 ">
<a class="" href="../..">Home</a>
</li>
<li>
<li>
<ul class="subnav">
<li><span>Development</span></li>
<li class="toctree-l1 ">
<a class="" href="../../development/cloudbudget/">Cloudbudget</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../development/cloudbudget_angularjs/">Cloudbudget angularjs</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../development/filebrowser_durandal_widget/">Filebrowser durandal widget</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../development/project_deployer/">Project deployer</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../development/springboot_react_webpack/">Springboot react webpack</a>
</li>
</ul>
<li>
<li>
<ul class="subnav">
<li><span>Docker</span></li>
<li class="toctree-l1 ">
<a class="" href="../../docker/docker_apache_log_generator/">Docker apache log generator</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../docker/docker_gocd/">Docker gocd</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../docker/docker_java_log_generator/">Docker java log generator</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../../docker/docker_log_centralizer/">Docker log centralizer</a>
</li>
</ul>
<li>
<li>
<ul class="subnav">
<li><span>Games</span></li>
<li class="toctree-l1 ">
<a class="" href="../Space_invaders_stories/">Space invaders stories</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../pacman/">Pacman</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../pyramid/">Pyramid</a>
</li>
<li class="toctree-l1 current">
<a class="current" href="./">Wordfighters</a>
<ul>
<li class="toctree-l3"><a href="#word-fighters">Word Fighters</a></li>
<li><a class="toctree-l4" href="#how-to">How to</a></li>
<li><a class="toctree-l4" href="#under-the-hood">Under the hood</a></li>
<li><a class="toctree-l4" href="#credits">Credits</a></li>
</ul>
</li>
<li class="toctree-l1 ">
<a class="" href="../yahtzee/">Yahtzee</a>
</li>
</ul>
<li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../..">Febbweiss</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../..">Docs</a> &raquo;</li>
<li>Games &raquo;</li>
<li>Wordfighters</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/febbweiss/" class="icon icon-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="word-fighters">Word Fighters</h1>
<p><em>Word Fighters</em> is a word game where you must find a maximum words to get the highscore.</p>
<h2 id="how-to">How to</h2>
<p>When you click on the "Start" button, a combinaison of letters is generated.</p>
<p>The goal is to retrieve a maximum of words with these letters using your keyboard.</p>
<p>To validate a word, simply press the "Enter" key.</p>
<p>To get new letters, press the "Space" bar.
<em> Easy : Search words between 3 and 7 letters
</em> Medium : Search words between 3 and 6 letters
<em> Hard : Search words between 4 and 7 letters
</em> Extreme : No escape ! You can\'t have new letters before reach all words !</p>
<p>If you are blocked, you can switch letters but be careful : you loose 5 points per words not found !!</p>
<p><object data="/demo/wordfighters/index.html" width="620" height="870">
<embed src="/demo/wordfighters/index.html" width="620" height="870"> </embed>
<iframe scrolling="no" frameborder="0" src="/demo/wordfighters/index.html" style="width: 620px; height: 870px; overflow:hidden;">
</iframe>
</object></p>
<h2 id="under-the-hood">Under the hood</h2>
<p>Originally designed to run with a server, it's playable such as.
If running with a server, 2 modes are availables :
<em> 1 player : Try to beat your highscore. Include the </em>wordfighters_single.js<em> to enable the server pipe.
</em> 2 players : Try to defeat your opponent hitting him/her. The longest the word found is, the stongest damages are !! Include the <em>wordfighters_multplayer.js</em> to enable the server pipe.</p>
<p>Words dictionary is provided by the <a href="https://github.com/Febbweiss/scrabble-resolver">Scrabble-Resolver</a> project.
Currently, only english and french dictionaries are provided.</p>
<h2 id="credits">Credits</h2>
<ul>
<li>Graphics : Namco&trade; from "Super Puzzle Fighters 2" and "Super Gems Fighters</li>
<li>Code : Fabrice Ecaille aka Febbweiss</li>
<li>Tools : gameQuery</li>
</ul>
<p>Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" />
<![endif]-->
<a class="github-fork-ribbon" href="https://github.com/Febbweiss/wordfighters" target="_blank" title="Fork me on GitHub">Fork me on GitHub</a></p>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../yahtzee/" class="btn btn-neutral float-right" title="Yahtzee">Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../pyramid/" class="btn btn-neutral" title="Pyramid"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">
<a href="https://github.com/febbweiss/" class="icon icon-github" style="float: left; color: #fcfcfc"> GitHub</a>
<span><a href="../pyramid/" style="color: #fcfcfc;">&laquo; Previous</a></span>
<span style="margin-left: 15px"><a href="../yahtzee/" style="color: #fcfcfc">Next &raquo;</a></span>
</span>
</div>
</body>
</html>

View File

@@ -173,6 +173,13 @@
<li class="toctree-l1 ">
<a class="" href="../wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 current"> <li class="toctree-l1 current">
<a class="current" href="./">Yahtzee</a> <a class="current" href="./">Yahtzee</a>
@@ -269,7 +276,7 @@
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../pyramid/" class="btn btn-neutral" title="Pyramid"><span class="icon icon-circle-arrow-left"></span> Previous</a> <a href="../wordfighters/" class="btn btn-neutral" title="Wordfighters"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div> </div>
@@ -297,7 +304,7 @@
<a href="https://github.com/febbweiss/" class="icon icon-github" style="float: left; color: #fcfcfc"> GitHub</a> <a href="https://github.com/febbweiss/" class="icon icon-github" style="float: left; color: #fcfcfc"> GitHub</a>
<span><a href="../pyramid/" style="color: #fcfcfc;">&laquo; Previous</a></span> <span><a href="../wordfighters/" style="color: #fcfcfc;">&laquo; Previous</a></span>
</span> </span>

View File

@@ -180,6 +180,13 @@
<li class="toctree-l1 ">
<a class="" href="games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="games/yahtzee/">Yahtzee</a> <a class="" href="games/yahtzee/">Yahtzee</a>
@@ -264,6 +271,7 @@ In this space, you will find some of them. Basiclly, these pages are <em>README<
<li><a href="./games/Space_invaders_stories">Space invaders</a></li> <li><a href="./games/Space_invaders_stories">Space invaders</a></li>
<li><a href="./games/pacman">Pacman</a></li> <li><a href="./games/pacman">Pacman</a></li>
<li><a href="./games/pyramid">Pyramid</a></li> <li><a href="./games/pyramid">Pyramid</a></li>
<li><a href="./games/wordfighters">Word Fighters</a> </li>
<li><a href="./games/yahtzee">Yahtzee</a></li> <li><a href="./games/yahtzee">Yahtzee</a></li>
</ul> </ul>
</li> </li>
@@ -315,5 +323,5 @@ In this space, you will find some of them. Basiclly, these pages are <em>README<
<!-- <!--
MkDocs version : 0.15.3 MkDocs version : 0.15.3
Build Date UTC : 2017-05-24 13:37:51.657420 Build Date UTC : 2017-09-28 11:19:05.501221
--> -->

View File

@@ -2,12 +2,12 @@
"docs": [ "docs": [
{ {
"location": "/", "location": "/",
"text": "Welcome\n\n\nI made some projects and published them on \nGitHub\n.\nIn this space, you will find some of them. Basiclly, these pages are \nREADME\n files but with some adds and demos.\n\n\nDifferent projects for different needs :\n\n\n\n\nDevelopment\n\n\nJava\n\n\nSpringboot / React / Webpack\n\n\n\n\n\n\nNodeJS\n\n\nCloudBudget\n (Express)\n\n\nProject deployer\n (Meteor)\n\n\n\n\n\n\nClient-side\n\n\nCloudBudget-AngularJS\n (Express / AngularJS)\n\n\nDurandal filebrowser widget\n (DurandalJS)\n\n\n\n\n\n\n\n\n\n\nDocker\n\n\nFullstack servers\n\n\nLog centralizer\n ELK stack with Kafka\n\n\nGoCD\n GoCD server and agents\n\n\n\n\n\n\nUtilities\n\n\nApache log generator\n\n\nJava log generator\n\n\n\n\n\n\n\n\n\n\nJavascript games\n\n\nSpace invaders\n\n\nPacman\n\n\nPyramid\n\n\nYahtzee", "text": "Welcome\n\n\nI made some projects and published them on \nGitHub\n.\nIn this space, you will find some of them. Basiclly, these pages are \nREADME\n files but with some adds and demos.\n\n\nDifferent projects for different needs :\n\n\n\n\nDevelopment\n\n\nJava\n\n\nSpringboot / React / Webpack\n\n\n\n\n\n\nNodeJS\n\n\nCloudBudget\n (Express)\n\n\nProject deployer\n (Meteor)\n\n\n\n\n\n\nClient-side\n\n\nCloudBudget-AngularJS\n (Express / AngularJS)\n\n\nDurandal filebrowser widget\n (DurandalJS)\n\n\n\n\n\n\n\n\n\n\nDocker\n\n\nFullstack servers\n\n\nLog centralizer\n ELK stack with Kafka\n\n\nGoCD\n GoCD server and agents\n\n\n\n\n\n\nUtilities\n\n\nApache log generator\n\n\nJava log generator\n\n\n\n\n\n\n\n\n\n\nJavascript games\n\n\nSpace invaders\n\n\nPacman\n\n\nPyramid\n\n\nWord Fighters\n \n\n\nYahtzee",
"title": "Home" "title": "Home"
}, },
{ {
"location": "/#welcome", "location": "/#welcome",
"text": "I made some projects and published them on GitHub .\nIn this space, you will find some of them. Basiclly, these pages are README files but with some adds and demos. Different projects for different needs : Development Java Springboot / React / Webpack NodeJS CloudBudget (Express) Project deployer (Meteor) Client-side CloudBudget-AngularJS (Express / AngularJS) Durandal filebrowser widget (DurandalJS) Docker Fullstack servers Log centralizer ELK stack with Kafka GoCD GoCD server and agents Utilities Apache log generator Java log generator Javascript games Space invaders Pacman Pyramid Yahtzee", "text": "I made some projects and published them on GitHub .\nIn this space, you will find some of them. Basiclly, these pages are README files but with some adds and demos. Different projects for different needs : Development Java Springboot / React / Webpack NodeJS CloudBudget (Express) Project deployer (Meteor) Client-side CloudBudget-AngularJS (Express / AngularJS) Durandal filebrowser widget (DurandalJS) Docker Fullstack servers Log centralizer ELK stack with Kafka GoCD GoCD server and agents Utilities Apache log generator Java log generator Javascript games Space invaders Pacman Pyramid Word Fighters Yahtzee",
"title": "Welcome" "title": "Welcome"
}, },
{ {
@@ -385,6 +385,31 @@
"text": "Source code is under MIT Licence \nCards sprite is under Public domain \n Fork me on GitHub", "text": "Source code is under MIT Licence \nCards sprite is under Public domain \n Fork me on GitHub",
"title": "Licences" "title": "Licences"
}, },
{
"location": "/games/wordfighters/",
"text": "Word Fighters\n\n\nWord Fighters\n is a word game where you must find a maximum words to get the highscore.\n\n\nHow to\n\n\nWhen you click on the \"Start\" button, a combinaison of letters is generated.\n\n\nThe goal is to retrieve a maximum of words with these letters using your keyboard.\n\n\nTo validate a word, simply press the \"Enter\" key.\n\n\nTo get new letters, press the \"Space\" bar.\n\n Easy : Search words between 3 and 7 letters\n\n Medium : Search words between 3 and 6 letters\n\n Hard : Search words between 4 and 7 letters\n\n Extreme : No escape ! You can\\'t have new letters before reach all words !\n\n\nIf you are blocked, you can switch letters but be careful : you loose 5 points per words not found !!\n\n\n\n \n \n\n \n\n\n\n\n\n\nUnder the hood\n\n\nOriginally designed to run with a server, it's playable such as.\nIf running with a server, 2 modes are availables :\n\n 1 player : Try to beat your highscore. Include the \nwordfighters_single.js\n to enable the server pipe.\n\n 2 players : Try to defeat your opponent hitting him/her. The longest the word found is, the stongest damages are !! Include the \nwordfighters_multplayer.js\n to enable the server pipe.\n\n\nWords dictionary is provided by the \nScrabble-Resolver\n project.\nCurrently, only english and french dictionaries are provided.\n\n\nCredits\n\n\n\n\nGraphics : Namco\n from \"Super Puzzle Fighters 2\" and \"Super Gems Fighters\n\n\nCode : Fabrice Ecaille aka Febbweiss\n\n\nTools : gameQuery\n\n\n\n\nCopyright (c) 2013 Fabrice ECAILLE aka Febbweiss\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n \nFork me on GitHub",
"title": "Wordfighters"
},
{
"location": "/games/wordfighters/#word-fighters",
"text": "Word Fighters is a word game where you must find a maximum words to get the highscore.",
"title": "Word Fighters"
},
{
"location": "/games/wordfighters/#how-to",
"text": "When you click on the \"Start\" button, a combinaison of letters is generated. The goal is to retrieve a maximum of words with these letters using your keyboard. To validate a word, simply press the \"Enter\" key. To get new letters, press the \"Space\" bar. Easy : Search words between 3 and 7 letters Medium : Search words between 3 and 6 letters Hard : Search words between 4 and 7 letters Extreme : No escape ! You can\\'t have new letters before reach all words ! If you are blocked, you can switch letters but be careful : you loose 5 points per words not found !!",
"title": "How to"
},
{
"location": "/games/wordfighters/#under-the-hood",
"text": "Originally designed to run with a server, it's playable such as.\nIf running with a server, 2 modes are availables : 1 player : Try to beat your highscore. Include the wordfighters_single.js to enable the server pipe. 2 players : Try to defeat your opponent hitting him/her. The longest the word found is, the stongest damages are !! Include the wordfighters_multplayer.js to enable the server pipe. Words dictionary is provided by the Scrabble-Resolver project.\nCurrently, only english and french dictionaries are provided.",
"title": "Under the hood"
},
{
"location": "/games/wordfighters/#credits",
"text": "Graphics : Namco from \"Super Puzzle Fighters 2\" and \"Super Gems Fighters Code : Fabrice Ecaille aka Febbweiss Tools : gameQuery Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \n Fork me on GitHub",
"title": "Credits"
},
{ {
"location": "/games/yahtzee/", "location": "/games/yahtzee/",
"text": "Yahtzee\n\n\nThe classical dice game Yahtzee\n\n\nHow to\n\n\nThe goal is to complete the two combinaisons grids with five dice\n\n\nEach player can launch three times the dice to have a combinaison. After each launch, the player chooses to keep or not some dice. Each combinaison has a score.\n\n\nWhen both grids are completed, their scores are added and the player with the higher score wins. If the upper grid has a score higher than 63 points, the player wins a bonus of 35 points.\n\n\n\n \n \n\n \n\n\n\n\n\n\nCredits\n\n\n\n\nGraphics : Fabrice Ecaille aka Febbweiss\n\n\nCode : Fabrice Ecaille aka Febbweiss\n\n\n\n\nLicences\n\n\nCopyright (c) 2013 Fabrice ECAILLE aka Febbweiss\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n \nFork me on GitHub", "text": "Yahtzee\n\n\nThe classical dice game Yahtzee\n\n\nHow to\n\n\nThe goal is to complete the two combinaisons grids with five dice\n\n\nEach player can launch three times the dice to have a combinaison. After each launch, the player chooses to keep or not some dice. Each combinaison has a score.\n\n\nWhen both grids are completed, their scores are added and the player with the higher score wins. If the upper grid has a score higher than 63 points, the player wins a bonus of 35 points.\n\n\n\n \n \n\n \n\n\n\n\n\n\nCredits\n\n\n\n\nGraphics : Fabrice Ecaille aka Febbweiss\n\n\nCode : Fabrice Ecaille aka Febbweiss\n\n\n\n\nLicences\n\n\nCopyright (c) 2013 Fabrice ECAILLE aka Febbweiss\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n \nFork me on GitHub",

View File

@@ -169,6 +169,13 @@
<li class="toctree-l1 ">
<a class="" href="games/wordfighters/">Wordfighters</a>
</li>
<li class="toctree-l1 "> <li class="toctree-l1 ">
<a class="" href="games/yahtzee/">Yahtzee</a> <a class="" href="games/yahtzee/">Yahtzee</a>

View File

@@ -4,7 +4,7 @@
<url> <url>
<loc>None/</loc> <loc>None/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@@ -13,31 +13,31 @@
<url> <url>
<loc>None/development/cloudbudget/</loc> <loc>None/development/cloudbudget/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/development/cloudbudget_angularjs/</loc> <loc>None/development/cloudbudget_angularjs/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/development/filebrowser_durandal_widget/</loc> <loc>None/development/filebrowser_durandal_widget/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/development/project_deployer/</loc> <loc>None/development/project_deployer/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/development/springboot_react_webpack/</loc> <loc>None/development/springboot_react_webpack/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@@ -47,25 +47,25 @@
<url> <url>
<loc>None/docker/docker_apache_log_generator/</loc> <loc>None/docker/docker_apache_log_generator/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/docker/docker_gocd/</loc> <loc>None/docker/docker_gocd/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/docker/docker_java_log_generator/</loc> <loc>None/docker/docker_java_log_generator/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/docker/docker_log_centralizer/</loc> <loc>None/docker/docker_log_centralizer/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@@ -75,25 +75,31 @@
<url> <url>
<loc>None/games/Space_invaders_stories/</loc> <loc>None/games/Space_invaders_stories/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/games/pacman/</loc> <loc>None/games/pacman/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/games/pyramid/</loc> <loc>None/games/pyramid/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None/games/wordfighters/</loc>
<lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None/games/yahtzee/</loc> <loc>None/games/yahtzee/</loc>
<lastmod>2017-05-24</lastmod> <lastmod>2017-09-28</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>

View File

@@ -0,0 +1,57 @@
#Word Fighters
*Word Fighters* is a word game where you must find a maximum words to get the highscore.
##How to
When you click on the "Start" button, a combinaison of letters is generated.
The goal is to retrieve a maximum of words with these letters using your keyboard.
To validate a word, simply press the "Enter" key.
To get new letters, press the "Space" bar.
* Easy : Search words between 3 and 7 letters
* Medium : Search words between 3 and 6 letters
* Hard : Search words between 4 and 7 letters
* Extreme : No escape ! You can\'t have new letters before reach all words !
If you are blocked, you can switch letters but be careful : you loose 5 points per words not found !!
<object data="/demo/wordfighters/index.html" width="620" height="870">
<embed src="/demo/wordfighters/index.html" width="620" height="870"> </embed>
<iframe scrolling="no" frameborder="0" src="/demo/wordfighters/index.html" style="width: 620px; height: 870px; overflow:hidden;">
</iframe>
</object>
##Under the hood
Originally designed to run with a server, it's playable such as.
If running with a server, 2 modes are availables :
* 1 player : Try to beat your highscore. Include the *wordfighters_single.js* to enable the server pipe.
* 2 players : Try to defeat your opponent hitting him/her. The longest the word found is, the stongest damages are !! Include the *wordfighters_multplayer.js* to enable the server pipe.
Words dictionary is provided by the [Scrabble-Resolver](https://github.com/Febbweiss/scrabble-resolver) project.
Currently, only english and french dictionaries are provided.
##Credits
+ Graphics : Namco&trade; from "Super Puzzle Fighters 2" and "Super Gems Fighters
+ Code : Fabrice Ecaille aka Febbweiss
+ Tools : gameQuery
Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" />
<![endif]-->
<a class="github-fork-ribbon" href="https://github.com/Febbweiss/wordfighters" target="_blank" title="Fork me on GitHub">Fork me on GitHub</a>

View File

@@ -25,4 +25,5 @@ Different projects for different needs :
- [Space invaders](/games/Space_invaders_stories) - [Space invaders](/games/Space_invaders_stories)
- [Pacman](/games/pacman) - [Pacman](/games/pacman)
- [Pyramid](/games/pyramid) - [Pyramid](/games/pyramid)
- [Word Fighters](/games/wordfighters)
- [Yahtzee](/games/yahtzee) - [Yahtzee](/games/yahtzee)