For the midterm project, I brought the simple minion game which I made in processing a few years ago into p5 sketch. I used the constructor and class instead of array. The principle of game is simple.There are 3 status in total. It is a survival game avoiding enemy minion which is getting faster and bigger from Status 1 to 3.
Each stage moves to the next stage if the minions survive without colliding with each other within five seconds. If you pass the final status 3, you win the game.
The most hard thing here was to code ‘status change’. To avoid confusion, the code parts were divided into what would be ‘status change’ and what would be drawn in each status 1, 2 and 3.
(Also, millis() were used to change over time.)
In status 1, The distance between the two minions is calculated using the dist() function and If the distance is less than the combined radius of the two minions, the game is over.(because they collide) And if you survive in five seconds, Then, you can move to the next status and the enemy minion become faster and bigger.
status 2 is a similar principle, and after five seconds, I only set the minion’s speed get faster. If it survives after 5 seconds in status 3, you will finally win the game.
The problem with this game is that sometimes when you restart the game over screen, the game doesn’t run very well at the start screen like this. I think this is because two minions might have hit each other before the start, so I think I need to set the status again. I’m still working on that. Also, it seems that the two minions die before they actually hit each other, I think I have to recalibrate the distance.
Here is my code link.