Recreated Chromium T-Rex game in Phaser 3, written in HTML5 & TypeScript

Overview

Chromium Dino Game - Phaser 3 + TypeScript + Parcel

Chromium Dino Game Clone using Phaser 3 + TypeScript + Parcel

License

Play

You can play online here Dino Phaser

Features

  • Apply state design pattern to create a simple state machine for player
  • Implement new compound body based on Arcade Physics Plugin of Phaser 3 because Arcade does not support multiple colliders in one game object.

Compound Body when running

Compound Body when ducking

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/jesuisjohan/Dino-Phaser

This will create a folder named Dino-Phaser. You can specify a different folder name like this:

git clone https://github.com/jesuisjohan/Dino-Phaser my-folder-name

Go into your new project folder and install dependencies:

cd Dino-Phaser # 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
    β”‚   β”‚   β”œβ”€β”€ DinoGame.ts
    β”‚   β”‚   β”œβ”€β”€ DinoPreloader.ts
    β”‚   β”‚   β”œβ”€β”€ ...
    β”‚   β”œβ”€β”€ index.html
    β”‚   β”œβ”€β”€ main.ts
    β”œβ”€β”€ package.json

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

This game 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 game 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...

Chromium extension for displaying all the available formats of an AppleMusic album.

Chromium extension for displaying all the available formats of an AppleMusic album.

AppleMusic-Formats-Extension Chromium extension for displaying all the available formats of an AppleMusic album. Before Vs After How to Install? From

Dec 16, 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

Dec 24, 2022

A lightweight "Falling Sand Game" written in TypeScript

TechSquid Falling Sand Game | TSFSG A lightweight "Falling Sand Game" written in TypeScript with Pixi.js. Click to spawn particles of sand. TO DO: col

Aug 15, 2022

2D HTML5 rendering and layout engine for game development

2D HTML5 rendering and layout engine for game development

Stage.js is a 2D HTML5 JavaScript library for cross-platform game development, it is lightweight, fast and open-source. Check out examples and demos!

Jan 3, 2023

HTML5 Game Engine

HTML5 Game Engine

Quintus Engine Quintus is an easy-to-learn, fun-to-use HTML5 game engine for mobile, desktop and beyond! The Quintus engine is an HTML5 game engine de

Dec 21, 2022

HTML5 game framework for web and iOS

#LimeJS ##Getting started: ###Mac OS X and Linux users: Requirements: Python 2.6+, Git Clone the git repo (you have probably already done that): git c

Dec 1, 2022

A Lua plugin, written in TypeScript, to write TypeScript (Lua optional).

typescript.nvim A minimal typescript-language-server integration plugin to set up the language server via nvim-lspconfig and add commands for convenie

Dec 29, 2022

Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript.

Screeps Typescript Starter Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript. It provides everything you need to s

Jan 27, 2022

🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

🐬 HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Dec 20, 2022
Owner
Mai HoΓ ng Anh VΕ©
Computer Science Student at HCMUT
Mai HoΓ ng Anh VΕ©
Making Tetris (Video Game) by using Phaser (Typescript).

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

Poom Yimyuean 3 Nov 3, 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
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
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
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

Powerlated 6 Jun 29, 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
A guide that teach you build a custom version of chromium on macOS/Windows/Linux that supporting hardware/software HEVC decoding.

enable-chromium-hevc-hardware-decoding A guide that teach you build a custom version of chromium on macOS/Windows/Linux that supports hardware/softwar

Sta Zhu 778 Jan 1, 2023
injects Chromium extension into packaged electron apps. highly experimental. might work.

Electron extension injector injects Chromium extension into packaged electron apps. highly experimental. might work. use Alt+Shift+E to access extensi

Cynthia 6 Sep 2, 2022
A Chromium extension that enables users to use customizable :emoji: on Facebook/Facebook Messenger.

:emoji: for Messenger A Chromium extension that enables users to use customizable :emoji: on Facebook/Facebook Messenger. Install Download the extensi

null 4 Aug 31, 2022