1 """<title>tutorial on how to load tiles and levels</title>
3 <p>The following tutorial demonstrates how to use tileedit and leveledit via the
4 command line. You can just as easily do all these things via the in-program
5 "File/Open" and "File/New" menu items.
7 <p>Here's an introduction to using tileedit and leveledit
8 <pre>$ -- linux, etc instructions
9 C:\> -- windows instructions</pre>
11 <p>first you need to be in the examples dir for this tutorial to
17 $ tileedit tiles.tga 16 16
18 C:\pgu\examples> python ../scripts/tileedit tiles.tga 16 16</pre>
20 <p>the next time you run tileedit, you will not need to provide
21 the width and height of the tiles
23 <pre>$ tileedit codes.tga 16 16
24 C:\pgu\examples> python ../scripts/tileedit codes.tga 16 16</pre>
26 <p>the next time you run tileedit, you will not need to provide
27 the width and height of the codes
29 <pre>$ leveledit level.tga tiles.tga codes.tga 16 16
30 C:\pgu\examples> python ../scripts/leveledit level.tga tiles.tga codes.tga 16 16</pre>
32 <p>the next time you run leveledit, you will not need to provide
33 the tiles, codes, and width and height of the tiles
41 from pygame.locals import *
43 # the following line is not needed if pgu is installed
44 import sys; sys.path.insert(0, "..")
46 from pgu import tilevid
51 ##This is the initialization function I created for
54 ##I use the tga_ methods to load up the tiles and level I created.
59 g.screen = pygame.display.set_mode((SW,SH),SWSURFACE)
61 g.tga_load_tiles('tiles.tga',(TW,TH))
62 g.tga_load_level('level.tga')
67 ##This is the run function I created for the game. In this example,
68 ##the level is displayed, but there is no interaction (other than allowing the
69 ##user to quit via ESC or the QUIT signal.
78 for e in pygame.event.get():
79 if e.type is QUIT: g.quit = 1
80 if e.type is KEYDOWN and e.key == K_ESCAPE: g.quit = 1
83 updates = g.update(g.screen)
84 pygame.display.update(updates)