Organised

I wanted to make something that didn’t really need to be made for this assignment. This is a game about feeding cats. It’s not particularly rewarding or inspiring. I knew that the most difficult part to this assignment would be the game’s main function, randomly generating a triangle in one of four positions. I asked my friend for help and this is how we made the triangles work. The program would generate a random number between one and four. We found out that this included numbers with decimal points, so we made sure to make the computer choose integers between 0 and 4 by using the parseInt() function. If a 2 was generated, a triangle would be drawn in the second position a triangle could be drawn in.

Then, to continue generating these random triangles, if a 2 was generated and the mouse clicked in the area in the second position of the triangle, a new number would be generated. Generated the new numbers and triangles happened too quickly, so I put a half a second delay on the number generating function. To make this an actual game, each time the correct triangle was pressed, the player would be awarded one point. When 10 point were reached, the screen would switch to an ending scene for 4 seconds, while the point count would reset back to zero.

After I figured out these logistics, I drew the cat faces. I don’t think I made them very efficiently and ran into issues with strokes on shapes, even though I used the noStroke function/command. I had trouble recreating the cats in the new positions and doing basic math. As you can see, one cat is missing an ear. This is not intentional.

Find code on GitHub

You can test it out here, as well.

 

Leave a Reply