Games

I made a clone of pong in scratch. Here is a picture of the game.

Here is a picture of the code for the first paddle. As you can see, all there is here is code to allow the player to move the paddle up and down.

Here is a picture of the code for the second paddle. The code here is the same as in the first paddle, except it uses different keys so that a second player can play the game on the same keyboard.

Here is a picture of the code for the ball. Most of the code that makes the game work is here. In order to make the ball bounce, I told the ball to add 180 mod 360 to what angle it was pointing so that it would go the opposite direction.

Original Space Shooter

This is my original competitive multiplayer space shooter game. It is creatively entitled "Spacebattle". Two people control two ships, and the object of the game is to destroy the other person's ship by shooting it. Both ships can also turn around and attack the opponent's unprotected side by reaching the other end of the screen. The blue ship has faster bullets and more hp, but it moves more slowly than the red ship. You control the blue ship with WASD and space, and you control the red ship with the arrow keys and L. Have fun!

This is the code for the blue ship. I programmed it to move with WASD and bounce when it reaches the edge. This turns it around when it reaches the other side as well as preventing it from moving past the edge. When it touched the top or the bottom, I programmed it to correct its direction back to 90 or negative 90, because the bouncing caused it to move in funny ways. I also programmed it to explode when its hp reaches zero by having it make rapid costume changes through the frames of a short explosion animation.

This is the code for the red ship. The red ship's code is the same as the blue ship's, except you control it with different buttons and it moves faster.

This is the code for the blue bullet. I programmed it to hide and return to its ship every time the player presses space, and then move forward until it touches the edge or the other ship, at which point it hides again. the red bullet code is the same except it orients itself with respect to the red ship instead of the blue ship, and you press L to fire instead of space. In addition, the blue bullet moves faster than the red bullet.

Back to index.