Compare commits
No commits in common. "6b7ff7e86d813543a889c9cfec9d4dda66be60a0" and "de390dff8a3d46a8dd58858e0da5dc46ccaf8249" have entirely different histories.
6b7ff7e86d
...
de390dff8a
4 changed files with 2 additions and 46 deletions
|
@ -8,11 +8,9 @@
|
|||
[16, 10]
|
||||
],
|
||||
"rules": {
|
||||
"worldWrap": false,
|
||||
"autoSpeedIncrease": true,
|
||||
"autoSpeadIncreaseTicks": 10,
|
||||
"autoSizeGrow": true,
|
||||
"autoSizeGrowTicks": 100,
|
||||
"scoreSystem": "survival"
|
||||
"autoSizeGrowTicks": 100
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"dimensions": [32, 32],
|
||||
"delay": 100,
|
||||
"food": [
|
||||
[16, 5]
|
||||
],
|
||||
"snake": [
|
||||
[16, 12],
|
||||
[16, 11],
|
||||
[16, 10]
|
||||
],
|
||||
"rules": {
|
||||
"speedMultiplier": 0.8,
|
||||
"gameDuration": 30000,
|
||||
"winCondition": "time"
|
||||
}
|
||||
}
|
|
@ -108,16 +108,4 @@
|
|||
else if(e.key=='ArrowRight') inputs.right=true;
|
||||
});
|
||||
|
||||
window.addEventListener('touchstart', e => {
|
||||
let x=e.touches[0].clientX/window.innerWidth-.5;
|
||||
let y=e.touches[0].clientY/window.innerHeight-.5;
|
||||
const angle=((Math.atan2(x, y)+2*Math.PI)%(2*Math.PI))/Math.PI;
|
||||
|
||||
let inputs=currentInputs;
|
||||
if(angle>.25 && angle <.75) inputs.right=true;
|
||||
else if(angle>.75 && angle<1.25) inputs.up=true;
|
||||
else if(angle>1.25 && angle<1.75) inputs.left=true;
|
||||
else inputs.down=true;
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -82,9 +82,7 @@ class SnekGame {
|
|||
worldWrap: true,
|
||||
winCondition: 'none',
|
||||
scoreSystem: 'fruit',
|
||||
netPlay: false,
|
||||
autoSizeGrow: false,
|
||||
autoSpeedIncrease: false
|
||||
netPlay: false
|
||||
}, rules, settings.rules || {});
|
||||
}
|
||||
|
||||
|
@ -307,17 +305,6 @@ class SnekGame {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Object
|
||||
.keys(inputs)
|
||||
.forEach(k => {
|
||||
let v=inputs[k];
|
||||
if(v===true) v=5;
|
||||
v--;
|
||||
if(!v) delete inputs[k];
|
||||
else inputs[k]=v;
|
||||
});
|
||||
|
||||
if(inputs.left && trySet([-1, 0])) return delete inputs.left;
|
||||
else if(inputs.right && trySet([ 1, 0])) return delete inputs.right;
|
||||
else if(inputs.up && trySet([ 0,-1])) return delete inputs.up;
|
||||
|
|
Loading…
Reference in a new issue