From 2cf8ca139156e42fd589820beaf739c31f122804 Mon Sep 17 00:00:00 2001 From: "dyddnrdl3@naver.com" <dyddnrdl3@naver.com> Date: Sun, 26 Dec 2021 16:27:08 +0900 Subject: [PATCH] add more contens --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++-- physics/README.md | 5 ++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e4c30c..4cfc353 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,62 @@ You can use CDN in script or install phaser by using npm or download at website <br/> **Using CDN** <pre><code><script src="//cdn.jsdelivr.net/npm/phaser@3.51.0/dist/phaser.js"></script> +</code></pre><br/> + +# Basic stucture of Phaser game +Below is basic structure using HTML, script and CDN. If you want to know each statement's meaning, please look for below additional topics +<pre><code> +<!DOCTYPE html> +<html> + +<head> + <script src="//cdn.jsdelivr.net/npm/phaser@3.51.0/dist/phaser.js"></script> +</head> + +<body> + + <script> + var config = { + type: Phaser.AUTO, + width: 800, // define canvas width + height: 600, // define canvas height + physics: { + default: 'arcade', // choose physics engine among arcade, matter and impact + arcade: { + gravity: { y: 100 } // physics engine + } + }, + scene: { + preload: preload, + create: create + } + }; + + var game = new Phaser.Game(config); + + function preload (){ + + } + + function create (){ + + } + + </script> + +</body> + +</html> + + + </code></pre><br/> # How to make phaser game? You can make various kinds of game like 2D-scroll game, puzzle game... etc. For starter, I recommend you to refer [Phaser website game examples](https://phaser.io/examples/v3/category/games) <br/><br/> -# Knowledges about Phaser 3 +# Additional Topics about Phaser 3 I'd like to talk about some feature, differences and other interesting topics may be helpful for your programming. Belows are my suggest! <br/> [<strong>Phaser Scene cycle</strong>](./lifecycle/README.md)<br/> -[<strong>Phaser Physics: arcade vs matter</strong>](./physics/README.md) \ No newline at end of file +[<strong>Phaser Physics: arcade & matter</strong>](./physics/README.md) \ No newline at end of file diff --git a/physics/README.md b/physics/README.md index 84b2d4f..96cc137 100644 --- a/physics/README.md +++ b/physics/README.md @@ -8,4 +8,7 @@ If you searched about it before, then you would see many comments saying that ** --- ## physics: arcade vs matter -From above, you may think 'why should we even consider about **matter** while it just wastes more memory thatn **arcade**?'. One of ther answer is that **matter** has more natural physic engine than **arcade** like complex shapes or chain of bodies. +From above, you may think 'why should we even consider about **matter** while it just wastes more memory thatn **arcade**?'. One of ther answer is that **matter** has more natural physic engine than **arcade** like complex shapes or chain of bodies. So, if you try to make game with high-level physics, you should use **matter** or mix it with **arcade** + +--- +## Examples of Phaser physics \ No newline at end of file -- GitLab