{game.ascii}
@@ -110,43 +100,17 @@ const Games = () => {
{game.description}
+ {game.hasMultiplayer && ( + + 2P + + )}
- {game.ascii}
-
- - {game.description} -
-
{'>'} Max score: 4,294,967,296
@@ -157,4 +121,4 @@ const Games = () => {
);
};
-export default Games;
+export default Games;
\ No newline at end of file
diff --git a/src/pages/Snake.tsx b/src/pages/Snake.tsx
index aea09f8..234c556 100644
--- a/src/pages/Snake.tsx
+++ b/src/pages/Snake.tsx
@@ -4,7 +4,7 @@ import { useSettings } from '@/contexts/SettingsContext';
import { useAchievements } from '@/contexts/AchievementsContext';
import { Link } from 'react-router-dom';
import GlitchCrash from '@/components/GlitchCrash';
-import { Maximize2, Minimize2 } from 'lucide-react';
+import { Maximize2, Minimize2, Users, User } from 'lucide-react';
import { useBrowserFullscreen } from '@/hooks/useGameDimensions';
import GameTouchButton from '@/components/GameTouchButton';
import { MobileControlsDock, MobileControlsSpacer } from '@/components/MobileControlsDock';
@@ -17,14 +17,40 @@ const HIGHSCORE_KEY = 'snake-highscore';
type Direction = 'up' | 'down' | 'left' | 'right';
type Position = { x: number; y: number };
+type GameMode = '1p' | '2p';
+
+interface Player {
+ snake: Position[];
+ direction: Direction;
+ score: number;
+ alive: boolean;
+ color: string;
+ name: string;
+}
+
const Snake = () => {
const { playSound } = useSettings();
const { checkGameScoreAchievements, unlockMaxScore } = useAchievements();
+
+ // Mode selection
+ const [gameMode, setGameMode] = useState Select game mode
+ 2 Player mode requires a keyboard and is not available on mobile devices
+ HIGH SCORE: {highScore.toLocaleString()} SCORE P: Pause P1 (WASD) {players[0].score} DEAD P2 (↑↓←→) {players[1].score} DEAD CONTROLS P1: W A S D P2: ↑ ↓ ← → P: PauseSnake
+ Snake
+
+
+ Snake {gameMode === '2p' && 2P}
+
Final Score: {score.toLocaleString()}
Length: {snake.length}
> )} -P1 Score
+{players[0].score}
+P2 Score
+{players[1].score}
+PLAYER 1 (WASD)
-{players[0].score}
- {!players[0].alive &&DEAD
} -PLAYER 2 (↑↓←→)
-{players[1].score}
- {!players[1].alive &&DEAD
} -CONTROLS
-P1: W A S D
-P2: ↑ ↓ ← →
-P: Pause
-P1
{players[0].score}
P2
{players[1].score}
P1 Score
-{players[0].score}
-P2 Score
-{players[1].score}
-Select game mode
+ ++ 2 Player mode requires a keyboard and is not available on mobile devices +
+ )} + +HIGH SCORE: {highScore.toLocaleString()}
+NEXT
-NEXT
+SCORE
{score.toLocaleString()}
HIGH SCORE
{highScore.toLocaleString()}
max: 4,294,967,296
LINES
{lines}
CONTROLS
← → ↑ ↓ / WASD
Space: Drop
P: Pause
SCORE
{score.toLocaleString()}
HIGH SCORE
{highScore.toLocaleString()}
max: 4,294,967,296
LINES
{lines}
CONTROLS
← → ↑ ↓ / WASD
Space: Drop
P: Pause
SCORE
{player1.score}
LINES
{player1.lines}
CONTROLS
+P1: WASD Q
+P2: ↑↓←→ /
+P: Pause
+SCORE
{player2.score}
LINES
{player2.lines}
Final Score: {score.toLocaleString()}
Lines: {lines}
>)} -Final Score: {score.toLocaleString()}
+Lines: {lines}
+ > + )} + {gameMode === '2p' && gameOver && ( +P1 Score
+{player1.score}
+P2 Score
+{player2.score}
+