Interesting...
Does your pyplace support tiles like 32x32 and
64x64 and so? I am planning to use a pure 2d (not isometric in the beggining)
environment...
Panos
----- Original Message -----
Sent: Friday, September 07, 2001 3:28
PM
Subject: Re: [pygame] Let's begin some
questions...
This worked for me, to create array containing images and
shrink it import Numeric as N import pygame.surfarray as surfarray
def load(name, path=None): "load an image, halve if it
small tiles tune flags for display mode" img =
load_raw(IMGPREFIX + name, path) if SHRINKIMAGES:
img = halve_image(img) if
not img.get_flags() & HWSURFACE:
transparentcolourkey = 255,0,0
img.set_colorkey(transparentcolourkey, RLEACCEL) return
img.convert() def halve_image(img): "halve an image in
both dimensions, force transparent colour to RED"
imgarray=surfarray.array3d(img) (src_maxx,src_maxy) =
img.get_size() # All images must have even width and height
values smallpic =
pygame.Surface((src_maxx>>1,src_maxy>>1))
surfarray.blit_array(smallpic,imgarray[::2,::2]) if not
smallpic.get_flags() & HWSURFACE:
transparentcolourkey = 255,0,0
smallpic.set_colorkey(transparentcolourkey, RLEACCEL) return
smallpic
This is from pyplace/gfx.py
If you get the pyplace code from pyplace.sourceforge.net then you have tile
blitting and image halving and things, you'd want version alpha 0f which
I'll upload (tar and cvs tag) in about 5 minutes.
Panagiotis Halatsakos wrote:
Ok Well since I am new with all the
pygame/python... How do
arrays work there? I want to translate my (formerly) directx tilemap reader
to python for the project... Is there a specific package I need to use to do arrays? I mean the
only data that I found are tuples and ordinary data
types.... Thanks in
advance...
|