CS 70

Homework 3: Make It Your Own

At this point, you have a working movie with multiple sprites moving around the screen. If you're pushed for time, you can stop here and submit your assignment. However, now that we have the Scene class, it's easy to add new behaviors and interactions to make the movie more interesting. The canvas is yours to paint on! We just have a couple of restrictions:

  • Stay within the realm of classic ASCII art (without color, emoijis, etc.).
  • No additional files except for new sprite image files in the spriteImages directory.
  • No changes to the Display class, or alterations to the exisiting public interfaces of the other classes (BoundingBox, Sprite, Asciimation, and Scene).
    • You can add new public member functions, but we need to be able to test your code using the existing public member functions and have them behave as specified.

Here are some ideas for things you could do:

  • Add a new constructor to the Sprite class that takes an extra parameter to specify that a particular character means “this part is transparent”. Then modify the Asciimation::renderSprite function to skip over those pixels when rendering the sprite. This change would allow you to create sprites that are not rectangular blocks.
  • Add collision detection between sprites. Most of the code would go in the Sprite class to detect when two sprites overlap, and then the Scene class would need to call that code and respond appropriately (e.g., by reversing the velocity of both sprites).
  • Add user interaction. For example, you could allow the user to control one of the sprites using the keyboard.
  • Bounce sprites off the edges of the screen.
  • Periodically change the velocity of a sprite to make it move in a more interesting way.

Note that just because there are a fixed number of sprites doesn't mean they all have to be on the screen at the same time. You could have one sprite move off the screen and then reappear later, or have sprites appear and disappear based on some condition.

Your Task

Plan out what you want to do, and then implement it. Be creative! You can do anything you like as long as it fits within the constraints above.

When you're done, briefly describe your changes in the Our Changes section of README.md in the asciimation directory. This section should include:

  • Instructions for people running your movie to see the new features in action (e.g., “Press 'a' to make the cow appear”, or “The sprites will bounce off the walls”).
  • A brief summary of the changes you made to implement the new features (e.g., “Added a new member function isCollidingWith to the Sprite class to detect collisions between sprites”).

If you decide not to add any new features, just put the text “No changes made.” in the Our Changes section of your README.md file.

To Complete This Part of the Assignment

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)