My Games Page

The first assignment we were given was to program a game of Pong in Scratch. Scratch Scratch is a 2D programming language created by MIT.

Below is my code for the different parts of the game. I had to pick a background, program the computer's paddle to move on its own, program the user's paddle to respond to controls, and also program the ball to move randomly.

The hardest part of it was programming the computer to keep score during the game. It would either not give any points at all or give the points at the wrong time. I finally fixed the problem by programming the computer to only give points when the ball passes a certain point on the opposite side of the x-axis, instead of what I had before, which gave a point to the user when the ball touched the paddle. This method #1 didn't give anyone points, and #2 was not consistant with the object of the game.

This is the code for the ball. As you can see, I have a lot of conditionals and forever loops that make the ball move randomly around the screen. I also have many conditionals that are responsible for keeping score in the game. If the ball passes a certain point, the opposite side gains points. And visa versa.

This is the code for the left paddle. I programmed it to move by itself, and using a forever loop, I had it move up and down forever no matter what.

Finally, this is my right paddle code, which is controlled by the user. I programmed it to respond to certain commands - in this case the up and down buttons.

Now you can play the game!

You are the black player on the right. Press the up and down keys to make the paddle move. The scores are listed at the top. To start, press the green flag and to end, press the red stop sign.

This is another game that I created. It gives you a (fake) fortune. Press the green flag to start and the red stop sign to end. It is not super obvious, but here I used a conditional to control when the fortune gets displayed. When it says "When ___ Clicked," this is basically a conditional that is setting "clicked" to TRUE.

Here's the code

This is a simple maze game that I made in about 15 minutes. You use the arrows to control the direction you go in and it's really fun :)

Here's the code

In all these games, we used 3 different components; conditionals (if this, do this), loops (do this command 300x), and variables (move SPRITE1 10 steps). It was fun to make these programs while learning a lot about communicating with a computer.

Date: November 19th, 2013

Today we learned about the difference between Scratch and BYOB. Scratch was created by MIT. Once UC Berkeley saw the program, they decided to enhance it and call it BYOB - Build your own Block. In this, you can do multiplayer!

Unfortunately, I am not able to upload files from BYOB, but I am making a multi-player program that is similar to a maze, except there are many obstacles.

I also attempted to make a "Dots and Boxes" game, but it became really difficult. I had to make a lot of sprites as the grid, and it became really confusing.

Finally, we learned about broadcasting is BYOB. This is when you send a signal to certain sprites and they all do their commands at the same time. It's especially useful for multiplayer meshing, but I like it because it makes programming the different sprites easier.

Here's a sneak peak!

Here's a glimpse into the other program!

Date: November 20th, 2013

Today we learned how to do multi-player meshing on BYOB! This enabled us to share our games over the server and play against each other without crouching over one tiny screen, but instead using our own screens to play. It was often difficult at times because the sprites wouldn't refresh automatically and also we couldn't share certain things like the stages.

We made a basic 2-player shooting game where you have to get 50 points in order to win. It took a long time to get the pages to work, but once they did, it was awesome!

We used a lot of broadcasting in this in order to get the right signal over to the other computer.

Here's a glimpse into what we worked on today...

This is the code for my player in the game. It is telling the sprite what to do when they receive the broadcasts. The specific code is directing the sprite to turn in different directions depending on the selected button before it is pressed.

This is the code for the bullet that my sprite "shoots". The sprite doesn't actually shoot the bullet, but by programming the bullet to go to the sprite when hidden, appear while moving, and then hide when it hits, we can make it look like it's being shot. :)

This is where we host the mesh. For this game, I hosted it, and using my IP address, my partner joined the mesh.

In this screenshot, we are playing the game! It works!

Date: November 21st, 2013

Today I finished my game! Since I couldn't embed the game for you to play, I have embedded a video of it instead!

Date: December 13th, 2013

Today, I worked on the Hour of Code activities that were in honor of the birth of Grace Hopper, a famous computer scientist. Below are a couple of examples of the work I did.

1. This is the program that I made to guide the zombie through the field to eat the sunflower. I used conditionals to guide the zombie through the maze. I have embedded a video of the end result and my code.

2. I used functions and loops to make a program that will draw a snowman. I had to figure out how to program the computer to jomp to exactly the right spot on the screen and then start drawing the snowmen.

3. I made the computer draw this shape using repeat loops and random variables.