~robert-ancell/quickly/drop-lpi

« back to all changes in this revision

Viewing changes to data/templates/ubuntu-pygame/help/po/de.po

  • Committer: Michael Terry
  • Date: 2012-03-14 23:58:10 UTC
  • Revision ID: michael.terry@canonical.com-20120314235810-sm0y246lmfq43hs0
Tags: 12.03
update translation files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# German translation for quickly
 
2
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
 
3
# This file is distributed under the same license as the quickly package.
 
4
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
 
5
#
 
6
msgid ""
 
7
msgstr ""
 
8
"Project-Id-Version: quickly\n"
 
9
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
 
10
"POT-Creation-Date: 2011-04-04 08:43-0400\n"
 
11
"PO-Revision-Date: 2012-02-28 10:46+0000\n"
 
12
"Last-Translator: Launchpad Translations Administrators <Unknown>\n"
 
13
"Language-Team: German <de@li.org>\n"
 
14
"MIME-Version: 1.0\n"
 
15
"Content-Type: text/plain; charset=UTF-8\n"
 
16
"Content-Transfer-Encoding: 8bit\n"
 
17
"X-Launchpad-Export-Date: 2012-02-29 04:43+0000\n"
 
18
"X-Generator: Launchpad (build 14874)\n"
 
19
 
 
20
#: data/templates/ubuntu-pygame/help/tutorial.xml:13(firstname)
 
21
msgid "Rick"
 
22
msgstr ""
 
23
 
 
24
#: data/templates/ubuntu-pygame/help/tutorial.xml:14(surname)
 
25
msgid "Spencer"
 
26
msgstr ""
 
27
 
 
28
#: data/templates/ubuntu-pygame/help/tutorial.xml:16(corpauthor)
 
29
msgid "Canonical ltd"
 
30
msgstr ""
 
31
 
 
32
#: data/templates/ubuntu-pygame/help/tutorial.xml:20(date) data/templates/ubuntu-pygame/help/tutorial.xml:25(invpartnumber)
 
33
msgid "2010"
 
34
msgstr ""
 
35
 
 
36
#: data/templates/ubuntu-pygame/help/tutorial.xml:0(application)
 
37
msgid "Quickly PyGame Template"
 
38
msgstr ""
 
39
 
 
40
#: data/templates/ubuntu-pygame/help/tutorial.xml:24(productnumber)
 
41
msgid "0.6.1"
 
42
msgstr ""
 
43
 
 
44
#: data/templates/ubuntu-pygame/help/tutorial.xml:26(title)
 
45
msgid "<application>Quickly PyGame Template</application> 0.6.1 Tutorial"
 
46
msgstr ""
 
47
 
 
48
#: data/templates/ubuntu-pygame/help/tutorial.xml:31(title)
 
49
msgid "About This Guide"
 
50
msgstr ""
 
51
 
 
52
#: data/templates/ubuntu-pygame/help/tutorial.xml:32(para)
 
53
msgid ""
 
54
"Use <application>The Quickly Pygame Template</application> to write old "
 
55
"school arcade games for running on Ubuntu. PyGame is a framework that "
 
56
"handles sprites, collisons, sounds, and everything you need to make a game. "
 
57
"You just need to add the game play. The Quickly template creates a starter "
 
58
"game for you and comes ready for you to turn into your fun game, and then "
 
59
"easily package and share it with other Ubuntu users."
 
60
msgstr ""
 
61
 
 
62
#: data/templates/ubuntu-pygame/help/tutorial.xml:35(para)
 
63
msgid ""
 
64
"The Quickly Pygame Template inherits from the Quickly Application template. "
 
65
"So you get all the commands that you get from the that template, except "
 
66
"\"design\"."
 
67
msgstr ""
 
68
 
 
69
#: data/templates/ubuntu-pygame/help/tutorial.xml:41(title)
 
70
msgid "Creating and Running Your Game"
 
71
msgstr ""
 
72
 
 
73
#: data/templates/ubuntu-pygame/help/tutorial.xml:44(para)
 
74
msgid ""
 
75
"In this tutorial we will start making a top down shooter reminiscent of the "
 
76
"space arcade shooters of the 1980s."
 
77
msgstr ""
 
78
 
 
79
#: data/templates/ubuntu-pygame/help/tutorial.xml:50(para)
 
80
msgid ""
 
81
"We'll do this by creating a default game, editing some of the generated "
 
82
"code, writing some new code, and adding our images for sprits."
 
83
msgstr ""
 
84
 
 
85
#: data/templates/ubuntu-pygame/help/tutorial.xml:53(para)
 
86
msgid ""
 
87
"Creating a default working game couldn't be simpler. First, open a terminal "
 
88
"window to type commands into. When it's open, type the command:"
 
89
msgstr ""
 
90
 
 
91
#: data/templates/ubuntu-pygame/help/tutorial.xml:56(programlisting)
 
92
#, no-wrap
 
93
msgid ""
 
94
"\n"
 
95
"$quickly create ubuntu-pygame shooter\n"
 
96
" "
 
97
msgstr ""
 
98
 
 
99
#: data/templates/ubuntu-pygame/help/tutorial.xml:60(para)
 
100
msgid ""
 
101
"This will create a shooter sub directory containing a complete directory "
 
102
"tree and files for an empty python application. The command finishes by "
 
103
"running the newly created game. The game is played by using the \"s\" and "
 
104
"\"f\" keys to rotate the guy, the \"j\" key to shoot, and the \"l\" key to "
 
105
"thrust."
 
106
msgstr ""
 
107
 
 
108
#: data/templates/ubuntu-pygame/help/tutorial.xml:63(para)
 
109
msgid ""
 
110
"You can play the newly created game. Notice that the <application>Quickly "
 
111
"PyGame Template</application> inferred that the game title is \"Shooter\". "
 
112
"Also note that there is a guy that you can control with the s,f,j, and l "
 
113
"keys. There is an enemy and a homing missle. You also get a \"Game Over\" "
 
114
"screen, scoring, and levels build in for free."
 
115
msgstr ""
 
116
 
 
117
#: data/templates/ubuntu-pygame/help/tutorial.xml:66(para)
 
118
msgid ""
 
119
"Close the game by closing the window or using the Esc key. Since the game "
 
120
"isn't installed into Ubuntu yet, you can't start the game from the "
 
121
"application menu yet. To start the game, use the terminal to first cd into "
 
122
"the new subdirectory, and then use \"quickly run\" to start the program."
 
123
msgstr ""
 
124
 
 
125
#: data/templates/ubuntu-pygame/help/tutorial.xml:69(programlisting)
 
126
#, no-wrap
 
127
msgid ""
 
128
"\n"
 
129
"$cd shooter\n"
 
130
"$quickly run\n"
 
131
" "
 
132
msgstr ""
 
133
 
 
134
#: data/templates/ubuntu-pygame/help/tutorial.xml:75(title)
 
135
msgid "Creating your own Sprites"
 
136
msgstr ""
 
137
 
 
138
#: data/templates/ubuntu-pygame/help/tutorial.xml:79(listitem)
 
139
msgid ""
 
140
"Ink Scape is a great and free tool for creating your sprites. It's in the "
 
141
"Featured Applications section of the Software Center."
 
142
msgstr ""
 
143
 
 
144
#: data/templates/ubuntu-pygame/help/tutorial.xml:80(listitem)
 
145
msgid ""
 
146
"If you use Ink Scape, you'll want to export the images as PNGs. But keep the "
 
147
"Ink Scape files around in case you want to edit the sprites later."
 
148
msgstr ""
 
149
 
 
150
#: data/templates/ubuntu-pygame/help/tutorial.xml:81(listitem)
 
151
msgid ""
 
152
"Whatever size you make the sprites, that's the size they will be in the game."
 
153
msgstr ""
 
154
 
 
155
#: data/templates/ubuntu-pygame/help/tutorial.xml:82(listitem)
 
156
msgid ""
 
157
"The game will look for sprites in the data/media folder, so make sure you "
 
158
"put them there."
 
159
msgstr ""
 
160
 
 
161
#: data/templates/ubuntu-pygame/help/tutorial.xml:76(para)
 
162
msgid ""
 
163
"The first think you probably noticed about the game is that the graphics are "
 
164
"so blah! Let's start by adding our own sprites. We;ll do a compbination of "
 
165
"replacing sprites with our own images, and also add a new sprite which we'll "
 
166
"use later. Here's a few things to keep in mind: <placeholder-1/>"
 
167
msgstr ""
 
168
 
 
169
#: data/templates/ubuntu-pygame/help/tutorial.xml:85(para)
 
170
msgid ""
 
171
"I made new images for the guy (the sprite the player controls), enemies, "
 
172
"bullets, and the game background. I also made a new sprite called "
 
173
"\"enemy_bullet.png\" which we'll add into the game later. <placeholder-1/> "
 
174
"Just drag your new sprite images into the shooter/data/media and tell it to "
 
175
"replace the images. Now when you run the game, you'll see your new sprites "
 
176
"at work. <placeholder-2/> Oops. As you can see, the background image I "
 
177
"created was for a game of different dimensions. It's for a game that's 400 "
 
178
"pixels wide by 500 pixels high. In the next section, we'll make the game "
 
179
"that size."
 
180
msgstr ""
 
181
 
 
182
#: data/templates/ubuntu-pygame/help/tutorial.xml:98(title)
 
183
msgid "Changing the Screen Dimensions"
 
184
msgstr ""
 
185
 
 
186
#: data/templates/ubuntu-pygame/help/tutorial.xml:99(para)
 
187
msgid ""
 
188
"The first change we'll make is to change the screen dimensions to be "
 
189
"oriented from top to bottom. We do this by changing a little code. So let's "
 
190
"fire up the code editor first. Run the edit command to fire up the editor."
 
191
msgstr ""
 
192
 
 
193
#: data/templates/ubuntu-pygame/help/tutorial.xml:102(programlisting)
 
194
#, no-wrap
 
195
msgid "$quickly edit"
 
196
msgstr ""
 
197
 
 
198
#: data/templates/ubuntu-pygame/help/tutorial.xml:104(programlisting)
 
199
#, no-wrap
 
200
msgid ""
 
201
"\n"
 
202
"#screen dimensions\n"
 
203
"screen_width = 400\n"
 
204
"screen_height = 500\n"
 
205
msgstr ""
 
206
 
 
207
#: data/templates/ubuntu-pygame/help/tutorial.xml:103(para)
 
208
msgid ""
 
209
"This command should open your code in Gedit. The screen dimensions are set "
 
210
"in the file \"shooterconfig.py\". So just go to that file and change the "
 
211
"width to 400 and the height to 500. <placeholder-1/> Save the file and run "
 
212
"the game again. Notice that the screen wrapping and centering and everything "
 
213
"was taken care of for you. That's because you made the change in the "
 
214
"shooterconfig.py file. This is the right place to add and change variables "
 
215
"that should be availble throughout the game. We'll be make a few more "
 
216
"changes here later."
 
217
msgstr ""
 
218
 
 
219
#: data/templates/ubuntu-pygame/help/tutorial.xml:114(title)
 
220
msgid "Programming the Guy"
 
221
msgstr ""
 
222
 
 
223
#: data/templates/ubuntu-pygame/help/tutorial.xml:115(para)
 
224
msgid ""
 
225
"For this game, what we want is the guy to move left and right across the "
 
226
"bottom and not wrap through the screen. Also, we want to make the bullets "
 
227
"look like they are coming out of the guy's front."
 
228
msgstr ""
 
229
 
 
230
#: data/templates/ubuntu-pygame/help/tutorial.xml:121(listitem)
 
231
msgid ""
 
232
"Place the guy at the beginning of each level at the middle and bottom of the "
 
233
"screen."
 
234
msgstr ""
 
235
 
 
236
#: data/templates/ubuntu-pygame/help/tutorial.xml:122(listitem)
 
237
msgid ""
 
238
"Add functions to guy.py for moving and stop movig right and left, and remove "
 
239
"the rotate functions."
 
240
msgstr ""
 
241
 
 
242
#: data/templates/ubuntu-pygame/help/tutorial.xml:123(listitem)
 
243
msgid ""
 
244
"Change the keyboard input in the bin/shooter file to call these new "
 
245
"functions."
 
246
msgstr ""
 
247
 
 
248
#: data/templates/ubuntu-pygame/help/tutorial.xml:118(para)
 
249
msgid "To make the guy move just left and right we need to: <placeholder-1/>"
 
250
msgstr ""
 
251
 
 
252
#: data/templates/ubuntu-pygame/help/tutorial.xml:128(programlisting)
 
253
#, no-wrap
 
254
msgid ""
 
255
"\n"
 
256
"     def init_position(self):\n"
 
257
"        \"\"\"init_position - resets the Guy's position near the\n"
 
258
"        bottom of the screen\n"
 
259
"        \n"
 
260
"        \"\"\"\n"
 
261
"        sw = shooterconfig.screen_width\n"
 
262
"        sh = shooterconfig.screen_height\n"
 
263
"\n"
 
264
"        self.x = sw/2\n"
 
265
"        self.y = sh - 80\n"
 
266
msgstr ""
 
267
 
 
268
#: data/templates/ubuntu-pygame/help/tutorial.xml:143(listitem)
 
269
msgid "start_moving_left: the user pressed the \"s\" key"
 
270
msgstr ""
 
271
 
 
272
#: data/templates/ubuntu-pygame/help/tutorial.xml:144(listitem)
 
273
msgid "stop_moving_left: the user released the \"s\" key"
 
274
msgstr ""
 
275
 
 
276
#: data/templates/ubuntu-pygame/help/tutorial.xml:145(listitem)
 
277
msgid "start_moving_right: the user pressed the \"f\" key"
 
278
msgstr ""
 
279
 
 
280
#: data/templates/ubuntu-pygame/help/tutorial.xml:146(listitem)
 
281
msgid "stop_moving_right: the user released the \"f\" key"
 
282
msgstr ""
 
283
 
 
284
#: data/templates/ubuntu-pygame/help/tutorial.xml:150(listitem)
 
285
msgid "Create two tracking variables, _moving_left and _moving_right"
 
286
msgstr ""
 
287
 
 
288
#: data/templates/ubuntu-pygame/help/tutorial.xml:151(listitem)
 
289
msgid ""
 
290
"Set these tracking variables to True or False in the "
 
291
"start/stop_moving_left/right functions"
 
292
msgstr ""
 
293
 
 
294
#: data/templates/ubuntu-pygame/help/tutorial.xml:152(listitem)
 
295
msgid ""
 
296
"In the guy's update function, change the x coordinates of the guy based on "
 
297
"these variables"
 
298
msgstr ""
 
299
 
 
300
#: data/templates/ubuntu-pygame/help/tutorial.xml:126(para)
 
301
msgid ""
 
302
"The functionaly that is specific to the player's sprite is in the guy.py "
 
303
"file. The first thing we will do is work on placing the guy properly. "
 
304
"Fortunately, the is an existing function that we can modify for this. The "
 
305
"function init_position is called to each time the guy needs to be placed on "
 
306
"the screen, like after he gets killed for instance . When created, the guy "
 
307
"calls the based class function center_on_screen. As you may guess, we will "
 
308
"want to change this function. so the guys is positionedhalfway down the "
 
309
"screen, and we want him to start a few pixels from the bottom. Fortunaately "
 
310
"we know how to get the screen dimensions, so it's easy make the change to "
 
311
"init_position. <placeholder-1/> Now when you run the game, the guy starts at "
 
312
"the bottom, which is what we want, but he also rotates when we use the s and "
 
313
"the d button, which we do not want. So let's change that next by "
 
314
"implementing four new functions: <placeholder-2/> Here's how we will "
 
315
"implement these functions: <placeholder-3/>"
 
316
msgstr ""
 
317
 
 
318
#: data/templates/ubuntu-pygame/help/tutorial.xml:158(programlisting)
 
319
#, no-wrap
 
320
msgid ""
 
321
"\n"
 
322
"        self._moving_left = False\n"
 
323
"        self._moving_right = False\n"
 
324
msgstr ""
 
325
 
 
326
#: data/templates/ubuntu-pygame/help/tutorial.xml:164(programlisting)
 
327
#, no-wrap
 
328
msgid ""
 
329
"\n"
 
330
"    def start_moving_right(self):\n"
 
331
"        self._moving_left = False\n"
 
332
"        self._moving_right = True\n"
 
333
"\n"
 
334
"    def start_moving_left(self):\n"
 
335
"        self._moving_left = True\n"
 
336
"        self._moving_right = False\n"
 
337
"\n"
 
338
"    def stop_moving_left(self):\n"
 
339
"        self._moving_left = False\n"
 
340
"\n"
 
341
"    def stop_moving_right(self):\n"
 
342
"        self._moving_right = False\n"
 
343
"\n"
 
344
msgstr ""
 
345
 
 
346
#: data/templates/ubuntu-pygame/help/tutorial.xml:156(para)
 
347
msgid ""
 
348
"First, add the tracking variables to the Guy.__init__function. Add these "
 
349
"after the call to BaseSprite.__init__(). <placeholder-1/> Now the functions "
 
350
"for responding to keys simply set those tracking variables as appropriate. "
 
351
"So we add these four new functions to guy.py. <placeholder-2/>"
 
352
msgstr ""
 
353
 
 
354
#: data/templates/ubuntu-pygame/help/tutorial.xml:181(para)
 
355
msgid ""
 
356
"Now we need change the guy's coordinates based on the tracking variable. "
 
357
"Every sprite has an update function. This function is called for every "
 
358
"\"tick\" in the game, and the sprite looks at it's internal data, and "
 
359
"updates itself appropriately. By default, the guy's rotation is handled by "
 
360
"BaseSprite, so we can ignore that, especially since we won't be using "
 
361
"rotation anyway. We're also not using acceleration for the guy, so we can "
 
362
"delete a bit of code. Funally, we don't want the guy to \"wrap\" though the "
 
363
"screen, so we whould catch that condition."
 
364
msgstr ""
 
365
 
 
366
#: data/templates/ubuntu-pygame/help/tutorial.xml:186(programlisting)
 
367
#, no-wrap
 
368
msgid ""
 
369
"\n"
 
370
"    def update(self):\n"
 
371
"        \"\"\"update - Update internal data for a game tick\"\"\" \n"
 
372
"    \n"
 
373
"        BaseSprite.update(self)\n"
 
374
"\n"
 
375
"        if self._moving_left:\n"
 
376
"            self.x -= 5\n"
 
377
"            if self.x &lt; 0:\n"
 
378
"                self.x = 0\n"
 
379
"        if self._moving_right:\n"
 
380
"            self.x += 5\n"
 
381
"            if self.x + self.rect.width &gt; shooterconfig.screen_width:\n"
 
382
"                self.x = shooterconfig.screen_width - self.rect.width\n"
 
383
msgstr ""
 
384
 
 
385
#: data/templates/ubuntu-pygame/help/tutorial.xml:184(para)
 
386
msgid ""
 
387
"Let's start with moving the guy 5 pixels per tick. So we can change the top "
 
388
"of the update function to look like this: <placeholder-1/>"
 
389
msgstr ""
 
390
 
 
391
#: data/templates/ubuntu-pygame/help/tutorial.xml:202(para)
 
392
msgid ""
 
393
"So the guy is ready. He starts in the right place, tracks whether he is "
 
394
"moving left or right, and updates his position as desired. Now we just need "
 
395
"to hook him up the keys."
 
396
msgstr ""
 
397
 
 
398
#: data/templates/ubuntu-pygame/help/tutorial.xml:205(para)
 
399
msgid ""
 
400
"Keyboard contol is handled in the shoort file in the bin directory. For each "
 
401
"click of the clock, the controller_tick function is called. Detecting "
 
402
"keyboard input and directing it as appropriate is handled in this funciton. "
 
403
"So what we wante to do is find where the f and s key events are handled, and "
 
404
"call the guy's start/stop_moving_left/right functions there."
 
405
msgstr ""
 
406
 
 
407
#: data/templates/ubuntu-pygame/help/tutorial.xml:211(listitem)
 
408
msgid "Call the start_moving functions instead of rotate functions."
 
409
msgstr ""
 
410
 
 
411
#: data/templates/ubuntu-pygame/help/tutorial.xml:212(listitem)
 
412
msgid "Remove the call to the accelerate function."
 
413
msgstr ""
 
414
 
 
415
#: data/templates/ubuntu-pygame/help/tutorial.xml:213(listitem)
 
416
msgid "Remve the call to the hyperspace function."
 
417
msgstr ""
 
418
 
 
419
#: data/templates/ubuntu-pygame/help/tutorial.xml:216(programlisting)
 
420
#, no-wrap
 
421
msgid ""
 
422
"\n"
 
423
"            #control the guy\n"
 
424
"            if not game.paused: \n"
 
425
"                if event.key == pygame.K_f:\n"
 
426
"                    g.start_moving_right()\n"
 
427
"                if event.key == pygame.K_s:\n"
 
428
"                    g.start_moving_left()\n"
 
429
"                if event.key == pygame.K_j:\n"
 
430
"                    g.shoot()\n"
 
431
"\n"
 
432
msgstr ""
 
433
 
 
434
#: data/templates/ubuntu-pygame/help/tutorial.xml:208(para)
 
435
msgid ""
 
436
"Key down events are handled first, in a section commented \"control\" the "
 
437
"guy. We want to make a few changes here. <placeholder-1/> These last two "
 
438
"functions aren't needed for our new game. So let's make the changes and this "
 
439
"part of the controller_tick function will change to this: <placeholder-2/>"
 
440
msgstr ""
 
441
 
 
442
#: data/templates/ubuntu-pygame/help/tutorial.xml:230(programlisting)
 
443
#, no-wrap
 
444
msgid ""
 
445
"\n"
 
446
"        #key up events, typically stop actions\n"
 
447
"        if event.type == pygame.KEYUP:\n"
 
448
"            if event.key == pygame.K_F11:\n"
 
449
"                pygame.display.toggle_fullscreen() \n"
 
450
"            if event.key == pygame.K_f:\n"
 
451
"                g.stop_moving_right()\n"
 
452
"            if event.key == pygame.K_s:\n"
 
453
"                g.stop_moving_left()\n"
 
454
"\n"
 
455
msgstr ""
 
456
 
 
457
#: data/templates/ubuntu-pygame/help/tutorial.xml:228(para)
 
458
msgid ""
 
459
"We'll handle the key up functions similarly. <placeholder-1/><placeholder-2/>"
 
460
msgstr ""
 
461
 
 
462
#: data/templates/ubuntu-pygame/help/tutorial.xml:248(listitem)
 
463
msgid ""
 
464
"The bullets accelerate and go way to fast, they'll miss enemies by skipping "
 
465
"over them."
 
466
msgstr ""
 
467
 
 
468
#: data/templates/ubuntu-pygame/help/tutorial.xml:249(listitem)
 
469
msgid ""
 
470
"The bullets should go to the top of the screen, and not stop before or wrap "
 
471
"around"
 
472
msgstr ""
 
473
 
 
474
#: data/templates/ubuntu-pygame/help/tutorial.xml:250(listitem)
 
475
msgid ""
 
476
"The bullets should appear to come out of the middle of the guy, instead of "
 
477
"the side."
 
478
msgstr ""
 
479
 
 
480
#: data/templates/ubuntu-pygame/help/tutorial.xml:253(programlisting)
 
481
#, no-wrap
 
482
msgid ""
 
483
"\n"
 
484
"        self.max_velocity = 20\n"
 
485
"        self.max_ticks = 20\n"
 
486
msgstr ""
 
487
 
 
488
#: data/templates/ubuntu-pygame/help/tutorial.xml:258(programlisting)
 
489
#, no-wrap
 
490
msgid ""
 
491
"\n"
 
492
"    def update(self):\n"
 
493
"        \"\"\"update - update internal data and position.\n"
 
494
"        Typically called by the game controller each game\n"
 
495
"        tick.\n"
 
496
"\n"
 
497
"        \"\"\"\n"
 
498
"\n"
 
499
"        BaseSprite.update(self)\n"
 
500
"\n"
 
501
"        if self.y &lt; 1:\n"
 
502
"            self.kill()\n"
 
503
"        if self.y == shooterconfig.screen_height:\n"
 
504
"            self.kill()\n"
 
505
msgstr ""
 
506
 
 
507
#: data/templates/ubuntu-pygame/help/tutorial.xml:282(programlisting)
 
508
#, no-wrap
 
509
msgid ""
 
510
"\n"
 
511
"    def shoot(self):\n"
 
512
"        \"\"\"shoot - fire a bullet. Adds the bullet to the bullet sprite "
 
513
"group.\n"
 
514
"        If the maximum number of bullets premitted would be exceeded, \n"
 
515
"        the bullet will not fire. If the guy is exploding, the guy will no\n"
 
516
"        fire.\n"
 
517
"\n"
 
518
"        \"\"\"\n"
 
519
"\n"
 
520
"        if self.alive:\n"
 
521
"            #only allow max numbe of  bullets on the screen at a time\n"
 
522
"            if len(self.bullets.sprites()) &lt; self.max_bullets:\n"
 
523
"                center_x = (self.x + self.rect.width / 2) - 3\n"
 
524
"                b = Bullet(center_x,self.y,self.orientation)\n"
 
525
"                self.bullets.add(b)\n"
 
526
msgstr ""
 
527
 
 
528
#: data/templates/ubuntu-pygame/help/tutorial.xml:245(para)
 
529
msgid ""
 
530
"Now we've got the guy working the way we want, but we need to make a few "
 
531
"changes to to how the guy's bullets are working: <placeholder-1/> We'll "
 
532
"handle the first problem my changing the Bullet class in the bullet.py file. "
 
533
"The acceleration and speed of bullets in the game is configured in the "
 
534
"__init__ function of this file. The rate at whcih a bullet accelerates is "
 
535
"controlled by member variable acceleration_divisor. We won't need to change "
 
536
"that. However, the maximum speed a bullet will reach is defined ny "
 
537
"max_velocity, and the lifetme of the bullet is defined by max_ticks. Let's "
 
538
"make the bullets go slower, but last longer, by changing max_velocity to 20, "
 
539
"and max_ticks to 20 in the Bullet __init__ funciton. <placeholder-2/> This "
 
540
"simple change is all that is necessary to control the bullets throughout the "
 
541
"game. Note that making this change in the Bullet class means all bullets in "
 
542
"the game, including enemy bullets, will now work this way. So let's quickly "
 
543
"deal with stopping bullets from wrapping as well. We'll add to the Bullet "
 
544
"class's update function to see if the bullet is above or below the screen, "
 
545
"and if so, we'll remove it. So we'll change the to of the update function in "
 
546
"bullet.py to look like this: <placeholder-3/> Note that a Sprite's kill "
 
547
"function, removes it from the game immediately, and with no fanfare. "
 
548
"Finally, we need to adjust the bullet so it comes out from the guys the way "
 
549
"we want it to. Since this is only related to the way the guy shoots bullets "
 
550
"and won't have anything to do with enemy bullets, we'll configure how "
 
551
"bullets emerge in the guy.py file. Let's just tweak the shoot function a "
 
552
"bit. As you can see in this function, when you create a bullet, you provide "
 
553
"it x and y coordinates. We'll just calculate at better x coordinate to "
 
554
"start. We'll find the middle of the width of the guy's image, and offset it "
 
555
"a bit so the bullet sprite looks like it comes out correctly. "
 
556
"<progamlisting> center_x = (self.x + self.rect.width / 2) - 3 "
 
557
"</progamlisting> So we change change the ugy's shoot funciton to look like "
 
558
"this: <placeholder-4/>"
 
559
msgstr ""
 
560
 
 
561
#: data/templates/ubuntu-pygame/help/tutorial.xml:299(para)
 
562
msgid ""
 
563
"<placeholder-1/> Now we have the guy working as desired. Moves back and "
 
564
"forth across the bottom and shoots bullets the way we want. Next we'll go on "
 
565
"to changing the way the enemies work."
 
566
msgstr ""
 
567
 
 
568
#: data/templates/ubuntu-pygame/help/tutorial.xml:308(title)
 
569
msgid "Programming Enemies"
 
570
msgstr ""
 
571
 
 
572
#: data/templates/ubuntu-pygame/help/tutorial.xml:309(para)
 
573
msgid ""
 
574
"The generated game always adds two enemies for each level, a homing missle "
 
575
"and a stock \"enemy\". The homing missle does pretty much what's it name "
 
576
"suggests, homes in on the guy and kills him. The Enemy doesn't do much of "
 
577
"anything. Just kind of plunks down and waits to get killed. First we're "
 
578
"going to remove the homing missle from the game, and then we'll customize "
 
579
"the enemies to be a bit more menancing."
 
580
msgstr ""
 
581
 
 
582
#: data/templates/ubuntu-pygame/help/tutorial.xml:314(programlisting)
 
583
#, no-wrap
 
584
msgid ""
 
585
"\n"
 
586
"    #TODO: set up enemies here\n"
 
587
"    #You can add more enemies or use different enemies\n"
 
588
"    #depening on the level\n"
 
589
"    for i in xrange(0,game.level + 3):\n"
 
590
"        enemies.add(Enemy())\n"
 
591
msgstr ""
 
592
 
 
593
#: data/templates/ubuntu-pygame/help/tutorial.xml:312(para)
 
594
msgid ""
 
595
"The bin/shooter fileset up a SpriteGroup already. It's called \"enemies\" "
 
596
"and gets populated each time a new level is created. New levels are created "
 
597
"in the next_level function in the bin/shooter file. The next_level function "
 
598
"is pretty simple, it increments the game level bu 1, removes any remaining "
 
599
"emenemities for the SpriteGroup and then repulates the enemies SpriteGroup. "
 
600
"Let's make a couple of basic chagnnges here. First, we'll change the xrange "
 
601
"so that it creates more enemies with each level, and second, we'll just "
 
602
"delete the line that creates the homing missle. Change the next_level "
 
603
"function to make the last few lines as below. <placeholder-1/> So for the "
 
604
"first level, there will by for enemies, and each time there is an new level "
 
605
"created the number of enemies will increase by 1. Aslo, no more homing "
 
606
"missles. <placeholder-2/>"
 
607
msgstr ""
 
608
 
 
609
#: data/templates/ubuntu-pygame/help/tutorial.xml:326(para)
 
610
msgid ""
 
611
"However, there are two things we need to do to enhance the game play with "
 
612
"our enemies. First, as you can see, they can start quite close to the guy, "
 
613
"even under. We'll need to fix that. Also, we should put them in motion so "
 
614
"they are a bit more of a challenge to shoot. We'll do both of the things by "
 
615
"modifying the Enemy class in the enemy.py file. Specifically in the "
 
616
"init_postion function."
 
617
msgstr ""
 
618
 
 
619
#: data/templates/ubuntu-pygame/help/tutorial.xml:329(para)
 
620
msgid ""
 
621
"If you open the enemy.py file and look for the init_position function, "
 
622
"you'll see there is a call to the function in __init__ but there is no "
 
623
"function for it. That's because enemy inherits from BaseSprite, which has a "
 
624
"default init_position implementation that randomly places it on the screen. "
 
625
"So we'll simply override the init_position function in the Enemy class in "
 
626
"enemy.py."
 
627
msgstr ""
 
628
 
 
629
#: data/templates/ubuntu-pygame/help/tutorial.xml:334(programlisting)
 
630
#, no-wrap
 
631
msgid ""
 
632
"\n"
 
633
"        sh = shooterconfig.screen_height\n"
 
634
"        sw = shooterconfig.screen_width\n"
 
635
msgstr ""
 
636
 
 
637
#: data/templates/ubuntu-pygame/help/tutorial.xml:339(programlisting)
 
638
#, no-wrap
 
639
msgid ""
 
640
"\n"
 
641
"import random\n"
 
642
msgstr ""
 
643
 
 
644
#: data/templates/ubuntu-pygame/help/tutorial.xml:343(programlisting)
 
645
#, no-wrap
 
646
msgid ""
 
647
"\n"
 
648
"        self.x = random.randint(20,sw - self.rect.width - 20)\n"
 
649
"        self.y = random.randint(20,sh/2)\n"
 
650
msgstr ""
 
651
 
 
652
#: data/templates/ubuntu-pygame/help/tutorial.xml:348(programlisting)
 
653
#, no-wrap
 
654
msgid ""
 
655
"\n"
 
656
"        self.velocity_x = random.randint(-30,30)\n"
 
657
msgstr ""
 
658
 
 
659
#: data/templates/ubuntu-pygame/help/tutorial.xml:352(programlisting)
 
660
#, no-wrap
 
661
msgid ""
 
662
"\n"
 
663
"    def init_position(self):\n"
 
664
"        sh = shooterconfig.screen_height\n"
 
665
"        sw = shooterconfig.screen_width\n"
 
666
"\n"
 
667
"        self.x = random.randint(20,sw - self.rect.width - 20)\n"
 
668
"        self.y = random.randint(20,sh/2)\n"
 
669
"        self.velocity_x = random.randint(-30,30)\n"
 
670
msgstr ""
 
671
 
 
672
#: data/templates/ubuntu-pygame/help/tutorial.xml:332(para)
 
673
msgid ""
 
674
"First, to make it a bitter easier to code, grab a reference to the screen "
 
675
"height and widgth that you configured and keep those in easier to use "
 
676
"variables. <placeholder-1/> Next, we want to choose random start position "
 
677
"along the X axis. But we don't want the enemy to start too close to either "
 
678
"side or it might get stuck in a spot where the guy can't shoot it. To "
 
679
"generate random integers, use the randome module, so you'll have to add an "
 
680
"import to the top of the file. <placeholder-2/> We can use the screenwidth "
 
681
"to and the enemies own width to determine the right most starting position. "
 
682
"For the Y axis, we want the enemies to be far enough away that they can't "
 
683
"too easily kill the guy. We'll also make sure they don't get out of reach of "
 
684
"the guy's bullets. So between 20 and half way down seems about right. "
 
685
"<placeholder-3/> Finally, let's put each enemy in motion by picking a random "
 
686
"velocity_x within some reasonable bounds. <placeholder-4/> Notice that one "
 
687
"in 60 of the enemies won't be moving. That's okay because we added padding "
 
688
"to keep the enemies from ending up too close to the sides. The full "
 
689
"init_position function you need to add looks like this: <placeholder-5/> "
 
690
"When you run the game, you can see that the enemies are moving and are good "
 
691
"targets to shoot at. But next we'll make the enemies fight back."
 
692
msgstr ""
 
693
 
 
694
#: data/templates/ubuntu-pygame/help/tutorial.xml:366(listitem)
 
695
msgid "Figure out where to place the bullet on the screen"
 
696
msgstr ""
 
697
 
 
698
#: data/templates/ubuntu-pygame/help/tutorial.xml:367(listitem)
 
699
msgid "Configure the bullet's velocity and maximum speed"
 
700
msgstr ""
 
701
 
 
702
#: data/templates/ubuntu-pygame/help/tutorial.xml:368(listitem)
 
703
msgid "Create the bullet object and add it to a SpriteGroup"
 
704
msgstr ""
 
705
 
 
706
#: data/templates/ubuntu-pygame/help/tutorial.xml:371(programlisting)
 
707
#, no-wrap
 
708
msgid ""
 
709
"\n"
 
710
"#create the player's guy and some enemies\n"
 
711
"bullets = pygame.sprite.RenderUpdates()\n"
 
712
"g = Guy(bullets)\n"
 
713
"enemies = pygame.sprite.RenderUpdates()\n"
 
714
"enemy_bullets = pygame.sprite.RenderUpdates()\n"
 
715
msgstr ""
 
716
 
 
717
#: data/templates/ubuntu-pygame/help/tutorial.xml:380(listitem)
 
718
msgid ""
 
719
"Clear out all the sprites in the group when creating a new level or "
 
720
"resetting a level after the guy dies."
 
721
msgstr ""
 
722
 
 
723
#: data/templates/ubuntu-pygame/help/tutorial.xml:381(listitem)
 
724
msgid ""
 
725
"Tell the bullets in the sprite group to update themselves at the right time."
 
726
msgstr ""
 
727
 
 
728
#: data/templates/ubuntu-pygame/help/tutorial.xml:382(listitem)
 
729
msgid "Tell the bullets to draw themselves at the right time."
 
730
msgstr ""
 
731
 
 
732
#: data/templates/ubuntu-pygame/help/tutorial.xml:383(listitem)
 
733
msgid ""
 
734
"Pass a reference to the sprite group to each enemy that is created, so it "
 
735
"can add it's bullets to the group."
 
736
msgstr ""
 
737
 
 
738
#: data/templates/ubuntu-pygame/help/tutorial.xml:386(programlisting)
 
739
#, no-wrap
 
740
msgid ""
 
741
"\n"
 
742
"    enemies.empty()\n"
 
743
msgstr ""
 
744
 
 
745
#: data/templates/ubuntu-pygame/help/tutorial.xml:390(programlisting)
 
746
#, no-wrap
 
747
msgid ""
 
748
"\n"
 
749
"def update_sprites():\n"
 
750
"    \"\"\"update_sprites - call update() for all sprites\"\"\"\n"
 
751
"    g.update()\n"
 
752
"    bullets.update()\n"
 
753
"    enemies.update() \n"
 
754
"    enemy_bullets.update()\n"
 
755
msgstr ""
 
756
 
 
757
#: data/templates/ubuntu-pygame/help/tutorial.xml:399(programlisting)
 
758
#, no-wrap
 
759
msgid ""
 
760
"\n"
 
761
"    #draw enemies\n"
 
762
"    enemies.draw(screen)\n"
 
763
"    enemy_bullets.draw(screen)\n"
 
764
msgstr ""
 
765
 
 
766
#: data/templates/ubuntu-pygame/help/tutorial.xml:405(programlisting)
 
767
#, no-wrap
 
768
msgid ""
 
769
"\n"
 
770
"    def __init__(self,enemy_bullets):\n"
 
771
"        \"\"\"Creates an Enemy \"\"\"\n"
 
772
"        self.enemy_bullets = enemy_bullets\n"
 
773
"\n"
 
774
msgstr ""
 
775
 
 
776
#: data/templates/ubuntu-pygame/help/tutorial.xml:412(programlisting)
 
777
#, no-wrap
 
778
msgid ""
 
779
"\n"
 
780
"        enemies.add(Enemy(enemy_bullets))\n"
 
781
msgstr ""
 
782
 
 
783
#: data/templates/ubuntu-pygame/help/tutorial.xml:416(programlisting)
 
784
#, no-wrap
 
785
msgid ""
 
786
"\n"
 
787
"from bullet import Bullet\n"
 
788
msgstr ""
 
789
 
 
790
#: data/templates/ubuntu-pygame/help/tutorial.xml:421(programlisting)
 
791
#, no-wrap
 
792
msgid ""
 
793
"\n"
 
794
"    def shoot(self):\n"
 
795
"        if self.alive:\n"
 
796
"            b = Bullet(self.x,self.y, 180)\n"
 
797
"            b.max_velocity = 6\n"
 
798
"            b.max_ticks = 50\n"
 
799
"            self.enemy_bullets.add(b)\n"
 
800
msgstr ""
 
801
 
 
802
#: data/templates/ubuntu-pygame/help/tutorial.xml:431(programlisting)
 
803
#, no-wrap
 
804
msgid ""
 
805
"\n"
 
806
"    if not game.paused:\n"
 
807
"        for e in enemies:\n"
 
808
"            if random.randint(0,20) == 1:\n"
 
809
"                e.shoot()\n"
 
810
msgstr ""
 
811
 
 
812
#: data/templates/ubuntu-pygame/help/tutorial.xml:441(programlisting)
 
813
#, no-wrap
 
814
msgid ""
 
815
"\n"
 
816
"enemy_bullet_image = image_path + \"enemy_bullet.png\"\n"
 
817
msgstr ""
 
818
 
 
819
#: data/templates/ubuntu-pygame/help/tutorial.xml:445(programlisting)
 
820
#, no-wrap
 
821
msgid ""
 
822
"\n"
 
823
"    def shoot(self):\n"
 
824
"        if self.alive:\n"
 
825
"            img = shooterconfig.enemy_bullet_image\n"
 
826
"            b = Bullet(self.x,self.y, 180, img)\n"
 
827
"            b.max_velocity = 6\n"
 
828
"            b.max_ticks = 50\n"
 
829
"            self.enemy_bullets.add(b)\n"
 
830
msgstr ""
 
831
 
 
832
#: data/templates/ubuntu-pygame/help/tutorial.xml:363(para)
 
833
msgid ""
 
834
"Let's add the ability for an enemy to drop a bomb. By default, enemies can't "
 
835
"do anything like that, so we'll have to add a new function. The function "
 
836
"will need to do the following things: <placeholder-1/> We should probably "
 
837
"start with this last part. We'll want to create a special sprite group for "
 
838
"the bullets to go into. This is primarily so that we can use the "
 
839
"SpriteGroups collision detection capabilities later. Also it's easier to "
 
840
"manage updates of sprites when they are in a group. First things first, "
 
841
"we'll create the sprite group. There's a place in the bin/shooter for "
 
842
"setting up enemies and such, so create another sprite group there. You "
 
843
"create a sprite group by calling a function in the pygame.sprite module "
 
844
"called \"RenderUpdates\". Lookk for the code block below, and notice the new "
 
845
"line creating the new sprite group by calling RenderUpdates. <placeholder-"
 
846
"2/> Now that we have the sprite group called enemy_bullets we want to do "
 
847
"three more things with it for now. <placeholder-3/> So for the first part, "
 
848
"we'll call the sprite group's empty function in next_level and reset_level "
 
849
"This function simply removes each sprite in the sprite group from game play. "
 
850
"Do this as the first thing for each of these function. <placeholder-4/> For "
 
851
"the second point, we'll add to the function in bin/shooter called "
 
852
"update_sprites. As you may have guessed, this function is called each tick "
 
853
"and tells each sprite to update. For sprites in a sprite group, this is "
 
854
"easy, because the SpriteGroup class includes an update function that calls "
 
855
"update for each of it's sprites. So just add that to the end of the "
 
856
"update_sprites function in bin/shooter, so it looks like the listing here: "
 
857
"<placeholder-5/> The view_tick function is called once per tick as well. "
 
858
"This funciton updates the view on the screen. We'll add a line of code to "
 
859
"tell the bullets to draw themselves right under where the enemies draw "
 
860
"themselves. <placeholder-6/> Finally, we need to pass a reference to each "
 
861
"enemy as it is created and create a member variable to store that reference. "
 
862
"So we need to make a change in the enemy.py fil, to add an argument for the "
 
863
"SpriteGroup in the __init__ function, and also we need to pass the "
 
864
"SpriteGroup when creating enemies. So change the Enemy class in enemy.py so "
 
865
"the top of the __init__ function looks like so: <placeholder-7/> And then "
 
866
"back in the bin/shooter file in the next_level function when creating "
 
867
"enemies, pass in enemy_bullets. <placeholder-8/> Now we have a functioning "
 
868
"sprite group and the enemies have a reference to it, we are ready to start "
 
869
"actually adding some bullets to it. We'll do this by adding a member "
 
870
"function called \"shoot\" to the enemy. Don't forget to import the Bullet "
 
871
"class into the enemy.py file. <placeholder-9/> First thing is we'll check "
 
872
"that the enemy is alive. We don't have to do this, but for this game, we "
 
873
"don't want it to shoot if it's int the process of exploding. Then we'll just "
 
874
"create a bullet and add it to the SpriteGroup. The last argument we'll pass "
 
875
"in is to set the orientatin to 180. Orientation goes clockwise for 360 "
 
876
"degrees, with zero being directly up, and 180 being directly down. In code, "
 
877
"it looks like the listing below. <placeholder-10/> So now we just need to "
 
878
"tell the enemies to shoot. We'll do this back in the bin/shooter file, in "
 
879
"the\"controller_tick function. After the section where we respond to "
 
880
"keyboard input, we'll add a few lines to make the enemies shoot. First, "
 
881
"we'll make sure the game is not paused, not very fair to shoot in a paused "
 
882
"game, is it? Next we'll loop through the enemies and desider if we should "
 
883
"call shoot. using our friend random.randint, we'll do this say, one time "
 
884
"twenty. So if you add this code to the end of the controller_tick function, "
 
885
"your enemies will start dropping bombs. <placeholder-11/><placeholder-12/> "
 
886
"So if you run the game, you'll see that the enemies are dropping bulltes "
 
887
"like bombs. Nice. However, maybe it would be nicer if the sprites for the "
 
888
"enemy bullets were different than the sprites for the guy's bullets. "
 
889
"Remember at the beginning of the tutorial we added an image called "
 
890
"enemy_bullet.png to the data/media directory. Now we'll write a bit of code "
 
891
"to use that image. First thing, we should add a reference to it in the "
 
892
"shooterconfig.py file. In this way, the Enemy class will be able to find it. "
 
893
"Just add the following line along with the other image path setting code in "
 
894
"shooterconfig.py. <placeholder-13/> So now we need to tell the bullets in "
 
895
"the Enemy class to use that image. Fortunately the Bullet class takes an "
 
896
"optional parameter for the name of an image to use. So just modify the shoot "
 
897
"function in the Enemy class to include the path. <placeholder-14/> Now the "
 
898
"enemies are dropping bombs with our new image. <placeholder-15/>"
 
899
msgstr ""
 
900
 
 
901
#: data/templates/ubuntu-pygame/help/tutorial.xml:459(para)
 
902
msgid ""
 
903
"But of course, you many notice the bombs aren't too menancing. In the next "
 
904
"chapter we'll add collision detection to make the bombs kill the guy."
 
905
msgstr ""
 
906
 
 
907
#: data/templates/ubuntu-pygame/help/tutorial.xml:464(title)
 
908
msgid "Collision Detection"
 
909
msgstr ""
 
910
 
 
911
#: data/templates/ubuntu-pygame/help/tutorial.xml:465(para)
 
912
msgid ""
 
913
"Collision detection is when you check for sprites that are overlapping, and "
 
914
"run code based on what happened. PyGame makes this very easy by providing "
 
915
"some functions to check for overlapping sprites for you. As you will see, it "
 
916
"works for individual sprites as well as sprite groups."
 
917
msgstr ""
 
918
 
 
919
#: data/templates/ubuntu-pygame/help/tutorial.xml:470(programlisting)
 
920
#, no-wrap
 
921
msgid ""
 
922
"\n"
 
923
"        b = pygame.sprite.spritecollideany(g, enemy_bullets)\n"
 
924
"        if b != None:\n"
 
925
"            g.explode()\n"
 
926
"            b.kill()\n"
 
927
msgstr ""
 
928
 
 
929
#: data/templates/ubuntu-pygame/help/tutorial.xml:481(programlisting)
 
930
#, no-wrap
 
931
msgid ""
 
932
"\n"
 
933
"    hits_dict = pygame.sprite.groupcollide(bullets, enemy_bullets, True, "
 
934
"False)\n"
 
935
msgstr ""
 
936
 
 
937
#: data/templates/ubuntu-pygame/help/tutorial.xml:468(para)
 
938
msgid ""
 
939
"Ok, so let's start by making the bombs that the enemies drop actually kill "
 
940
"the guy. To do this, we want to check if the bombs ever collide with the "
 
941
"guy, and if they do, we'll tell the guy to explode, and then we'll remove "
 
942
"the bomb from the screen. So the logic is \"tell me if the guy collides with "
 
943
"any enemy_bullets\". There is a funciton for this called, "
 
944
"pygame.sprite.spritecollideany, which takes a single sprite and a sprite "
 
945
"group and returns a reference to any sprite in the sprite group that "
 
946
"collided with the single sprite. If there were no collisions, than e will be "
 
947
"None. Otherwise, we'll want to tell the guy to explode and tell the bullet "
 
948
"to just \"kill\", which will remove it from play. So we can call it like "
 
949
"this: <placeholder-1/> There is a function in bin/shooter called "
 
950
"check_collisions which is called once per tick, and is the perfect place to "
 
951
"add this code. Add it right under the similar test for the guy colliding "
 
952
"with enemies. Now those bombs can kill the guys. <placeholder-2/> If you "
 
953
"play for a bit, you may notice that the bullets and the bombs just kind of "
 
954
"pass by each other. We can ramp up the game play by making the enemy bullets "
 
955
"destroy the guy's bullets, but not visa versa. So that logic here is, have "
 
956
"any of the sprites in the bullets sprite group collided with the bullets in "
 
957
"the enemy bullets sprite group. There is function for this as well, "
 
958
"pygame.sprite.groupcollide. groupcollide takes two sprite lists and returns "
 
959
"a dictionary. The keys in the dictionary are any sprites from the first "
 
960
"group that are involved in a collision, and the values are the sprites from "
 
961
"the second group that collided with the sprite that for key. It's a bit hard "
 
962
"to explain, but I bet the code is pretty readable. Add this line to the "
 
963
"check_collisions function. <placeholder-3/> Now if you run the game, it's a "
 
964
"bit more challenging as the enemies are a bit more offensive. This code just "
 
965
"kills the bullets involed in any collisions. Notice that I passed in True "
 
966
"False at the end of this function. These paramaters determine whether to "
 
967
"kill sprites form either group involved in the collusion. The True tells the "
 
968
"function to kill any bullets involved in collisions, so this was simple to "
 
969
"code."
 
970
msgstr ""
 
971
 
 
972
#: data/templates/ubuntu-pygame/help/tutorial.xml:488(title)
 
973
msgid "Playing Sounds"
 
974
msgstr ""
 
975
 
 
976
#: data/templates/ubuntu-pygame/help/tutorial.xml:491(programlisting)
 
977
#, no-wrap
 
978
msgid ""
 
979
"\n"
 
980
"tink_sound = sound_path + \"tink.wav\" \n"
 
981
" "
 
982
msgstr ""
 
983
 
 
984
#: data/templates/ubuntu-pygame/help/tutorial.xml:495(programlisting)
 
985
#, no-wrap
 
986
msgid ""
 
987
"\n"
 
988
"#set up some objects and models\n"
 
989
"tink_sound = pygame.mixer.Sound(shooter.shooterconfig.tink_sound) \n"
 
990
" "
 
991
msgstr ""
 
992
 
 
993
#: data/templates/ubuntu-pygame/help/tutorial.xml:500(programlisting)
 
994
#, no-wrap
 
995
msgid ""
 
996
"\n"
 
997
"    hits_dict = pygame.sprite.groupcollide(bullets, enemy_bullets, True, "
 
998
"False)\n"
 
999
"    if len(hits_dict) &gt; 0:\n"
 
1000
"        tink_sound.play() \n"
 
1001
" "
 
1002
msgstr ""
 
1003
 
 
1004
#: data/templates/ubuntu-pygame/help/tutorial.xml:506(programlisting)
 
1005
#, no-wrap
 
1006
msgid ""
 
1007
"\n"
 
1008
"        self.launch_sound = "
 
1009
"pygame.mixer.Sound(shooterconfig.guy_shoot_sound)\n"
 
1010
"        self.launch_sound.set_volume(.2)\n"
 
1011
"        self.launch_sound.play() \n"
 
1012
" "
 
1013
msgstr ""
 
1014
 
 
1015
#: data/templates/ubuntu-pygame/help/tutorial.xml:489(para)
 
1016
msgid ""
 
1017
"The game is pretty much done in terms of game play, but I want to make one "
 
1018
"small enhancement. When the enemy bullets kill one of the guy's bullets, I'd "
 
1019
"like to play a little sound to signify this. So first, I added a little "
 
1020
"\"tink\" sound to the data/media directory. After you add your sound, you "
 
1021
"need to add a reference to it in the shootercongif.py file. <placeholder-1/> "
 
1022
"Now, I want to add a little code after the collision detection between the "
 
1023
"bullets to play that sound if they collided. I can't just hop straight to "
 
1024
"that though, first I have to create a sound object.In pygame you manage "
 
1025
"sounds with the \"mixer\" module. I don't want to create this object over "
 
1026
"and over again. So I'll add it to the bin/shooter file where the other "
 
1027
"objects and such for the game are set up. <placeholder-2/> Now that I've "
 
1028
"told the mixer module to give me a sound, I can go ahead and check if there "
 
1029
"were any collisions between bullets, and play my sound. <placeholder-3/> So "
 
1030
"it seems to be working well, but what if you are finding that one of the "
 
1031
"sounds is too quiet or too loud? Or perhpas you want a certain sound to be "
 
1032
"loud sometimes and queit other times, for example to simulate distance. This "
 
1033
"is easy to do because each sound object has a set_volume function that you "
 
1034
"can use to set the sound between 0 (for slient) and 1 (for normal volume). "
 
1035
"The bullet launch sound I used was a bit loud, so in the bullet.py file, "
 
1036
"I'll adjust the Bullet class to play the sound a bit more quietly. "
 
1037
"<placeholder-4/>"
 
1038
msgstr ""
 
1039
 
 
1040
#: data/templates/ubuntu-pygame/help/tutorial.xml:514(title)
 
1041
msgid "Conclusion"
 
1042
msgstr ""
 
1043
 
 
1044
#: data/templates/ubuntu-pygame/help/tutorial.xml:518(listitem)
 
1045
msgid "Creating a game using $quickly create ubuntu-pygame"
 
1046
msgstr ""
 
1047
 
 
1048
#: data/templates/ubuntu-pygame/help/tutorial.xml:519(listitem)
 
1049
msgid "Adding your own sprites to the game"
 
1050
msgstr ""
 
1051
 
 
1052
#: data/templates/ubuntu-pygame/help/tutorial.xml:520(listitem)
 
1053
msgid "Setting the screen size and other info in the config file"
 
1054
msgstr ""
 
1055
 
 
1056
#: data/templates/ubuntu-pygame/help/tutorial.xml:521(listitem)
 
1057
msgid "Programming a player's guy to respond to keyboard input and to shoot"
 
1058
msgstr ""
 
1059
 
 
1060
#: data/templates/ubuntu-pygame/help/tutorial.xml:522(listitem)
 
1061
msgid "Programming enemies to move and shoot"
 
1062
msgstr ""
 
1063
 
 
1064
#: data/templates/ubuntu-pygame/help/tutorial.xml:523(listitem)
 
1065
msgid "Using collision detection to blow up Sprites"
 
1066
msgstr ""
 
1067
 
 
1068
#: data/templates/ubuntu-pygame/help/tutorial.xml:524(listitem)
 
1069
msgid "Playing and adjusting sounds"
 
1070
msgstr ""
 
1071
 
 
1072
#: data/templates/ubuntu-pygame/help/tutorial.xml:528(listitem)
 
1073
msgid ""
 
1074
"The bullets that the guy shoots and the bombs that the enemies drop make the "
 
1075
"same sound, it would probably be nicer if they each made a different sounds."
 
1076
msgstr ""
 
1077
 
 
1078
#: data/templates/ubuntu-pygame/help/tutorial.xml:529(listitem)
 
1079
msgid ""
 
1080
"The default explosions are crayon drawings, they don't fit in much with the "
 
1081
"look of the game. Perhaps some new images for the explosion stages would be "
 
1082
"good."
 
1083
msgstr ""
 
1084
 
 
1085
#: data/templates/ubuntu-pygame/help/tutorial.xml:530(listitem)
 
1086
msgid ""
 
1087
"There are no power ups! You could create power up classes the derive from "
 
1088
"BaseSprite to give the guy extra powers, like bigger bullets, more bullets, "
 
1089
"or extra lives."
 
1090
msgstr ""
 
1091
 
 
1092
#: data/templates/ubuntu-pygame/help/tutorial.xml:531(listitem)
 
1093
msgid ""
 
1094
"More special enemies, for example you could use the HomingMissle class to "
 
1095
"create harder to kill enemies."
 
1096
msgstr ""
 
1097
 
 
1098
#: data/templates/ubuntu-pygame/help/tutorial.xml:532(listitem)
 
1099
msgid ""
 
1100
"The high score list is stored in desktopcouch, so it will sync with your "
 
1101
"other computers. But it will have to be adjusted to the size we set for the "
 
1102
"window, and perhaps you can also let the player choose the name that's "
 
1103
"stored."
 
1104
msgstr ""
 
1105
 
 
1106
#: data/templates/ubuntu-pygame/help/tutorial.xml:515(para)
 
1107
msgid ""
 
1108
"So now you have a working game! This tutorial introduced the following key "
 
1109
"concepts for using the Quickly PyGame Template. <placeholder-1/> But there "
 
1110
"is still a lot to do to have a propper game. For example: <placeholder-2/>"
 
1111
msgstr ""
 
1112
 
 
1113
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2
 
1114
#: data/templates/ubuntu-pygame/help/tutorial.xml:0(None)
 
1115
msgid "translator-credits"
 
1116
msgstr ""
 
1117
"Launchpad Contributions:\n"
 
1118
"  Daniel Dietrich https://launchpad.net/~shaddowy2"