Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pkief/svelte-snake

A snake game written in Svelte and TypeScript
https://github.com/pkief/svelte-snake

canvas game snake svelte typescript

Last synced: 27 days ago
JSON representation

A snake game written in Svelte and TypeScript

Awesome Lists containing this project

README

        




Game logo



Snake




First class Snake game. Powered by Svelte.

## Game instructions

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.

## Technological background

This game was implemented with the frontend framework [Svelte](https://svelte.dev/). 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.

### Installation instructions

To get the game up and running on a local machine it's necessary to install the runtime [Node.js](https://nodejs.org/en/).

#### Install dependencies

```
npm install
```

#### Start local development server

```
npm start
```

#### Generate production bundle

```
npm run build
```