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 à :
+67
-20
@@ -44,6 +44,10 @@ function pressCtrlKey(code)
|
||||
copyLevelPassed = 1; //means copy from exists level
|
||||
showTipsText("COPY MAP", 1500);
|
||||
break;
|
||||
case KEYCODE_J: //CTRL-J : gamepad toggle
|
||||
toggleGamepadMode(1);
|
||||
//if(gamepadIconObj) gamepadIconObj.updateGamepadImage();
|
||||
break;
|
||||
case KEYCODE_K: //CTRL-K : repeat actions On/Off
|
||||
toggleRepeatAction();
|
||||
repeatActionIconObj.updateRepeatActionImage();
|
||||
@@ -73,6 +77,16 @@ function pressCtrlKey(code)
|
||||
break;
|
||||
case KEYCODE_RIGHT: //SHIFT + -> : speed up
|
||||
setSpeed(1);
|
||||
break;
|
||||
case KEYCODE_H: //CTRL-H : redHat mode on/off
|
||||
toggleRedhatMode();
|
||||
break;
|
||||
case KEYCODE_1: //CTRL-1
|
||||
case KEYCODE_2: //CTRL-2
|
||||
case KEYCODE_3: //CTRL-3
|
||||
case KEYCODE_4: //CTRL-4
|
||||
case KEYCODE_5: //CTRL-5
|
||||
themeColorChange(code - KEYCODE_1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -117,7 +131,8 @@ function debugKeyPress(code)
|
||||
|
||||
var repeatAction = 0; //1: keyboard repeat on, 0: keyboard repeat Off
|
||||
var repeatActionPressed = 0;
|
||||
|
||||
var gamepadMode = 1; //0: disable, 1: enable
|
||||
var redhatMode = 1;
|
||||
var godMode = 0, godModeKeyPressed = 0;
|
||||
|
||||
function initHotKeyVariable()
|
||||
@@ -130,10 +145,8 @@ function initHotKeyVariable()
|
||||
function toggleRepeatAction()
|
||||
{
|
||||
if( (repeatAction ^= 1) == 1) {
|
||||
//showTipsText("REPEAT ACTIONS ON", 0, "APPLE-II MODE");
|
||||
showTipsText("REPEAT ACTIONS ON", 2500);
|
||||
} else {
|
||||
//showTipsText("REPEAT ACTIONS OFF", 0, "NES MODE");
|
||||
showTipsText("REPEAT ACTIONS OFF", 2500);
|
||||
}
|
||||
if(gameState != GAME_START) repeatActionPressed=1; //player change the "repeatAction" Mode at running
|
||||
@@ -141,6 +154,42 @@ function toggleRepeatAction()
|
||||
setRepeatAction();
|
||||
}
|
||||
|
||||
function toggleGamepadMode(textMsg)
|
||||
{
|
||||
if(!gamepadSupport()) {
|
||||
if(textMsg) showTipsText("GAMEPAD NOT SUPPORTED", 2500);
|
||||
gamepadMode = 0;
|
||||
} else {
|
||||
if( (gamepadMode ^= 1) == 1) {
|
||||
gamepadEnable();
|
||||
if(textMsg) showTipsText("GAMEPAD ON", 2500);
|
||||
} else {
|
||||
gamepadDisable();
|
||||
if(textMsg) showTipsText("GAMEPAD OFF", 2500);
|
||||
}
|
||||
}
|
||||
setGamepadMode();
|
||||
}
|
||||
|
||||
function toggleRedhatMode()
|
||||
{
|
||||
if( (redhatMode ^= 1) == 1 ) { //enable
|
||||
for(var i = 0; i < guardCount; i++) {
|
||||
if(guard[i].hasGold > 0)
|
||||
guard[i].sprite.spriteSheet = redhatData;
|
||||
else
|
||||
guard[i].sprite.spriteSheet = guardData;
|
||||
}
|
||||
showTipsText("REDHAT MODE ON", 1500);
|
||||
} else { //disable
|
||||
for(var i = 0; i < guardCount; i++) {
|
||||
guard[i].sprite.spriteSheet = guardData;
|
||||
}
|
||||
showTipsText("REDHAT MODE OFF", 1500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleGodMode()
|
||||
{
|
||||
godModeKeyPressed = 1; //means player press the god-mod hot-key
|
||||
@@ -172,27 +221,35 @@ function pressKey(code)
|
||||
{
|
||||
switch(code) {
|
||||
case KEYCODE_LEFT:
|
||||
case KEYCODE_J:
|
||||
case KEYCODE_J:
|
||||
case KEYCODE_A:
|
||||
keyAction = ACT_LEFT;
|
||||
break;
|
||||
case KEYCODE_RIGHT:
|
||||
case KEYCODE_L:
|
||||
case KEYCODE_D:
|
||||
keyAction = ACT_RIGHT;
|
||||
break;
|
||||
case KEYCODE_UP:
|
||||
case KEYCODE_I:
|
||||
case KEYCODE_UP:
|
||||
case KEYCODE_I:
|
||||
case KEYCODE_W:
|
||||
keyAction = ACT_UP;
|
||||
break;
|
||||
case KEYCODE_DOWN:
|
||||
case KEYCODE_K:
|
||||
case KEYCODE_K:
|
||||
case KEYCODE_S:
|
||||
keyAction = ACT_DOWN;
|
||||
break;
|
||||
case KEYCODE_Z:
|
||||
case KEYCODE_U:
|
||||
case KEYCODE_U:
|
||||
case KEYCODE_Q:
|
||||
case KEYCODE_COMMA: //,
|
||||
keyAction = ACT_DIG_LEFT;
|
||||
break;
|
||||
case KEYCODE_X:
|
||||
case KEYCODE_O:
|
||||
case KEYCODE_O:
|
||||
case KEYCODE_E:
|
||||
case KEYCODE_PERIOD: //.
|
||||
keyAction = ACT_DIG_RIGHT;
|
||||
break;
|
||||
case KEYCODE_ESC: //help & pause
|
||||
@@ -260,17 +317,7 @@ function handleKeyDown(event)
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
//e.cancelBubble is supported by IE - this will kill the bubbling process.
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
|
||||
//event.stopPropagation works only in Firefox.
|
||||
if (event.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
*/
|
||||
|
||||
if(event.keyCode >= 112 && event.keyCode <= 123) return true; //F1 ~ F12
|
||||
return false;
|
||||
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur