Tuesday, December 15, 2015

Asteroids - CodeSkulptor




Link to game

The last project in my Coursera Python class is the game Asteroids. If you are unfamiliar with Asteroids, the goal is to shoot and dodge asteroids from your spaceship. It is a 2-D game where the screen shows the same area of space, but the objects on the screen can fly into one edge of the screen and come out the opposite edge.

This is my first attempt at a physics based game. I had a lot of fun with this one. The game gets progressively harder. The number and speed of asteroids increases over time.


Likes:

  • Random asteroid shapes:
    • The Python class suggested using an animated sprite for asteroids, but I wanted to be more true to the original and use randomly generated polygons. The polygons are generated by choosing a random number of vertices and random distances from each vertex to the polygon's center. 
  • Asteroid fragmentation:
    • Asteroids that are large enough will fragment upon collision. 
    • The velocity vector of the fragmented asteroids is based on the the velocity vector of the original asteroid. 
  • Boss asteroid:
    • There is a two percent change that any new asteroid will be a boss asteroid. Boss asteroids are very large, hard to destroy, and do not take damage when hitting regular asteroids. 
    • Boss asteroids show multiple explosion animations on random parts of the asteroid.
  • Power ups:
    • Power ups increase your weapon capabilities or shield HP. 
    • Power ups can only be obtained by flying the ship into them. 
    • If a power up is not obtained within 7 seconds, it disappears. A power up will start flashing before it disappears. 
  • Explosion animations:
    • The explosion animations are a few different pre-rendered image files provided through the Coursera class. Here is an example
    • Explosion animations keep the velocity of the asteroid.

Friday, December 11, 2015

Blackjack - CodeSkulptor




Link to Game


This is a simple Blackjack game I made for my Intro to Python class through Coursera. It runs in CodeSkulptor, a browser based Python environment designed for the class.

The purpose of this project was to learn to use classes and to manipulate image files in the canvas. The card images are all from a single image. The suit and rank of the card will determine which portion of the image is shown.

What I like about this:

  • Using the keyboard interface, the game can be played rapidly. 
  • If the cards get close to the edge, they start overlapping.