[pygame] Pygame to Mac App Store (in progress)

2011-10-07 Thread Keith Nemitz

Been meaning to post this for a while, but kept getting distracted. Here is the 
script we use to create a build of The Witch's Yarn for the Mac App Store. 
Note: I have yet to successfully post the game to the story, because I screwed 
up the original certs. Then the whole Lion disappointment popped up, and now 
I'm just waiting for the SDL fix. Then I try another crack at it. Until then 
here's what been working for us to make the bundle:



# Python script for building AppStore-friendly app bundle

import sys
import os
import subprocess

# build parameters
python = '/Library/Frameworks/Python.framework/Versions/2.5/bin/python'
codesign_cmd = '/usr/bin/codesign'
productbuild_cmd = '/usr/bin/productbuild'
projectname = The Witch's Yarn
appname = projectname+.app
pkgname = projectname+.pkg
app_signing_identity = 3rd Party Mac Developer Application: Mousechief
pkg_signing_identity = 3rd Party Mac Developer Installer: Mousechief

def bundlebuild(project_path):
print Building +projectname+ application bundle...
args = [python,'Setup.py','py2app']
os.chdir(project_path)
p = subprocess.call(args)
return p

def codesign(bundle_path):
print Codesigning +projectname+ application bundle...
args = [codesign_cmd, '-s', app_signing_identity, bundle_path]
p = subprocess.call(args)
return p

def productbuild(bundle_path):
print Building +projectname+ installer package...
installdir = '/Applications'
args = [productbuild_cmd, '--component', bundle_path, installdir, '--sign', 
pkg_signing_identity, pkgname]
p = subprocess.call(args)
return p

def main():
root_path = os.path.split(os.path.abspath(sys.argv[0]))[0]
project_path = os.path.join(root_path,project)
bundlebuild(project_path)
bundle_path = os.path.join(project_path,dist/+projectname+.app)
codesign(bundle_path)
#productbuild(bundle_path)

main()




[pygame] Possible to detect collision with an image?

2011-10-07 Thread Alec Bennett
I'm using an image with transparency as a Sprite. The image has an irregular
shape:

http://sinkingsensation.com/stuff/shape.png

I'd like to detect collisions with it.

My current strategy is to draw a polygon (pygame.draw.polygon) behind the
image. That works, but its difficult to make the polygon accurately reflect
the image, and I need to make a lot of them.

So I'm wondering if there's some way to detect collisions with the image
itself?

Or maybe there's some clever way to draw a polygon based on an image?

I don't need pixel-by-pixel accuracy, anything close would work.


Re: [pygame] Possible to detect collision with an image?

2011-10-07 Thread Florian Krause
Well, you could make the background of the image transparent and then
create a mask fro the pygame surface. This one can be checked for
collisions.

Florian



On Fri, Oct 7, 2011 at 11:44 PM, Alec Bennett wrybr...@gmail.com wrote:
 I'm using an image with transparency as a Sprite. The image has an irregular
 shape:

 http://sinkingsensation.com/stuff/shape.png

 I'd like to detect collisions with it.

 My current strategy is to draw a polygon (pygame.draw.polygon) behind the
 image. That works, but its difficult to make the polygon accurately reflect
 the image, and I need to make a lot of them.

 So I'm wondering if there's some way to detect collisions with the image
 itself?

 Or maybe there's some clever way to draw a polygon based on an image?

 I don't need pixel-by-pixel accuracy, anything close would work.







-- 
www.fladd.de - fladd.de: Homepage of Florian Krause
blog.fladd.de - fladd's Blog: Blog of Florian Krause
intermezzo.fladd.de - Intermezzo: Music by Florian Krause and Giacomo Novembre