|
9.
|
|
|
Use <application>The Quickly Pygame Template</application> to write old school arcade games for running on Ubuntu. PyGame is a framework that handles sprites, collisons, sounds, and everything you need to make a game. You just need to add the game play. The Quickly template creates a starter game for you and comes ready for you to turn into your fun game, and then easily package and share it with other Ubuntu users.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:32(para)
|
|
16.
|
|
|
This will create a shooter sub directory containing a complete directory tree and files for an empty python application. The command finishes by running the newly created game. The game is played by using the "s" and "f" keys to rotate the guy, the "j" key to shoot, and the "l" key to thrust.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:60(para)
|
|
17.
|
|
|
You can play the newly created game. Notice that the <application>Quickly PyGame Template</application> inferred that the game title is "Shooter". Also note that there is a guy that you can control with the s,f,j, and l keys. There is an enemy and a homing missle. You also get a "Game Over" screen, scoring, and levels build in for free.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:63(para)
|
|
25.
|
|
|
The first think you probably noticed about the game is that the graphics are so blah! Let's start by adding our own sprites. We;ll do a compbination of replacing sprites with our own images, and also add a new sprite which we'll use later. Here's a few things to keep in mind: <placeholder-1/>
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:76(para)
|
|
26.
|
|
|
I made new images for the guy (the sprite the player controls), enemies, bullets, and the game background. I also made a new sprite called "enemy_bullet.png" which we'll add into the game later. <placeholder-1/> Just drag your new sprite images into the shooter/data/media and tell it to replace the images. Now when you run the game, you'll see your new sprites at work. <placeholder-2/> Oops. As you can see, the background image I created was for a game of different dimensions. It's for a game that's 400 pixels wide by 500 pixels high. In the next section, we'll make the game that size.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:85(para)
|
|
31.
|
|
|
This command should open your code in Gedit. The screen dimensions are set in the file "shooterconfig.py". So just go to that file and change the width to 400 and the height to 500. <placeholder-1/> Save the file and run the game again. Notice that the screen wrapping and centering and everything was taken care of for you. That's because you made the change in the shooterconfig.py file. This is the right place to add and change variables that should be availble throughout the game. We'll be make a few more changes here later.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:103(para)
|
|
36.
|
|
|
Change the keyboard input in the bin/shooter file to call these new functions.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:123(listitem)
|
|
38.
|
|
|
def init_position(self):
"""init_position - resets the Guy's position near the
bottom of the screen
"""
sw = shooterconfig.screen_width
sh = shooterconfig.screen_height
self.x = sw/2
self.y = sh - 80
|
|
|
represents a line break.
Start a new line in the equivalent position in the translation.
|
|
|
represents a space character.
Enter a space in the equivalent position in the translation.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:128(programlisting)
|
|
39.
|
|
|
start_moving_left: the user pressed the "s" key
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:143(listitem)
|
|
40.
|
|
|
stop_moving_left: the user released the "s" key
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-pygame/help/tutorial.xml:144(listitem)
|