|
|
|
@ -82,7 +82,9 @@ class SnekGame { |
|
|
|
|
worldWrap: true, |
|
|
|
|
winCondition: 'none', |
|
|
|
|
scoreSystem: 'fruit', |
|
|
|
|
netPlay: false |
|
|
|
|
netPlay: false, |
|
|
|
|
autoSizeGrow: false, |
|
|
|
|
autoSpeedIncrease: false |
|
|
|
|
}, rules, settings.rules || {}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -305,6 +307,17 @@ 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; |
|
|
|
|