RE: [pygame] Alpha channels and per pixel alpha

2009-06-11 Thread Bjorn Samuelsson

Here's the image and code:

 

def load_alpha_image(name):
fullname = os.path.join('Images', name)
try:
image = pygame.image.load(fullname).convert_alpha()
except pygame.error, message:
print 'Cannot load image:', fullname
raise SystemExit, message
return image


 


Date: Wed, 10 Jun 2009 15:56:10 -0700
Subject: Re: [pygame] Alpha channels and per pixel alpha
From: br...@hamsterrepublic.com
To: pygame-users@seul.org

It would help to see your code and have an example image attached, cause 
loading .png's with alpha and blitting with transparency works fine for me 
without any trouble or special stuff.


On Wed, Jun 10, 2009 at 2:11 PM, Bjorn Samuelsson bjorn_...@hotmail.com wrote:


Hey all,
 
I'm trying to make a small 2d game and I'm wondering how you would go about to 
load a png-image with an alpha channel and keep it's alpha values?
I have confirmed the images alpha channel but when i load it in pygame it's 
alpha values are always 255.
I've tried Surface.convert_alpha but that doesn't make a difference.
At the moment I've resorted to saving my alpha channels separate and loading 
both image and alpha channel so that i can call Surface.set_at to change the 
image's per pixel alpha value.
But that solution seems less than optimal so i figured i would ask you guys.
 
regards
Björn
 
ps. I apologize if this topic has been discussed at length already but i've 
been looking around and i just can't seem to find a simple solution. ds.



Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy! Try it!

_
Windows Live™: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009attachment: default_alpha2.png

[pygame] Alpha channels and per pixel alpha

2009-06-10 Thread Bjorn Samuelsson

Hey all,

 

I'm trying to make a small 2d game and I'm wondering how you would go about to 
load a png-image with an alpha channel and keep it's alpha values?

I have confirmed the images alpha channel but when i load it in pygame it's 
alpha values are always 255.

I've tried Surface.convert_alpha but that doesn't make a difference.

At the moment I've resorted to saving my alpha channels separate and loading 
both image and alpha channel so that i can call Surface.set_at to change the 
image's per pixel alpha value.

But that solution seems less than optimal so i figured i would ask you guys.

 

regards

Björn

 

ps. I apologize if this topic has been discussed at length already but i've 
been looking around and i just can't seem to find a simple solution. ds.

_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us

RE: [pygame] Alpha channels and per pixel alpha

2009-06-10 Thread Bjorn Samuelsson

Ok.

Could you possibly give me some short instructions on how to make a simple 
image with alpha channel so maybe I can see what I'm doing wrong.

This is how i do it: take a regular image in photoshop, add an alpha channel, 
save as a SuperPNG with the alpha channels box checked.

I'm not really sure how to check if I have a working alpha channel or not. 
But when i reopen the image in photoshop the alpha channel is still there. I 
also tried a small application that gives out information about a given 
png-file and it said that the image is 32-bit RGB+alpha, non-interlaced.
 


From: geometr...@gmail.com
Date: Wed, 10 Jun 2009 14:48:58 -0700
Subject: Re: [pygame] Alpha channels and per pixel alpha
To: pygame-users@seul.org

The way to do it is with .convert_alpha()
Check that your images really do have an alpha channel.

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

[pygame] draw transparent representation of field of view

2008-07-21 Thread Bjorn Samuelsson

I want to represent field of view for non-moving characters in my turn-based 
game.
The problem is that I want it to change depending on the gameworld. i.e. If a 
tree is in the way of the FOV I want it to change accordingly.
Any ideas how to accomplish this?
 
thx
_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE