@@ -14,14 +14,19 @@ However, if you want to make game in modile environment not using mobile web bro
## Before prepare for phaser
Before prepare for using Phaser, you may need local webserver to run Phaser game because of security issue or CORS problem. In that case, prepare your favorite local webserver environment.
## After setting up environment
You use CDN in script or install phaser by using npm or download at website. Below is phaser archive link you can choose specific version you want. If you download necessary files or use npm for installation, now you are ready to dive in phaser world! (of course, you can use CDN instead)
You can use CDN in script or install phaser by using npm or download at website or GitHub. Below is phaser archive link you can choose specific version you want. If you download necessary files or use npm for installation, now you are ready to dive in phaser world! (of course, you can use CDN instead)
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/>
# Topics about Phaser 3
# Knowledges 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 lifecycle and what you should concern</strong>]()
\ No newline at end of file
[<strong>Phaser Scene cycle</strong>](./lifecycle/README.md)<br/>
[<strong>Phaser Physics: arcade vs matter</strong>](./physics/README.md)
Phaser's Scene consists of 3 main states which are **CREATE**, **UPDATE** and **STOP**. You can switch to each state using triggering events on manually and also you can add eventhandler for those. Please check flow chart on <strong>[Phaser 3 Scene Note](https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scene/)</strong> to see how phaser's states are enterd and what detailed steps are.<br/><br/>
However, if you just started using phaser, you should know 3 basic Scene functions **preload**, **create** and **update**.
<pre><code>
preload (){
// Codes in here will be executed before create()
}
create (){
// Codes in here will be executed before Scene starts updating
}
update(){
// Codes in here will be executed every time Phaser update this scene
}
</code></pre><br/>

Usually, you can load images or other resources at **preload** and create Phaser objects at **create** like sprite objects or others. And make your own game logic at **update**. But you have to consider that **update** get executed periodically which is directed with FPS (if FPS is 30, that means **update** get executed 30 times in a second). However, you can set FPS and **update** execution rate different.
---
## Why we load resources at **preload** and make objects at **create**?
You may wonder why i suggest you to load resources at **preload** and create objects at **create**. Well, if you try you may see that some objects not being created well especially image related objects. This is because Phaser is based on JavaScript which makes loading resources asynchronously. Thus, to avoid such problem, i recommend you to load resources at preload and create phaser object at **create** but it is not mandatory nor official.
In Phaser, there are 3 type of phsic engines which are **arcade**, **matter** and **impact**. Among them, peolpe usually use **arcade** and **matter** (There are not even enough information about **impact** physics in <strong>[Phaser API docs](https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Impact.html)</strong>). Then you will wonder what is the difference between arcade physics and matter physics.
---
## performance: arcade vs matter
If you searched about it before, then you would see many comments saying that **arcade** physics are more suitable in simple games because of performance issue. And yes, that is sort of true because while **matter** has more functions and complex advanced physics body which requires more memory. So, even if you make same simple game with **matter** physics, it spends more memory than one made widh **arcade** physics. There are some conversations about this and this one might be helpful: https://phaser.discourse.group/t/arcade-vs-matterjs-performance/7218.
---
## 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.