Game Development Reference
In-Depth Information
13 - Sonar Treasure Hunt
you wish to drop a
122. sonar device. The sonar can find out how far away the
closest chest is to it.
123. For example, the d below marks where the device was
dropped, and the 2's
124. represent distances of 2 away from the device. The 4's
represent
125. distances of 4 away from the device.
126.
127. 444444444
128. 4 4
129. 4 22222 4
130. 4 2 2 4
131. 4 2 d 2 4
132. 4 2 2 4
133. 4 22222 4
134. 4 4
135. 444444444
136. Press enter to continue...''')
137. input()
The showInstructions() is just a couple of print() calls that print multi-line
strings. The input() function just gives the player a chance to press Enter before printing
the next string. This is because the screen can only show 25 lines of text at a time.
139. print('''For example, here is a treasure chest (the c)
located a distance of 2 away
140. from the sonar device (the d):
141.
142. 22222
143. c 2
144. 2 d 2
145. 2 2
146. 22222
147.
148. The point where the device was dropped will be marked with
a 2.
149.
150. The treasure chests don't move around. Sonar devices can
detect treasure
151. chests up to a distance of 9. If all chests are out of
range, the point
152. will be marked with O
153.
154. If a device is directly dropped on a treasure chest, you
have discovered
155. the location of the chest, and it will be collected. The
sonar device will
156. remain there.
157.
158. When you collect a chest, all sonar devices will update to
Search WWH ::




Custom Search