Re: [pygame] Implementing the A* finder algoritm in a non tile-based game

2009-02-03 Thread Luca
On Sun, Feb 1, 2009 at 7:25 PM, Ian Mallett geometr...@gmail.com wrote:
 A huge recent thread where there were examples and discussion.
 http://archives.seul.org/pygame/users/Jan-2009/msg00336.html


Thanks all for you answers! I hope all this will help someway!

-- 
-- luca


[pygame] Implementing the A* finder algoritm in a non tile-based game

2009-02-01 Thread Luca
Hi all.

I'm writing a game where I need to give to enemies a strong AI. This
will lead me to obtain a path finding algoritm to reach target
location.

All example I can find on the web are related to games based on tiles.
Anybody has experience on this problem and can help me, or point me to
a good documentation somewhere?

Any type of suggestion is welcome!

Thanks all!

-- 
-- luca


Re: [pygame] How the get a font size

2009-01-14 Thread Luca
On Tue, Jan 13, 2009 at 6:07 PM, Brian Fisher br...@hamsterrepublic.com wrote:
 Well in that case, it seems that knowing the size value passed to the
 constructor is only half of what you need to make a font at twice the size
 of the original.

You are not missing anything Brian, if facts you are right... I can do
anything with the size info alone...

I think that is not so good not beeing able to take those infos from
the Font object, but now I see that is not so important!

I will followe that path of the wrapper FakeFont class!

Thank you all!

-- 
-- luca


Re: [pygame] How the get a font size

2009-01-13 Thread Luca
On Tue, Jan 13, 2009 at 8:37 AM, Noah Kantrowitz n...@coderanger.net wrote:
 You clearly don't understand how C classes work. Please consult the Python
 documentation.

Thanks you all guys. I perfectly understand the problem, however
adding a new attribute isn't what I was looking for.

The Front wrapper class seems the best way I can use.

For who asked: I wanted to write down an utility that given a Font can
enable a raise effect that major the size of 100%, 200%, ...

PS: you think that adding at C level a new font_size, readonly
attribute can be a valid request for future Pygame release? I think
that this can hovewer be useful...

-- 
-- luca


Re: [pygame] How the get a font size

2009-01-12 Thread Luca
On Sun, Jan 11, 2009 at 10:36 PM, Noah Kantrowitz n...@coderanger.net wrote:

 As far as I know, there's no way to get the size of the font that way.
  What I do is name the font names in an intuitive way:
 Font12 = pygame.font.Font(, 12)
 Font18 = pygame.font.Font(, 18)
 Font36 = pygame.font.Font(, 36)

Thanks all, but in this way is impossible to get the size on an unknow
font? I'm making a library for developer that need to know what is the
font size that the developer can have choosen...

-- 
-- luca


[pygame] How the get a font size

2009-01-11 Thread Luca
Hi all.

I'm looking at the Font class API's, but I found no way to get the
size of a given font.
When I create a new font like

f1 = pygame.font.Font(, 12)

how can I get the size value (12) after the creation?

f1 DOT ???

Thanks!

-- 
-- luca


[pygame] groups drawing optimization

2008-12-21 Thread Luca
Hi all.

I've a non yet optimized game that works on level bigger that the screen.
So on my levels, sprites can be found outside the viewable part of the screen.

I'm just wondering if adding some code that didn't draw those sprites
when they are outside the viewable area can be good, or pygame low
level procedures do this itself.

What I'm thinking is to rewrite the draw method of the Group class, to
skip all sprites that aren't viewable.

Any comment about this? Is a useless work?

-- 
-- luca


Re: [pygame] Problem: difference in surface alpha from pygame 1.7 and 1.8

2008-12-15 Thread Luca
On Mon, Dec 15, 2008 at 12:36 AM, René Dudfield ren...@gmail.com wrote:
 hi,

 There were some bugs with 1.7.x with some surface arguments.

Thanks for replying, but I found more natural the old 1.7 behaviour...
Now seems that the set_alpha is ignored... It's strange.


-- 
-- luca


[pygame] Problem: difference in surface alpha from pygame 1.7 and 1.8

2008-12-14 Thread Luca
Hi all.

Some weeks ago I saw that my game has some problem with pygame 1.8 but
I was using pygame 1.7.

Today I installed 1.8 too and I found the problem.
In my current approach I draw sometimes transparent surfaces with a fill color:

   surface = pygame.Surface(size, flags=SRCALPHA, depth=32)
   surface.fill( (150,150,150) )
   surface.set_alpha( 0 )

Ok, this doens't seems very useful, but I don't want to enter in too
deep details.
However this was working on old 1.7.1 version... If I change the alpha
value later (with surface.set_alpha(100) ), I get a demi-transparent
surface.

On current 1.8 version the alpha value is ignored If I have a fill
color... To get a transparency I need to use a RGBA color... but I'm
almost sure that this wasn't working on pygame 1.7

...so now I have an incompatibility.

Someone can explain me why this is changed? Why the alpha value of a
surface is dropped from the fill color?

-- 
-- luca


Re: [pygame] Problem: difference in surface alpha from pygame 1.7 and 1.8

2008-12-14 Thread Luca
On Sun, Dec 14, 2008 at 12:49 PM, Luca luca...@gmail.com wrote:
 Hi all.

 Some weeks ago I saw that my game has some problem with pygame 1.8 but
 I was using pygame 1.7.

 Today I installed 1.8 too and I found the problem.
 In my current approach I draw sometimes transparent surfaces with a fill 
 color:

   surface = pygame.Surface(size, flags=SRCALPHA, depth=32)
   surface.fill( (150,150,150) )
   surface.set_alpha( 0 )

 Ok, this doens't seems very useful, but I don't want to enter in too
 deep details.
 However this was working on old 1.7.1 version... If I change the alpha
 value later (with surface.set_alpha(100) ), I get a demi-transparent
 surface.

 On current 1.8 version the alpha value is ignored If I have a fill
 color... To get a transparency I need to use a RGBA color... but I'm
 almost sure that this wasn't working on pygame 1.7

 ...so now I have an incompatibility.

 Someone can explain me why this is changed? Why the alpha value of a
 surface is dropped from the fill color?

Fixed removing the SRCALPHA flag from the surface... why this difference?


-- 
-- luca


[pygame] Getting a wind32 executable (py2exe) problem

2008-11-16 Thread Luca
Hi all!

I'm trying for the first time to get a window executable for my game.
I trying starting from a very old file found into the pygame ftp
section (but I think this is too old) and after that I tryed the
pymike PySetup.py module (I fround it from the google cache because
the original script seems unreachable).

With the PySetup script I get some good results (I get a .exe file and
all other data).

When I try to run the game I get a log error file; inside I read:

RuntimeError: default font not found 'freesansbold.fttf'

A font that I don't directly use in my game!

Any tips?

-- 
-- luca


Re: [pygame] Getting a wind32 executable (py2exe) problem

2008-11-16 Thread Luca
On Sun, Nov 16, 2008 at 12:50 PM, Luca [EMAIL PROTECTED] wrote:
 Hi all!

 I'm trying for the first time to get a window executable for my game.
 I trying starting from a very old file found into the pygame ftp
 section (but I think this is too old) and after that I tryed the
 pymike PySetup.py module (I fround it from the google cache because
 the original script seems unreachable).

 With the PySetup script I get some good results (I get a .exe file and
 all other data).

 When I try to run the game I get a log error file; inside I read:

 RuntimeError: default font not found 'freesansbold.fttf'

 A font that I don't directly use in my game!

 Any tips?


Sorry for asking, I found some related info on google. I was using
pygame.font.SysFont instead on .font.Font even if I was passing to the
constructor a local font packed with the game.

No I'll try again!


-- 
-- luca


Re: [pygame] Window position

2008-11-01 Thread Luca
On Sat, Nov 1, 2008 at 9:46 PM, Ian Mallett [EMAIL PROTECTED] wrote:
 Hi,

 Call this:

 import os
 os.environ['SDL_VIDEO_CENTERED'] = '1'

 before pygame stuff.

 Cheers,
 Ian


Thanks very much! But where I could find those type of undocumented infos?

-- 
-- luca


Re: [pygame] Transparency and pygame.draw

2008-08-19 Thread Luca
On Tue, Aug 19, 2008 at 6:08 AM, Forrest Voight [EMAIL PROTECTED] wrote:
 I might have written the patch he was talking about... It's attached.

Thanks!

-- 
-- luca


Re: [pygame] Transparency and pygame.draw

2008-08-18 Thread Luca
Maybe... I find this with google (but I don't find the patch Noah was
talink about...)

http://www.pygame.org/wiki/gsoc2008ideas#Better%20drawing%20primitives

On Mon, Aug 18, 2008 at 11:43 PM, PyMike [EMAIL PROTECTED] wrote:
 Will SDL_gfx ever be actually included in pygame?

 On Mon, Aug 18, 2008 at 11:38 AM, Noah Kantrowitz [EMAIL PROTECTED]
 wrote:

 No, but someone made bindings for SDL_gfx which does allow for this (and a
 lot more). Check the list archives.

 --Noah

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  On Behalf Of Luca
  Sent: Monday, August 18, 2008 5:28 AM
  To: pygame-users@seul.org
  Subject: [pygame] Transparency and pygame.draw
 
  Hi all.
 
  Is possible to get transparency using primitive pygame.draw functions?
 
  For me something like...
  pygame.draw.ellipse(screen, (0, 127, 0, 140), (300, 150, 80, 40), 0)
  ... where the color is given with a rgb+alpha value, simply doesn't
  work.
 
  --
  -- luca




 --
 - pymike (http://pymike.4rensics.org/)




-- 
-- luca


Re: [pygame] Pygame 1.8.x on latest kubuntu/ubuntu

2008-08-17 Thread Luca
On Sun, Aug 17, 2008 at 3:21 PM, Richie Ward [EMAIL PROTECTED] wrote:
 Try upgrading to the latest version of ubuntu.
 Run this in terminal
 sudo update-manager -c
 Click check
 and see if it says a distribution upgrade is available.

Thanks... and for Kubuntu? :-)

-- 
-- luca


[pygame] Pygame 1.8.x on latest kubuntu/ubuntu

2008-08-16 Thread Luca
Hi all.

Anyone is trying to use pygame 1.8 version from the debian/apt on
ubuntu/kubuntu?

The download page of pygame.org say that ubuntu support 1.8. I've
already all universe repository in my sources.list, but my local
version on pygame is still the 1.7.1.

Thanks!

-- 
-- luca


[pygame] Diffefrences between sprite.Group and sprite.RenderUpdates (and Group.draw question)

2008-05-04 Thread Luca
Hi all.

Reading pygame docs I found an example using a group that store all
sprites defined as a RenderUpdates, not simple Group.

The pydoc of this class don't give me much infos. Can someone explain
me what is the difference?

I found this because I'm having some problems with a game I'm
developing. The call of

all.draw

(where all is for now a RenderUpdates instance) draw sprites on the
screen in some order. There is a way to control the order of sprites
drawed on screen? I like to blit images ordered on Y position on the
screen.

Any help will be really appreciated!

-- 
-- luca


Re: [pygame] Collision Resolver module

2008-05-03 Thread Luca
On Mon, Dec 31, 2007 at 10:20 AM,  [EMAIL PROTECTED] wrote:
 Hi all.

  Here's a collision resolver module I've been working on.

Don't you have a reference web page for this useful piece of code?


-- 
-- luca


[pygame] Get a transparent Surface

2008-04-24 Thread Luca
Hi all.

I wanna obtain a transparent surface where I want to use base draw
functions, then blit this surface onto images.

After trying a lot I found only this combination is working:

s2 = pygame.Surface( (250,250), flags=SRCALPHA, depth=32 ).convert_alpha()
s2.fill( (127,127,127,0,) )

In facts I must create a surface, then fill a transparent color on
it... Is this the right way?

-- 
-- luca


Re: [pygame] Collision Resolver module

2008-01-01 Thread Luca
On Jan 1, 2008 7:49 PM,  [EMAIL PROTECTED] wrote:
 Pygame should aspire to providing a very rich (while being consistent, lean,
 and elegant) set of tools.


I'm not a smart pygame user yet so my opinion can be very poor, but
what I quoted here is true, and important. This is true for all engine
in general, not only pygame.
I've not tested the example and the library that generated this
thread, but for what I see and tryed from the Pygame base tutorial, a
Sprite collision is already present.
The tutorial itself says ...but probably this will be enough for you use.

So you are talking here of something that pygame already do... but not well?


Re: [pygame] PATCH: Python 2.5 support

2007-05-14 Thread Luca

Just for asking... when a new pygame release with Python 2.5 support will be
released? I'm using Python 2.5 and I can't install the 2.4...

On 5/13/07, John Myers [EMAIL PROTECTED] wrote:


ack! another reply to myself... I just now noticed the other very similar
patch... my patch is somewhat more complete as it fixes the
rect_as_sequence
things, and includes an #ifdef'd definition of Py_ssize_t for versions of
Python 2.5.  other than that, it's identical
--
#
# electronerd, the electronerdian from electronerdia
#