Modularity & Reusability
To start with, I cleaned up the function draw(){}.
In order to do that, I categorized every codes/elements in draw function into several different functions.
As a result, it became easier to understand what is going to be happen in draw function.
Also, It is easier to make a adjustment because function() work as navigation.
function draw() { background(0); if (mode == "homePage") { startHome(); } if (mode == "gamePage") { //Animate background backgroundDecorate(); //Draw EVE drawEve(); //Draw UFO drawUFO(); //Draw ENEMY drawEnemy(); //TEXT instructionText(); }
Also, since I grouped codes into functions, I could make each functions to interact more freely. I also could
simulate in my head and come up with crazier ideas. So I decided to make a starting/landing page before the
game, so that users can chose when to start. I designed startPage() first.
![Screen Shot 2019-10-02 at 2.05.45 PM.png](https://images.squarespace-cdn.com/content/v1/58d9727c6b8f5b87ea1806cd/1570040178238-XI0S8BZUOPETRUC4RCJV/Screen+Shot+2019-10-02+at+2.05.45+PM.png)
![Screen Shot 2019-10-02 at 2.06.07 PM.png](https://images.squarespace-cdn.com/content/v1/58d9727c6b8f5b87ea1806cd/1570040178184-0WQCTCHG8MGSK2K7XO58/Screen+Shot+2019-10-02+at+2.06.07+PM.png)
Then, I used mousePressed(){} and if(){} to make it switch between homePage and gamePage when user press start button .
![Screen Shot 2019-10-02 at 2.32.33 PM.png](https://images.squarespace-cdn.com/content/v1/58d9727c6b8f5b87ea1806cd/1570041182374-OMW0GHI3MQYWZHDY9HBH/Screen+Shot+2019-10-02+at+2.32.33+PM.png)
![Screen Shot 2019-10-02 at 2.32.18 PM.png](https://images.squarespace-cdn.com/content/v1/58d9727c6b8f5b87ea1806cd/1570041182295-TT2FFQZI5YHBXFS8K5JD/Screen+Shot+2019-10-02+at+2.32.18+PM.png)