Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

svelte-phaser

mattjennings1130.1.0-beta.2TypeScript support: included

Create Phaser 3 games with Svelte 3

svelte

readme

Documentation

Check out the documentation

Getting Started

Creating a new project

npx degit mattjennings/svelte-phaser/templates/svite my-first-game
cd my-first-game
npm install
npm run dev

# or if you prefer typescript:

npx degit mattjennings/svelte-phaser/templates/svite-typescript my-first-game
cd my-first-game
npm install
npm run dev

There are some other templates available as well

If a blank project is too boring, feel free to look through the examples.

Adding to an existing project

If you have an existing svelte project you can just install svelte-phaser:

npm install phaser svelte-phaser

and then import it:

<script>
  import { Game, Scene, Text } from 'svelte-phaser'
</script>

<Game width={400} height={400}>
  <Scene key="main">
    <Text x={140} y={180} text="hello world" />
  </Scene>
</Game>