Game Development Reference
In-Depth Information
Challenges
1. Penguin Pairs
In this challenge, we will extend the Penguin Pairs game.
(a) Currently, the level menu consists of a single page displaying a maximum of
fifteen levels. Extend the game such that multiple pages of levels are allowed.
Add two buttons to the level menu screen to be able to navigate through the
different pages.
(b) Extend the game so that it also contains polar bears that can be moved by
the player. Whenever a penguin collides with a polar bear, the penguin is so
scared that it immediately starts moving away from the bear. Design a few
different levels around this concept.
(c) Add a 'hole' object to the game. Whenever the penguin goes in the hole, it
appears from another hole elsewhere in the level and continues moving in
the same direction. Think of a smart way to represent this in the text file.
Especially, how do you represent the connections between the holes? Create
a couple of levels that use holes.
(d) Add a 'curve in the ice' item to the game that changes the direction of the
penguin if it moves over it. For example, if a penguin is moving up through a
curve object, and the curve is of the type 'turn left', the penguin will change
direction so that it continues moving to the left. Add a few more levels to the
game that use this item.
(e) Introduce a conveyor belt, which moves the penguin a fixed number of steps
in a certain direction. The penguin resumes in the original direction after
it.
A.5 Exercises and Challenges for Part V
Exercises
1. Text files and collections
Write a (console) application with the following specification. The program is
started from the command line and the user specifies two filenames. The program
reads the file corresponding to the first filename. Then it writes a text file with
as a name the second filename. The output file will contain the text of the first
file, but every word should be placed on a separate line. Also, the words will be
ordered alphabetically (or actually: according to the Unicode order). Each word
should be written to the file only once.
We consider every group of characters without a space between them as a word.
You may assume that there is exactly one space between each word in the input
file.
If the user provides too few or too many filenames, or there is an error during
reading or writing, the program reports this to the user.
Search WWH ::




Custom Search