Lode Runner version 2.21c, AI_VERSION=4

(1) Add gamepad support:
   (1.1) xinput controller is better, Microsoft Edge only support Xinput devices
   (1.2) Browser support tables: http://caniuse.com/#feat=gamepad
   (1.3) gamepad test page: http://html5gamepad.com/

(2) Add color themes selection
(3) More control key support: add "QWE ASD" and ",." keyboard support
(4) Rewrite editor function for more compatible with browser
(5) Maybe get bigger play screen, change scale step from 25% to %5
Cette révision appartient à :
simon_hung
2017-01-01 22:33:58 +08:00
Parent dc96a5ac8d
révision 675e52fa90
78 fichiers modifiés avec 1878 ajouts et 1317 suppressions
+49 -2
Voir le fichier
@@ -1,3 +1,4 @@
var inputNameState = 0;
function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
{
@@ -143,7 +144,6 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
function drawHiScoreList()
{
//var title = playDataName[_playData-1] + " HIGH SCORES";
var title = playDataToTitleName(_playData);
var localHighScore = "LOCAL HIGH SCORES";
var barTile;
@@ -158,7 +158,7 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
//bar
for(var x = 0; x < NO_OF_TILES_X; x++) {
barTile = new createjs.Bitmap(getThemeImage("ground"));
barTile = getThemeBitmap("ground");
barTile.setTransform(x * tileWScale, 4.5*tileHScale , tileScale, tileScale);
scoreStage.addChild(barTile);
}
@@ -208,6 +208,7 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
function initInput()
{
inputNameState = 1;
curPos = playerName.length;
name = playerName.split(""); //string to array;
nameText = []; //text object
@@ -257,6 +258,8 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
createjs.Ticker.off("tick", hiScoreTicker);
setTimeout( function() { closeScoreTable(); }, 1500);
inputNameState = 0;
}
function removeNameText()
@@ -279,6 +282,20 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
moveChild2Top(scoreStage, cursor);
}
function nextChar(charValue, nextMode)
{
if(typeof(charValue) == "undefined")charValue = " ";
var code = charValue.charCodeAt(0);
if(nextMode >=0) code++; else code--;
if (code < 65 || code > 90) { //out of A-Z
if(nextMode >=0) code = 65;
else code= 90;
}
return String.fromCharCode(code);
}
function handleHiScoreName(event)
{
if(!event){ event = window.event; } //cross browser issues exist
@@ -324,6 +341,12 @@ function showScoreTable(_playData, _curScoreInfo, _callbackFun, _waitTime)
case (code == KEYCODE_RIGHT): //RIGHT
if(curPos < name.length) curPos++;
break;
case (code == KEYCODE_UP): //UP
name[curPos] = nextChar(name[curPos], 1);
break;
case (code == KEYCODE_DOWN): //DOWN
name[curPos] = nextChar(name[curPos], -1);
break;
case (code == KEYCODE_ENTER): //ENTER
if(name.length > 0) inputFinish(true); //async
else soundPlay("beep");
@@ -410,6 +433,8 @@ function inputString(_stage, _maxSize, _startX, _startY, _defaultString, _callba
function initInput()
{
inputNameState = 1;
curPos = _defaultString.length; // cursor start position
inputText = _defaultString.split(""); //string to array
inputObj = []; //text object
@@ -451,6 +476,20 @@ function inputString(_stage, _maxSize, _startX, _startY, _defaultString, _callba
{
document.onkeydown = savedKeyDownHander;
}
function nextChar(charValue, nextMode)
{
if(typeof(charValue) == "undefined") charValue = " ";
var code = charValue.charCodeAt(0);
if(nextMode >=0) code++; else code--;
if (code < 65 || code > 90) { //out of A-Z
if(nextMode >=0) code = 65;
else code= 90;
}
return String.fromCharCode(code);
}
function handleStringInput(event)
{
@@ -496,6 +535,12 @@ function inputString(_stage, _maxSize, _startX, _startY, _defaultString, _callba
case (code == KEYCODE_RIGHT): //RIGHT
if(curPos < inputText.length) curPos++;
break;
case (code == KEYCODE_UP): //UP
inputText[curPos] = nextChar(inputText[curPos], 1);
break;
case (code == KEYCODE_DOWN): //DOWN
inputText[curPos] = nextChar(inputText[curPos], -1);
break;
case (code == KEYCODE_ENTER): //ENTER
if(inputText.length > 0) {
inputFinish();
@@ -528,5 +573,7 @@ function inputString(_stage, _maxSize, _startX, _startY, _defaultString, _callba
_stage.update();
_callbackFun(inputText.join(""));
inputNameState = 0;
}
}