FamilyGuys2
Warning: Failed opening 'includes/python/skillz.php3' for inclusion (include_path='.:/py/week') in
/concord/california/public_html/location.php3 on line 42
Awards
Scores
Ratings (show detail)
Overall: 2.5
Fun: 2.9
Production: 2.8
Innovation: 1.6
Respondents: 42
Files
File | Uploader | Date |
---|---|---|
hellacopy-1.2.zip
— final
hellacopy final |
jjinux | 2007/09/10 16:58 |
screenshot.png
screenshot |
jjinux | 2007/09/08 20:39 |
hellacopy-1.1.zip
— final
PyWeek 4 Submission |
jjinux | 2007/09/08 20:33 |
hellacopy-1.0.zip
— final
PyWeek 4 Submission |
cfadam | 2007/09/08 15:17 |
Diary Entries
Python: Useful Utility for PGU's leveledit
I'm using PGU. If you're not using PGU, you can skip this post.
If you're like me, you sometimes get confused about when you're editing the tiles and when you're editing the background. My buddy drew an entire level, and the tiles and background were totally messed up. Rather than redo the entire level, I wrote a little utility to force all the tiles into the background. It's quick-and-dirty, but quite useful when you need it:
#!/usr/bin/env python # # Copyright 2007 Adam Ulvi, Shannon Behrens # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Take a TGA file, and force any tiles onto the background. This is to make up for UI interface "difficulties" in PGU's leveledit. """ import os import sys import pygame __docformat__ = "restructuredtext" try: if (not len(sys.argv) == 3 or not os.path.isfile(sys.argv[1])): raise ValueError except: # Catch all exceptions, not just ValueErrors. print >> sys.stderr, "usage: force_background.py INPUT.tga OUTPUT.tga" sys.exit(2) in_f, out_f = sys.argv[1], sys.argv[2] in_img = pygame.image.load(in_f) out_img = in_img.copy() w, h = in_img.get_width(), in_img.get_height() for y in range(h): for x in range(w): (tile, bg, code, alpha) = in_img.get_at((x, y)) if tile: bg, tile = tile, 0 out_img.set_at((x, y), (tile, bg, code, alpha)) pygame.image.save(out_img, out_f)