13 lines
406 B
JavaScript
13 lines
406 B
JavaScript
export const zones = ['shore', 'rocks', 'pool'];
|
|
|
|
export function nextZone(currentIndex, direction) {
|
|
const step = direction === 'previous' ? -1 : 1;
|
|
return (currentIndex + step + zones.length) % zones.length;
|
|
}
|
|
|
|
export function directionForKey(key) {
|
|
if (key === 'ArrowLeft' || key === 'ArrowUp') return 'previous';
|
|
if (key === 'ArrowRight' || key === 'ArrowDown') return 'next';
|
|
return null;
|
|
}
|