Game Programming

Scratch

Scratch is a program where we were able to make games. Instead of typing out the code and commands, the code is organized in blocks that we can put together to make a program of our own.

This shows a simple piece of code where two blocks are connected. This is the code for moving player 2 downwards.


Pong

The first game we made was Pong. I made a sprite for each of the players and the ball. I gave the players access to move the bar up and down. I programmed the ball to have similar functions as the original pong.


Story Game

The second game we made was a story game. I had my game take place during the purge.

For my story, I coded certain functions for each sprite. Here's the code for both the main character and the apple.

The first segment of code is for the scene where the main character talks about the apple. I had to time it so that she says, "So many apples..." later on. I couldn't find a way to detect the number of apples and then play that message.


Quiz

We had the task of programming a computer science quiz containing things we've learned so far in this class.

I made my quiz Jeopardy themed. I have yet to add sound and the final Jeopardy at the end.

This is my code for the answer bar that shows up when the background switches to one of the clues. Since each answer was different, I had to duplicate the code and coded the correct answer.

This is a close up of one of the clues. The 11 refers the the row and column of the clue this code is for.


Algorithms

An algorithm is a process a computer goes through to make calculations or other problem-solving operations.

To count the number of comparisons it takes to organize a list, we weighed film canisters of pennies and found how many comparisons it would take. There are different processes to get to the right order and my group did the quicksort algorithm.