The Goal: Create a game mechanic or mini-game in under a week that involves the Strategy Design Pattern in the code's implementation.
1. What does the player do in the game that changes the behavior being used by a class (with the strategy design pattern) while the game is running?
If you press Q, W, or E, the bowl you’re controlling changes color and changes what kind of fruit it can catch, the fruit corresponding to the color.
2. What changes in the game when the behavior of the client class changes?
When the behavior changes, the color of the bowl and the type of fruit you can catch changes. In the actual code, the individual catch behaviors change the RGB value of the player and return the string of the current accepted fruit.
3. What were the benefits of using the Strategy Pattern to make your mini-game?
Using the Strategy Pattern really helped me clean up my code more than I’m used to when I make games. Having this plan of what pattern I had to use going in helped me better decide what scripts were necessary and helped me decide where to put certain bits of code. Changing the behavior of the player takes significantly less lines of code in the PlayerMovement script compared to the giant if else statement I would have concocted otherwise.
4. Did you find any drawbacks to using the Strategy Pattern? If so, what were they?
With this specific game idea, I think that the Strategy Pattern was probably my best option. That being said, I had to rewrite the method headers several times as I was used to using the OnTriggerEnter2D method to handle everything that I was trying to do here (which probably wasn’t the best idea in the first place.)
5. What is the player’s goal in your mini-game and what makes it challenging?
The player’s goal in my mini-game is to get 30 points in any of the three available difficulties without dropping any fruits. The challenge comes from managing to catch each of the fruits while also matching the colors as they fall.
6. How does the game communicate its goal(s) to the player?
The game has a tutorial level that allows the player to test out the controls and learn the mechanics at their own pace. When you lose in the non-tutorial levels, the game also reminds you how many points are needed to win.
7. How can the player fail at the game and how does the game detect it?
If the player lets a fruit drop pass them or tries to collect a fruit with the wrong color (in a non-tutorial level), the fruit will hit a collider off screen and the game over screen will appear.
8. How does the game give players feedback about how well they are doing?
The game has sound effects that play whenever you either collect or fail to collect a fruit. There is also a visible score in the upper-left-hand corner of the screen, and the game explicitly tells you if you won or lost (and if you lost, how close you were to winning) every time the game ends.