Skip to content

riceball1/memory-match-game

Repository files navigation

memory-match-game

a simple phaser 3 memory match game -- tutorial

Technologies/Resources

Screenshot of Game

Getting Started

Phaser 3 + Vite.js Template

Make Phaser 3 games with modern frontend tooling.

License

Prerequisites

You'll need Node.js and npm installed.

It is highly recommended to use Node Version Manager (nvm) to install Node.js and npm.

For Windows users there is Node Version Manager for Windows.

Install Node.js and npm with nvm:

nvm install node

nvm use node

Replace 'node' with 'latest' for nvm-windows.

Getting Started

You can clone this repository or use degit to scaffold the project like this:

npx degit https://github.com/ourcade/phaser3-vite-template my-folder-name
cd my-folder-name

npm install

Start development server:

npm run start

To create a production build:

npm run build

Production files will be placed in the dist folder. Then upload those files to a web server. 🎉

Project Structure

    .
    ├── dist
    ├── node_modules
    ├── public
    ├── src
    │   ├── HelloWorldScene.js
    │   ├── main.ts
	├── index.html
    ├── package.json

JavaScript files are intended for the src folder. main.ts is the entry point referenced by index.html.

Static Assets

Any static assets like images or audio files should be placed in the public folder. It'll then be served from the root. For example: http://localhost:8000/images/my-image.png

Example public structure:

    public
    ├── images
    │   ├── my-image.png
    ├── music
    │   ├── ...
    ├── sfx
    │   ├── ...

They can then be loaded by Phaser with this.image.load('my-image', 'images/my-image.png').

ESLint

This template uses a basic eslint set up for code linting to help you find and fix common problems in your JavaScript code.

It does not aim to be opinionated.

See here for rules to turn on or off.

Dev Server Port

You can change the dev server's port number by modifying the vite.config.ts file. Look for the server section:

{
	// ...
	server: { host: '0.0.0.0', port: 8000 },
}

Change 8000 to whatever you want.

License

MIT License