Homework 3: Make It Your Own
Next week, you'll be developing a movie for your friendly grutoring team. This week, you have a chance to create one (or more) sprites that will take part in your movie.
The text files that Sprites are stored in contain specific formatting to define the sprite's dimensions and content.
Your Task
Create at least one new ASCII image file and modify your program to use it:
- Create a new sprite file in the
spriteImages
directory with your own ASCII art. - Change your
makeOurMovie
function to use the new sprite you've created. - Test that it works as expected.
Sprite File Format
The text files in which sprites are stored must use this exact format:
- Line 1: The number of columns (should be
40
) - Line 2: The number of rows (should be
10
) - Line 3: Exactly 400 characters that form the sprite image (40 columns × 10 rows)
For example,
40
10
[400 characters in a single line with no line breaks]
Creating Your Sprite
One way to build your ASCII character is to work in the text editor of your choice with a fixed-width font:
- Draw your character on 10 lines, making sure that each line has exactly 40 characters.
- When you're done, remove all of the newline characters to create one long line of 400 characters. (You should be able to use search-and-replace to get rid of the newline characters.)
- Add the width and height lines at the top of the file.
Helpful Hints
Here are some tips for creating great sprites!
Use a Fixed-Width Font
When designing your sprite, use a fixed-width (monospace) font in your text editor. Since each character takes up the same horizontal space, you can ensure that everything lines up properly.
Fill Empty Space
Remember that each line must be exactly 40 characters. Use space characters to fill any empty areas in your design.
Be Creative (But Original)
While you can find tools online for generating ASCII art for you, for this assignment we ask that you draw your own. It's okay if they're simple (but if you want to get creative, we encourage that, too)!
Remember to Add Your File
Remember to add your new file to your repository with git add
, so that we can see it!
Test Your Sprite
You can take a look at the mystery1.txt
sprite as a model. After creating your sprite, make sure it displays correctly when you run your program.
Simple Sprite Converter Tool
To help you create sprites, here's a simple converter tool. Draw your sprite in ASCII art in the upper text box (10 lines, 40 characters each) and click to convert it to a single line of text in the lower text box. You can then copy and paste that line into a text file and save it as a sprite.
(When logged in, completion status appears here.)