By either pressing one of the arrow keys on the keyboard or by using swipe gestures on a mobile device the Snake is starting to move. In the same way, the direction of the snake can be changed while it is moving. Since the snake is hungry, it would like to eat as many items as possible. Each item eaten makes the snake a little bigger, which also restricts the freedom of movement. The goal is to swallow as many items as possible.
This game was implemented with the frontend framework Svelte. The code base is written with TypeScript and Webpack is used for bundling into executable JavaScript code in the browser. For the rendering of the game logic a Canvas element is used.
To get the game up and running on a local machine it's necessary to install the runtime Node.js.
npm install
npm start
npm run build