Making Tetris (Video Game) by using Phaser (Typescript).

Overview

phaser3-parceljs-template

Phaser 3 + TypeScript + Parcel Template

For people who want to spend time making Phaser 3 games in TypeScript instead of configuring build tools.

License

This is a TypeScript specific fork of phaser3-parcel-template.

Prerequisites

You'll need Node.js, npm, and Parcel 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.

Then install Parcel:

npm install -g parcel-bundler

Getting Started

Clone this repository to your local machine:

git clone https://github.com/ourcade/phaser3-typescript-parcel-template.git

This will create a folder named phaser3-typescript-parcel-template. You can specify a different folder name like this:

git clone https://github.com/ourcade/phaser3-typescript-parcel-template.git my-folder-name

Go into your new project folder and install dependencies:

cd phaser3-typescript-parcel-template # or '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
    โ”‚   โ”œโ”€โ”€ scenes
    โ”‚   โ”‚   โ”œโ”€โ”€ HelloWorldScene.ts
    โ”‚   โ”œโ”€โ”€ index.html
    โ”‚   โ”œโ”€โ”€ main.ts
    โ”œโ”€โ”€ package.json

The contents of this template is the basic Phaser 3 getting started example.

This template assumes you will want to organize your code into multiple files and use TypeScript.

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

Other than that there is no opinion on how you should structure your project. There is a scenes folder in src where the HelloWorldScene.ts lives but you can do whatever you want.

Static Assets

Any static assets like images or audio files should be placed in the public folder. It'll then be served at 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').

TypeScript ESLint

This template uses a basic typescript-eslint set up for code linting.

It does not aim to be opinionated.

Dev Server Port

You can change the dev server's port number by modifying the start script in package.json. We use Parcel's -p option to specify the port number.

The script looks like this:

parcel src/index.html -p 8000

Change 8000 to whatever you want.

Other Notes

parcel-plugin-clean-easy is used to ensure only the latest files are in the dist folder. You can modify this behavior by changing parcelCleanPaths in package.json.

parcel-plugin-static-files is used to copy static files from public into the output directory and serve it. You can add additional paths by modifying staticFiles in package.json.

License

MIT License

You might also like...

Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate and produce the video.

Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate and produce the video.

๐Ÿ‘‹ Introduction Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate

Dec 6, 2022

A simple cli-app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. Powered by pkg and yt-scissors library.

A simple cli-app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. Powered by pkg and  yt-scissors library.

YouTube-Scissors CLI A simple CLI app that allows you to divide a YouTube video into multiple separate videos base on a video's time stamps. This proj

Nov 8, 2022

INeedHelp is a Game Boy, Game Boy Advance, and Nintendo DS emulator written in JavaScript and TypeScript.

INeedHelp INeedHelp is a Game Boy Advance and Nintendo DS emulator written in JavaScript/TypeScript. FAQ Why is it called INeedHelp? You would need he

Jun 29, 2022

Mike North's "Making TypeScript Stick" course.

Mike North's "Making TypeScript Stick" course.

Oct 30, 2022

A little CLI for making TypeScript packages, cleanly and effortlessly.

TSEX A little CLI for making TypeScript packages, cleanly and effortlessly. Install npm install -g tsex Usage Usage: tsex [options] [command] A littl

Nov 15, 2022

A library for controlling the Minecraft Console Client and making bots for it in JavaScript/TypeScript.

MCC.jS About A work in progress JavaScript/TypeScript library for remote control and bot creation for the Minecraft Console Client using RPC over WebS

Sep 14, 2022

A collaborative project to parody the once exceedingly popular video game Cloud from ThatGameCompany.

A collaborative project to parody the once exceedingly popular video game Cloud from ThatGameCompany.

A collaborative project to parody the once exceedingly popular video game Cloud from ThatGameCompany.

Mar 5, 2022

Generate short video game music, automatically, endlessly.

Generate short video game music, automatically, endlessly.

short-VGM-generator (DEMO) Generate short video game music, automatically, endlessly. It is powered by machine learning with magenta.js HOW TO PLAY Pr

Oct 28, 2022
Owner
Poom Yimyuean
He / Him, Area of Interest: Web Dev, Web Scraping & Automation, Game Dev, Data Science.
Poom Yimyuean
A template application for setting up a mobile app video game with IONIC, PHASER, ANGULAR and a Monorepo strategy

OpenForge Ionic Monorepo Example This is a template project for all you aspiring video game developers out there! Want to use your web application ski

OpenForge 67 Dec 22, 2022
Recreated Chromium T-Rex game in Phaser 3, written in HTML5 & TypeScript

Chromium Dino Game - Phaser 3 + TypeScript + Parcel Chromium Dino Game Clone using Phaser 3 + TypeScript + Parcel Play You can play online here Dino P

Mai Hoร ng Anh Vลฉ 3 Jun 21, 2022
A game inspired by Go, developed using Phaser JS

Influence A game inspired by Go, developed using Phaser How to play Players take turns to select and color a tile. At the end of a turn, each tile wil

null 11 Aug 28, 2022
This plugin can generate timestamps for video, audio and Bilibili video, it takes you to the corresponding video/audio position when clicked.

logseq-plugin-media-ts ๆœฌๆ’ไปถ่ƒฝๅคŸ็”Ÿๆˆ่ง†้ข‘ใ€้Ÿณ้ข‘ไปฅๅŠ B ็ซ™่ง†้ข‘็š„ๆ—ถ้—ดๆˆณ๏ผŒ็‚นๅ‡ปๆ—ถ้—ดๆˆณๅŽไผš่ทณ่ฝฌๅˆฐๅฏนๅบ”็š„้Ÿณ่ง†้ข‘ไฝ็ฝฎใ€‚ This plugin can generate timestamps for video, audio and Bilibili video, it takes

Seth Yuan 58 Jan 3, 2023
A browser game build with phaser 3 during the Ludum Dare 50 GameJam.

Loading... ?? Itโ€™s him again! In front of your home this human appears! And with him soon again this pesky progress bar! Fight the data packs with all

Fabian 3 Aug 22, 2022
Learn design patterns through games with TypeScript and Phaser ๐Ÿ•น๏ธ

Welcome to Design patterns gamified! I created this repo to teach design patterns through games. Each folder contains a tiny game that demonstrates ho

Paula Santamarรญa 41 Nov 10, 2022
A starter template that uses Phaser 3, TypeScript, Electron and Rollup and Vite for bundling.

Phaser TypeScript Electron starter template This is a ??๏ธ Phaser 3 starter with โŒจ๏ธ TypeScript and โš›๏ธ Electron, ?? Rollup and Vite. ?? ?? HOT RELOAD ON

null 11 Nov 25, 2022
Full source-code for the step-by-step tutorial on how to use Phaser + Colyseus together.

Phaser: Real-time Multiplayer with Colyseus Full source-code for the step-by-step tutorial on how to use Phaser + Colyseus together. Live Demo See ste

Colyseus 19 Dec 24, 2022
a web tool for making "one-way" flowcharts for game design

Flowmeo Flowmeo is a web tool to quickly make one-way, "dependency" flowcharts, like you might need for designing an adventure game, or a tech tree, o

null 7 Sep 21, 2022
We are a group of videogame URJC students making a brand new Phaser3.0 browser multiplayer game. Come and support us!

COOKIE MAYHEM - JUEGOS EN RED Este proyecto estรก sujeto a cambios. Somos un grupo de estudiantes de Diseรฑo y Desesarrollo de Videojuegos en la Univers

null 6 Dec 19, 2022