For the midterm project, I made the minion game.
The principle of game is simple. There are 3 status in total. It is a survival game avoiding enemy moving minion which is getting faster and bigger from Status 1 to 3. Each status moves to the next stage if the minions survive without colliding with each other within five seconds in each status. When you go to from the status 1 to 2, the speed and size of the enemy minion are faster and when you go to status 3, the only speed of enemy minion is faster. If I hold out for more than five seconds in the final third stage, I win the game.
In the code, it was not easy for me to change each status using millis(). I had to think about how minions would be drawn at each status. For understanding of millis() function, I referred to some other game code in processing. As I had to know about the spending time at each status, So I set the now time is set to millis() in draw here so that I know the time that has passed) and also I set the start time millis() again for each status so that i can know the time passed in each status. and The value between the two were subtracted, I made it a spending time To know how many seconds it actually spend at each stage.
I confused to use the actual drawing part and millis function together. So to avoid confusion, I divided into ‘status change’ parts using millis() and ‘works to do’ parts that were actually drawn for the three status.
Also, I used ‘dist’function to calculate the distance between the two minions, and if the distance between the two is smaller than the distance between the two, then it is a collision and it displays the game over screen comeout.
the problem I got is sometimes when I re-run the game after gameover, the enemy minons size has to be small like user minion but it seemed that the size became twice already.