Code Monkey home page Code Monkey logo

agonima-webpack-ts-responsive's Introduction

Webpack + TypeScript + Responsive project template for Phaser Editor 2D

A project template for Phaser 3, Webpack 5, TypeScript, and Phaser Editor 2D v3. Responsive template that you can align game canvas to edges of the screen.

First steps

This project requires Node.js and NPM.js. It is recommended that you learn the basics of Webpack.js.

  • Install dependencies:

    npm install
    
  • Run the development server:

    npm start
    

    Open the browser at http://127.0.0.1:8080.

  • Make a production build:

    npm run build
    

    It is generated in the /dist folder.

Run the editor

  • You can run the editor using the editor NPM script, defined in the package.json file:

    $ npm install
    $ npm run editor
  • If you are in a remote environment (like the Gitpod.io IDE), then run the editor like this:

    $ npm run editor-remote
  • If you want to see all the editor options, run:

    $ npx phasereditor2d-launcher -help
  • If Phaser Editor 2D Core is globally installed, you can run:

    $ PhaserEditor2D -project .

Responsiveness

There is an 'AlignCanvas' component in the template. You can align the canvas to all directions with this component. It is attached to CanvasRef gameobject by default. Play with orientation and padding values to align canvas.

You can also locate ui elements to the edges of the screen with 'AlignToScreen' component or you can write your own resize method to locate GameObjects wherever you want!

On the other hand, you will see 'gameAreaRightX, gameAreaRightX, gameAreaTopY, gameAreaBottomY, gameAreaAvailableSpace' properties in the 'AlignCanvas' component. You can use these responsive data to avoid objects overlapping. You can fit ui GameObjects to spaces in the canvas with using 'canvasAvailableSpace' data. This data returns left, right, top and bottom space that is available in the canvas other than game area. You can see an example in Ui scene 'resize' method to how to use it.

I recommend this template for making mobile games.

Author

Created by the Phaser Editor 2D team and added responsiveness by Agonima who is an HTML5 Game Developer.

agonima-webpack-ts-responsive's People

Contributors

talhaozdemir avatar

Stargazers

Phaser Editor 2D avatar

Watchers

 avatar

agonima-webpack-ts-responsive's Issues

Migrate to Phaser 3.60

Hi!

Phaser 3.60 is out and we at Phaser Editor 2D are migrating all our content to this new version of Phaser. It includes the Phaser Editor 2D Marketplace listing.

Your project here targets a previous version of Phaser, for that reason we unlisted it from the Phaser Editor 2D marketplace. If you are interested on migrate this project to Phaser 3.60, it will be a pleasure for us to include it again in the Phaser Editor 2D marketplace. We really appreciate your contributions.

Thanks,
Arian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.