Re: [pygame] Quick OS survey - 2013

2013-12-05 Thread Julian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Just Trisquel for me. I have to wonder, though, how the heck can you
deduce how much you use each OS to the nearest half of a percent?
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSoV4cAAoJEIAKJ6Gj4QxvZ2kH/jrFST7XW4WpsYbPpzuPGcib
gTckwf/eaqcp704qhzmW0QJyzSuYI2duf3hI/SPJC07agTP3vv1S5shqQ7Xpytzq
zTjBa1gOiidQAiPZsyuPPPne0CT6uD69AAHIlSsh/C5u++CqW9YpddANeeCMXexY
8EzJULC375uxJ51WjsgkR4UitrnxK97vx4tO8GbIqtGtOAfIYfWFQi1Ji8TiqgSp
PkHtHbw4FYA5Zo+1qnjpQ5oijsaV/74X1MMEn6cRhZcrW6MxFQ+jrzP2YIX/8sqQ
7D9hcR+xkfXq41ac4RXJ2CzF0266tGUp0IIYJFgFrPI8qalB89OHX6H4saKTpB4=
=VvJv
-END PGP SIGNATURE-


Re: [pygame] Pygame logo license?

2013-11-03 Thread Julian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/03/2013 10:25 AM, Jason Marshall wrote:
 OK, here is a definitive answer from Gareth Noyce: 'They're public
 domain but I'd like attribution if they're used anywhere. Just a
 logo by Gareth Noyce would do, but I won't be complaining if
 people forget. :)'
 
 Jason


Alright, thanks for that, Jason. :)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSdnm/AAoJEIAKJ6Gj4QxvpF0H/iQ+emP+o665FE2+Ff3Ez5Wb
RHoz/i7GjMa3nVH384Me0qMTwtIWsb/zr5bKba6bvZZGvfBNuOvINzXQ6s74/Tt8
GlKCbElOd787/M9xLFNAj0Vw1vR8k3JRXAamopyk4w3LDzcU73VNgQdTjKhNsSL7
nVSxJjNSlcw0AhCbiWMrQ2HhzvJVcBLV257jSurxWnMSauIbAxAhJM11960BG5Io
9MxBs1vneCYZ1w5VHcsbRGhlQGyRxUH/clW5DgN6q/eyvAlPkC+Y04eG6I0cl8Rd
h5Lcv2FvoaNwV9ZoQnjpb2C5piWa/jiEIPzKlaZQjCm8Yr2xxbS40aBt7Me9Kfk=
=gS/7
-END PGP SIGNATURE-


[pygame] Pygame logo license?

2013-11-02 Thread Julian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Is the Pygame logo[0] under any sort of free culture license? I can't
seem to find any license information about it.

[0] http://www.pygame.org/docs/logos.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSdVdQAAoJEIAKJ6Gj4QxvSyAH/ihZqpaUmk4QfAmy597+oGk+
TSq3CzPQIP2uBj/RdcpMN+jieXJivQBi4z3PbFZ3LspKqz/E17LUiEYuF1vtcBtW
pjw1Ml354gSHYas/yO13VotIFg8kruAxz2ilJx8il2HrplcJRLOkv/03sx8SLHgP
pEi17l5NW6LYzRAwzM4+vfK19sXjI2uBrpwRZ0dT0D1mi/gIQolG4YVByxRVOTsv
9uYudKWvqT/meoxa/0SLD/Hov31K8lz9yKTYGkv2X12GMhrUr/z74kW9nMFmXzdZ
lvcSeLtFwelpqoF1iIqQmv5HXINhui1huDrrhV+bxKJgpQLW0qfbtRcabbTcWdg=
=bHT9
-END PGP SIGNATURE-


Re: [pygame] Pygame logo license?

2013-11-02 Thread Julian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/02/2013 04:48 PM, Jason Marshall wrote:
 See this previous discussion:
 
 https://groups.google.com/forum/#!searchin/pygame-mirror-on-google-groups/horst$20snake$20logo/pygame-mirror-on-google-groups/Td1bnVhsZeA/W7q4MwBP5DgJ

It
 
looks like the only answer in there was vaguely, it's in the
Pygame repo, so I suppose it's under the LGPL. Vague speculation
isn't enough for me. I want to be very thorough about this.

If what sort of license the logo is under is up in the air, I'm going
to assume that it was never actually licensed by its copyright holder
and not use it.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSddd9AAoJEIAKJ6Gj4Qxv+hAH/2IhWL1T0pzHZbsyxIXhzF5v
kg9IiIVBH77IjqoetKcHshnQG3lU7L9xUygX755fncDD+UJZ2hZKtiHA1lNUGB61
k85AHJUOwn23z+AV4X1JvlVc17Ns2Z6KiUu5N7PAugX1HSc1XE//k8+HWW8Zf3tK
5vZWkN5JGlmwUVNb8XR5PeJePgzflAjHHsNrQf8UWjGJLwHlVYp3LVOWX11g0K13
qYL+oeettaK2Zj6YElJT0APyyHd+Kblt/XIcE6xzU2tSXm+gDbu9irSkdEKXA+4A
LnnZ57oAMDFjC/925/PY4Iaag9Vz+QjvfLI/eSj1sPejBMHxQRtI5cm8BBZZk5o=
=x9pQ
-END PGP SIGNATURE-


Re: [pygame] unsubscribe pygame-users

2013-03-01 Thread Julian

I really think this confusion would be prevented if this page was reworded:

http://www.pygame.org/wiki/info

The list of commands to send to mojord...@seul.org is right after the 
sentence You can email the list at pygame-users@seul.org, which seems 
at a glance to imply that you're supposed to send the commands to that 
address. You only learn the actual address you're supposed to send the 
commands to if you hover the mouse over the links on the commands listed.


I've made this mistake before myself. It's really easy to make when 
you're not paying extremely close attention.


On 03/01/2013 09:26 AM, Thomas Kluyver wrote:

Please, don't everyone start doing this.

To unsubscribe, you need to send the text 'unsubscribe pygame-users' 
in the body of a message to majord...@seul.org 
mailto:majord...@seul.org , NOT the list address.


Thanks,
Thomas


On 1 March 2013 14:20, Jakob Schilling crancp...@gmail.com 
mailto:crancp...@gmail.com wrote:




2013/2/28 Xavier Ho cont...@xavierho.com
mailto:cont...@xavierho.com

unsubscribe pygame-users


unsubscribe pygame-users






Re: [pygame] How to control the physical size of displayed objects?

2013-02-27 Thread Julian

On 02/27/2013 04:23 PM, Mathieu Dubois wrote:
Just a last question: do you think the horizontal and vertical factors 
has to be the same? Because list_modes() tells me that my monitor can 
display: 1280x800 (ratio: 1.6), 1024x768 (ratio: 1.33), 800x600 
(ratio: 1.33), 640x480 (ratio: 1.33).


You mean dealing with wrong aspect ratios? That's a tough one because 
different drivers handle it differently; some distort the picture, some 
zoom it while maintaining the aspect ratio, some don't zoom it at all. I 
would say that it's best to either assume there is no distortion of 
aspect ratio (i.e. a square is a square), or allow a horizontal 
adjustment that normally syncs with the vertical adjustment.


Re: [pygame] import pygame.font failing

2013-02-27 Thread Julian

On 02/27/2013 06:51 PM, Kai Childheart wrote:

5. import pygame
6. import pygame.font
7.
8. pygame.init( )


I don't know if this is your problem, but you're normally not supposed 
to import pygame.font explicitly. It comes with the pygame module.


If the font module is unavailable, you will get an error when you try to 
use a font.


Re: [pygame] Does PyGame 1.9.1 work with Python 3.3.0 on Mac OSX 10.6.8?

2013-02-15 Thread Julian

On 02/15/2013 02:18 AM, Mt.Rose$TheFerns wrote:

Yeah I am quite sure.

I have 2.7.3 on my comp and it gives me no error at all.


I don't know anything about Mac OS X, but I don't think you can use the 
same Pygame installation for two different versions of Python. At least, 
that's the case for Windows and GNU/Linux.


Re: [pygame] Alternate to graphics modules

2013-02-06 Thread Julian

On 02/06/2013 06:12 PM, Elias Benevedes wrote:
There must be a way to write it in pure python code for the fact that 
pygame uses python (I assume?).
Pygame does not use Python for the low-level stuff. It's mostly a 
front-end for SDL, which is in C.


Like Richard suggested, try Pyglet. That is written entirely in Python 
(and that's a really nice thing, because that means it works with PyPy).


Re: [pygame] Resetting display

2012-05-09 Thread Julian Marchant
No. Only X11, e.g. GNU/Linux (and I think Mac OS X is another example).

If you really want to use toggle_fullscreen when the program is run on X11 
without also sacrificing platform-independence, you could do something like:

fullscreen = not fullscreen
if not pygame.display.toggle_fullscreen():
if fullscreen:
window = pygame.display.set_mode(size, FULLSCREEN)
else:
window = pygame.display.set_mode(size)

That's of course assuming that the most recent comment in the docs (from 
12/30/2010) is right about what pygame.display.toggle_fullscreen returns.

--- On Wed, 5/9/12, Bartosz Debski bart...@debski.co.uk wrote:

 From: Bartosz Debski bart...@debski.co.uk
 Subject: Re: [pygame] Resetting display
 To: pygame-users@seul.org
 Date: Wednesday, May 9, 2012, 11:31 AM
 Well, i haven't tried to be honest
 but will toggle_fullscreen work
 under Windows ?
 
 On Tue, May 8, 2012 at 10:32 AM, Radomir Dopieralski
 pyg...@sheep.art.pl
 wrote:
  On Tue, May 8, 2012 at 11:12 AM, Bartosz Debski bart...@debski.co.uk
 wrote:
  toggle_fullscreen will work only under X11.
 
  I didn't know you could run pygame outside of X11.
 
  [...]
 
  --
  Radomir Dopieralski
 


Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Julian Marchant
 Many of my variables' names are re-stating the exact value they hold, so I
 rarely have any confliction with names:

 filename_of_current_level = 'desert.txt'
 Font__New_Times_Roman_size_20 = ...
 pi_divided_by_180 = math.pi() / 180
 etc.

 The names are just according to what values they hold which-- are all
 unique anyways!
 And when the number of variables start reaching the hundreds, it just gets
 really crazy with global this global that ALL OVER my code, again and
 again . . .
 : (

Two questions: first, what's with the excessively long names, and second, why 
is it so important for these to be stored as global variables? I have a hunch 
that a LOT of your global variables would be much better off in objects.

 If I use dictionaries, I must type:  d['whatever'] for ALL my game 
 variables!!!
 Same with using classes--  c.whatever

 It's likepygame.draw.line()   instead of just: DRAW_LINE()

 or like: random.random()   instead of just:
 RANDOM_NUMBER_BETWEEN_0_AND_1()

 Pygame dot draw dot line (It sounds so lame too) 


 Arrg!! It's like driving me crazy!
 . . . 
 sigh
 . . .

 Sorry guys, I'm just feeling very frustrated with all these crazy
 programming conventions.

You would rather deal with a cluttered mess of global variables than organize 
them into classes and namespaces, just because you don't like to have to put 
the namespace or object name before the variable you're referencing?

Huh?

Do whatever you want, but seriously, this is just a silly complaint and tells 
me you haven't even TRIED to use object-oriented programming.

 (PS in case you haven't already, you can check out my really cool
 physics program in the Python Draw docs! I'm not a troll I was just
 having way too much fun. lol)

I looked at it, and like I expected, it was a terrible mess, not a good example 
of whatever it was attempting to do.

Out of curiosity, how long have you been programming, and what languages have 
you used?


Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-11 Thread Julian Marchant
Yes. In your case, ``font`` is a global-level variable.

--- On Sun, 3/11/12, Nick Arnoeyts nickarnoe...@gmail.com wrote:

From: Nick Arnoeyts nickarnoe...@gmail.com
Subject: Re: [pygame] Declaring variables in function as if at code's line-level
To: pygame-users@seul.org
Date: Sunday, March 11, 2012, 5:34 AM

I have a little additional question about the explanation Lee gave.
Is it possible to use class instances from the global namespace in a function? 
For example:
from game import screen, font

def get_text(string):    font.render(string) # parts cut out because I'm in a 
hurry
I figure this is probably possible, but it can't hurt to ask for future 
reference.





Op 11 maart 2012 06:13 schreef Lee Buckingham lee.bucking...@gmail.com het 
volgende:

Just to add a little more to Julian's response:



in a function, you can refer to a global variable without using the

global keyword, like this:



a = 1



def something()

    if a == 1:  print(sure does!)



#later on

something()

# output prints sure does!





On the other hand, you cannot **set it equal to something** without

using the global keyword.  Python is designed to assume you are making

a new, function-level variable that happens to have the same name.



#this fails



a = 1



def something()

    a = 2



#later on

something()

print(a)



#the output will say 1





This could have gone either way, I suppose.  The authors of python

could have had the interpreter do it the way you are suggesting.   If

I type a=whatever, the interpreter could look up to the next scope,

or to the highest (line level) scope, etc... and use any like-named

variable first.  This could work.



The problem is that in this situation, you would have to use something

like a local keyword every time you did NOT want to worry about the

possibility of accidentally naming a variable the same thing as some

other variable in a higher scope, like the line level variables

yourself and other coders prefer.



As it turns out, the intent of the python designers favored the first

way, so that they could relax a bit about variable names (a lot of us

use variables named x, y, i, a, b, etc.., all the time, throughout the

code).  However, for the times when we really want to look outside a

function, just saying global x once, at the beginning of a function,

works just fine.



There really are debugging issues both ways.  I have beat myself

senseless trying to figure out why my functions seem ineffective

before finally (days later) realizing I just forgot a global

statement.  I avoid this now, for the most part, by using a lot of

classes and objects, which is just a preference on my part (and it

drives my brother crazy).  From the other perspective, I can imagine a

similar problem with your favored approach, where I get ghost-changes

to variables on the game level for no obvious reason.  Days later,

after bruising my forehead and keyboard, I might notice that I named a

function level variable the same thing as a line level variable.  In

my case, this would be much, much more frustrating, since I am not

very creative with variable names.



I really hope this helps a bit.  Python is a very friendly language,

but like all languages, is sort of slanted in certain directions of

its own.  I found myself repeatedly frustrated and irrate about the

design of VB.NET, C#, and Java, for instance.  For me, python solved

my problems because I think the same way.  There's nothing wrong with

preferring one over the other; it's just our nature, I suppose.



Good luck with your coding!



All the best,



-Lee-



On Sat, Mar 10, 2012 at 8:31 PM, Julian Marchant onp...@yahoo.com wrote:



 I am struggling with my desire to say things that would be insulting to you.



 Listen closely: you CAN read global-level variables at any time as long as 
 there isn't a local variable with the same name. You CAN write to global 
 variables from within a function as long as you first declare it within that 
 function with the ``global`` keyword. You CANNOT write to global variables 
 without using ``global``. The reason for this is simple: if you don't use 
 ``global``, the interpreter assumes that you are assigning to a local 
 (function-level) variable.




 Frankly, I don't see what the big deal is. It's just ONE extra line per 
 funtion per variable that you have to write to. Consider:



 #!/usr/bin/env python



 a =  b = 0

 c = 0



 def foo():

    global a



    a += 1

    if a  b:

        a = 0



 def bar():

    global b

    global c



    b = a + 10

    c += a



    if c  a + b:

        c = 0



 See how easy that is? You're making a big fuss over nothing.



 --- On Sun, 3/11/12, Brian Brown bro...@gmail.com wrote:



 From: Brian Brown bro...@gmail.com

 Subject: Re: [pygame] Declaring variables in function as if at code's 
 line-level

 To: pygame-users@seul.org

 Date: Sunday, March 11, 2012, 12:15 AM

 line-level is leftmost of the

 source code

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-10 Thread Julian Marchant

I am struggling with my desire to say things that would be insulting to you.

Listen closely: you CAN read global-level variables at any time as long as 
there isn't a local variable with the same name. You CAN write to global 
variables from within a function as long as you first declare it within that 
function with the ``global`` keyword. You CANNOT write to global variables 
without using ``global``. The reason for this is simple: if you don't use 
``global``, the interpreter assumes that you are assigning to a local 
(function-level) variable.

Frankly, I don't see what the big deal is. It's just ONE extra line per funtion 
per variable that you have to write to. Consider:

#!/usr/bin/env python

a = 0
b = 0
c = 0

def foo():
global a

a += 1
if a  b:
a = 0

def bar():
global b
global c

b = a + 10
c += a

if c  a + b:
c = 0

See how easy that is? You're making a big fuss over nothing.

--- On Sun, 3/11/12, Brian Brown bro...@gmail.com wrote:

 From: Brian Brown bro...@gmail.com
 Subject: Re: [pygame] Declaring variables in function as if at code's 
 line-level
 To: pygame-users@seul.org
 Date: Sunday, March 11, 2012, 12:15 AM
 line-level is leftmost of the
 source code.
 (I thought my example code would clarify that.)
 My question is very clear, I think, I'm not sure why you
 guys are
 having so much difficulty understanding it.
 Sorry about that. I'm not trying to frustrate you, I just
 wish people
 would answer my questions.
 (I rarely get good answers on these mailing lists. I guess I
 made a
 mistake asking here.)
 Haven't I just given you one of the most profound statements
 of
 efficient game programming?
 Shouldn't you be grateful? Thank you for all your replies
 everyone I
 guess I'm not wanted here.
 
 
 On 3/10/12, Brian Brown bro...@gmail.com
 wrote:
  That is not true, Ryan. I am currently making a game
 with Python and
  Pygame, and my question is directly related with its
 development.
 
  On 3/10/12, Ryan Hope rmh3...@gmail.com
 wrote:
  Why is this even be talked about on the pygame ml?
 This has nothing to
  do with pygame.
 
  On Sat, Mar 10, 2012 at 6:30 PM, Brian Brown bro...@gmail.com
 wrote:
  Hi pygame users, just a simple question-- How
 can one cause variables
  at function-level to behave like variables at
 line-level? (With
  basic python code) I just want to avoid using
 global over and over
  again (in many different functions) while I
 want to declare, use, and
  delete all my game's variables inside
 functions.Thanks.
 
  It should make my program very simple and
 straight-forward if I could
  do this. (As I have explained in the previous
 replies to this thread)
  I would like to know how it can be done--
 without immature,
  unproductive statements like:
  Don't freak out at the fact that I used the
 class keyword.
  Thank you.
 
  Matt
 
  On 3/10/12, Brian Brown bro...@gmail.com
 wrote:
  That is not true, Chris.
 
  On 3/10/12, Christopher Arndt ch...@chrisarndt.de
 wrote:
  On 10.03.2012 23:35, Christopher Night
 wrote:
      DO:
      * Access variables.
        (Move game according to
 current-variable-status and
  player-input)
 
      * Output to graphics and
 sound card.
        (Display game according to
 current-variable-status.)
      LOOP
 
      That's really all we need.
 
  Who's this we? Certainly doesn't
 include me, because I need *a lot*
  more from a programming language.
 
  Brian, I think you should read a bit
 about namespaces and why they are
  a
  good thing. You won't get very far with
 Python with your point of view
  -
  or in any other programming language
 for that matter (except maybe PHP
  -
  just kidding ;) ).
 
 
  Chris
 
 
 
 
 
  --
  Ryan Hope, M.S.
  CogWorks Lab
  Department of Cognitive Science
  Rensselaer Polytechnic Institute
 
 




Re: [pygame] Line collision detection?

2012-02-21 Thread Julian Marchant
Ah, the linear equation. I'd forgotten about it, silly me. Thanks! I think I 
can get that to work easily enough even without examples.

Regarding using multiple lines, that would be the ideal solution (it seems you 
could do even better by having four lines for each object, one for each 
corner), but a bit excessive for my purposes.


[pygame] Line collision detection?

2012-02-20 Thread Julian Marchant
Hi, I tried searching the internet for an answer, but didn't find anything, so 
I'll ask here.

One problem with normal collision detection I'm sure we're all aware of is the 
problem that objects moving too fast can pass through other objects without a 
collision happening. I'm experiencing this problem with a scrolling shooter I'm 
working on because both bullets and enemies move pretty fast, one enemy is very 
small, and the frame rate is usually somewhat low (maybe 30 FPS) on the machine 
I'm targeting.

Now, obviously, I intend to make other changes which will help, e.g. making 
these tiny enemies bigger, but I'd like to tackle the problem directly. There 
are two ways I can think of: The first way, which I easily could implement and 
would be most effective, is to move the bullets in steps and do collision 
detection each step. I have done something like this in a previous game and it 
worked well, but it seems like overkill in this game (the bullet subrect is 
only 5x5 pixels) and it isn't perfect anyway.

The second way, which I would prefer, is to detect collision with a line from 
the bullet's new position to the bullet's previous position. I've seen this 
discussed on the Game Maker Community. The problem with this is I have no idea 
of how this could be done in a remotely efficient manner. The only method I can 
think of is to check every individual pixel one at a time, which is obviously 
not a good idea. Bullets can move diagonally, so just checking the x or y 
position won't work.

So, in a nutshell, my question is: how could I do line collision detection 
like this in a relatively efficient way?


Re: [pygame] Compilation

2012-02-17 Thread Julian Marchant
The link you gave just gives instructions on how to use a combination of 
cx_Freeze (which is great, by the way, I recommend it) and Install Creator. 
Note that only cx_Freeze can be actually useful to someone running Mac OS X, as 
Install Creator is Windows-only.

--- On Fri, 2/17/12, Andrew Godfroy killer...@hotmail.com wrote:

 From: Andrew Godfroy killer...@hotmail.com
 Subject: Re: [pygame] Compilation
 To: pygame-users@seul.org
 Date: Friday, February 17, 2012, 10:41 PM
 Hey, Try this: 
 http://cs.simpson.edu/?q=make_an_installer_for_your_python_program
 
 I use it for all my programs when ready for distribution.
 What it does it converts your .Py to an exe file which can
 be run like any normal program. Its the only Compilation/Exe
 creation program that I have found that is still being
 supported.
 
 -Original Message- From: Zack Baker
 Sent: Friday, February 17, 2012 4:44 PM
 To: pygame-users@seul.org
 Cc: pygame-users@seul.org
 Subject: Re: [pygame] Compilation
 
 So could you just resend an email with the command exactly
 how it would as oppear because that looks a littled funky.
 Let's assume that the game is called helloworld.py  and
 put it in the trunk folder or wherever. Thank you!
 
 -Zack
 
 On Feb 17, 2012, at 4:17 PM, Sam Bull sam.hack...@sent.com
 wrote:
 
  On Thu, 2012-02-16 at 18:52 -0700, Ian Mallett wrote:
  
  I am unaware of any other binary distribution
 techniques for Python on
  Mac other than py2app.
  
  [Sent from wrong address, so re-posting]
  
  Pyinstaller? It claims to be cross-platform. It's also
 the only one that
  I've managed to get working without much hassle. I've
 only tested it on
  Linux myself though.
  
  To create a frozen binary on my system, all I need to
 run is:
  python ~/.pyinstaller-1.5.1/pyinstaller.py --onefile -o
 pyinstaller
  trunk/pacman.py
  
  That's with pyinstaller installed in a hidden folder in
 my home
  directory. The -o argument is the output directory. So
 this compiles my
  game located at trunk/pacman.py into a single binary,
 saving it into
  the pyinstaller folder.
  
  I've not managed to have any success with alternatives
 like py2app or
  py2exe.
  
  Oh, and one caveat, the exit() function doesn't work
 with Pyinstaller,
  use sys.exit() instead.
  
  -- Sam Bull sambull.org
  PGP: 9626CE2B
  



Re: [pygame] Compilation

2012-02-16 Thread Julian Marchant
I use cx_Freeze for packaging up EXEs and Linux binaries. I don't have a Mac, 
so I don't know how well it works with them, but it's supposed to be 
cross-platform.

--- On Fri, 2/17/12, Zack Baker zbaker1...@gmail.com wrote:

 From: Zack Baker zbaker1...@gmail.com
 Subject: [pygame] Compilation
 To: Pygame pygame-users@seul.org
 Date: Friday, February 17, 2012, 1:50 AM
 
 I have a Mac with pygame 2.7.2 and pygasme 1.9.1. Is it
 possiblerr for me to 'compile' my 2d game for distribution.
 BTW py2app has not really worked for me. Are there any
 alternatives? 
 -Zack


RE: [pygame] Capabilities of Pygame

2012-01-14 Thread Julian Marchant
--- On Sat, 1/14/12, Ryan Strunk ryan.str...@gmail.com wrote:
 So if you were to stream audio, would that eliminate the
 potential delay.
 The only audio-only game I've seen written in Pygame, Sound
 RTS, has a bit
 of noticeable lag when playing sounds. Is there a way to
 program such that
 sounds would play instantly when told to do so?

Streaming is for music, not sound effects.


Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Julian Marchant
--- On Fri, 1/13/12, Lenard Lindstrom le...@telus.net wrote:

 Also,
 though SDL does support streaming, Pygame does not.
 Everything must be loaded before played.

Um... that's not true.  pygame.mixer.music is Pygame's streaming module.


Re: [pygame] Continuous Shooting

2012-01-12 Thread Julian Marchant
First off, you need some sort of time management. As it is now, it'll run at 
variable speeds depending on how fast the processor is. Use pygame.time.Clock 
to limit the frame rate and/or use delta timing.

As for your problem, all you need is a counter variable. Have the counter 
variable start at 0 and decrease it by 1 (or the amount of time passed if 
you're using delta timing) each time the loop happens. When the shoot key is 
pressed, create a bullet and set the counter to the amount of time you want to 
wait for the next bullet. Then, if the shoot key is held down while the loop 
variable is 0, create another bullet and reset the counter to the wait time.

--- On Thu, 1/12/12, ANKUR AGGARWAL coolankur2...@gmail.com wrote:

From: ANKUR AGGARWAL coolankur2...@gmail.com
Subject: [pygame] Continuous Shooting
To: pygame-users@seul.org, tu...@python.org
Date: Thursday, January 12, 2012, 12:39 PM

HeyI was making a demo shooting game and problem is that I want 
a continuous stream of bullets. As of now on pressing the space key only one 
bullet comes out of the plane (I want this to be continuous stream). On 
pressing space key again bullet starts from its initial point. My problem in 
the code is that I am able to make a single object of Bullet only (thats why it 
is throwing single bullet) and unable to find the another logic. Please help me 
out. Attaching the files along with this mail.


import pygamefrom pygame.locals import *import random
pygame.init()screen=pygame.display.set_mode((640,480),0,24)pygame.display.set_caption(Hit
 The Stone)


class Plane(pygame.sprite.Sprite):    def __init__(self,bullet):        
self.bullet=bullet        pygame.sprite.Sprite.__init__(self)        
self.image=pygame.image.load('plane.gif').convert()

        self.rect=self.image.get_rect()        
self.rect.centerx=random.randint(0,screen.get_width())        
self.distancefromcenter=30        
self.rect.centery=screen.get_height()-self.distancefromcenter

        self.dx=2        self.dy=2
    def update(self):        pressed=pygame.key.get_pressed()        if 
pressed[K_DOWN]:            self.rect.centery+=self.dy

        elif pressed[K_UP]:            self.rect.centery-=self.dy        elif 
pressed[K_LEFT]:            self.rect.centerx-=self.dx        elif 
pressed[K_RIGHT]:

            self.rect.centerx+=self.dx            
        if self.rect.bottom=screen.get_height():            
self.rect.bottom=screen.get_height()        elif self.rect.top=0:

            self.rect.top=0
        if self.rect.centerx=screen.get_width()-self.distancefromcenter:       
     self.rect.centerx=screen.get_width()-self.distancefromcenter

        elif self.rect.centerx=self.distancefromcenter:            
self.rect.centerx=self.distancefromcenter
        if pressed[K_SPACE]:            self.bullet.x=self.rect.centerx

            self.bullet.y=self.rect.centery            

class Bullet(pygame.sprite.Sprite):    def __init__(self):        
pygame.sprite.Sprite.__init__(self)

        self.image=pygame.image.load('geometrybullet.png').convert_alpha()      
  self.rect=self.image.get_rect()        self.rect.center=(-100,-100)        
self.x=-100

        self.y=-100        self.dy=5

    def update(self):        self.y-=self.dy        
self.rect.center=(self.x,self.y)        if self.rect.top0:

            self.x=-100            self.y=-100
        def main():    background=pygame.Surface(screen.get_size())    
background=background.convert()

    screen.blit(background,(0,0))    bullet=Bullet()    plane=Plane(bullet)    
allSprites=pygame.sprite.Group(plane,bullet)
    while 1:        for i in pygame.event.get():

            quitPressed=pygame.key.get_pressed()            if i.type==QUIT or 
quitPressed[K_q]:                exit()
        allSprites.clear(screen,background)

        allSprites.update()        allSprites.draw(screen)        
pygame.display.flip()

if __name__=='__main__':    main()


Thanks in advance :)
RegardsAnkur Aggarwal                


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Julian Marchant
You couldn't build a game that's up to scope with any 3D game, because you 
wouldn't be able to use 3D. For that, you'd need either PyOpenGL (with Pygame) 
or Pyglet. The latter is better in some ways; the main advantage 
Pygame/PyOpenGL has that I can think of is joystick support. On the other hand, 
Pyglet is compatible with PyPy, which can give you massive speed improvements, 
and it's easier to use than PyOpenGL (or so I've heard; I haven't done anything 
with either myself).

The Pythonic way is to not worry about speed until it's actually an issue. If 
speed is an issue, you can re-write parts in C, or there's the aforementioned 
PyPy.

--- On Fri, 1/13/12, Ryan Strunk ryan.str...@gmail.com wrote:

From: Ryan Strunk ryan.str...@gmail.com
Subject: [pygame] Capabilities of Pygame
To: pygame-users@seul.org
Date: Friday, January 13, 2012, 1:45 AM

Hello everyone,As I embark on this journey of learning Pygame and game design, 
I have one last burning question I haven’t been able to find an answer to. I’ve 
heard that Python, as an interpreted language, isn’t as fast as languages like 
C++. It follows, then, that Pygame would suffer the same drawback in terms of 
speed. What I don’t know, though, is how much this potential limitation would 
affect game play.Using Pygame, is it possible to create games that would rival 
the scope and complexity of mainstream titles out there. Could you build a 
World the size of World of Warcraft and still have it be responsive to players? 
Could you build a game as fast-moving as Mortal Kombat, play it over the 
internet with a good connection, and still have it be as smooth as the Xbox?I 
want to make sure I don’t get deep into a project only to realize that the 
language was better suited to a different style of game.Any help anyone can 
provide would be greatly
 appreciated.All the best,Ryan

Re: [pygame] pygame performance limits

2011-11-24 Thread Julian Marchant
Now, of course, when you have a super-high-level language, like PyGame, and 
it's running in an interpreted language like Python, you will run out of power 
much sooner than you would in a language like C, especially on a phone 
computer.

This, however, is no reason to stop using PyGame -- it's a reason to improve 
PyGame. Improvements require a lot of technical knowledge, skill, and effort, 
but they benefit MANY.

Pygame is a library, not a language. ;) And much of it is written in C.

I very much agree with everything you said, though. What's particularly 
interesting is, as Psyco and PyPy have shown, higher-level languages can be 
almost as fast as or sometimes even faster than lower-level languages.


Re: [pygame] set new recommendation to which version of pygame?

2011-09-30 Thread Julian Marchant
You don't need to actually download an old version of Python 2.x to have source 
code that's compatible with the old version. All you need to do is not use the 
new features of versions 2.6 and 2.7. Besides, if you're a beginner who doesn't 
know what to download, it probably isn't the best idea to be worrying about 
supporting old platforms anyway.

--- On Fri, 9/30/11, René Dudfield ren...@gmail.com wrote:

From: René Dudfield ren...@gmail.com
Subject: Re: [pygame] set new recommendation to which version of pygame?
To: pygame-users@seul.org
Date: Friday, September 30, 2011, 4:35 PM

Hi,

maybe a note should be added about distribution.  Python2.5 is the best if you 
want to distribute on old versions of windows.

cu,



On Fri, Sep 30, 2011 at 6:26 PM, Jake b ninmonk...@gmail.com wrote:

For the updated website, what versions do you think we should recommend? Here's 
what I think:



1) Python version: 2.7 and 2.6 are good.


    (Almost any random module will work with them, many smaller ones are not 
updated for 3.x )

2) pygame version:




    **need link to the new .exe, which is somewhere in the mailing list**

3) 32bit python also is more common.



    [ You can use 32python on windows 64 bit fine ]





Note:
you can install multiple versions of python on your computer.You can install 
multiple versions of python modules on your computer. [See virtualenv ]


From the docs, about version number 2.7:
Python 2.7 is intended to be the last major release in the 2.x series.
The Python maintainers are planning to focus their future efforts on
the Python 3.x series.
This means that 2.7 will remain in place for a long time, running production 
systems that have not been ported to Python 3.x :





-- 
Jake





Re: [pygame] set new recommendation to which version of pygame?

2011-09-30 Thread Julian Marchant
Or just allow that discussion to remain on the Python site 
(http://wiki.python.org/moin/Python2orPython3). Unless Pygame itself has issues 
with certain versions of Python, there is no place for this discussion on 
pygame.org, IMO.

--- On Fri, 9/30/11, James Paige b...@hamsterrepublic.com wrote:

From: James Paige b...@hamsterrepublic.com
Subject: Re: [pygame] set new recommendation to which version of pygame?
To: pygame-users@seul.org
Date: Friday, September 30, 2011, 6:00 PM

We should not be reccomending any specific version. We should just make 
it clear to new users that they have to get the pygame that matches 
their version of python.

All the nuances of which version is best for different reasons are 
important, but trying to explain them on the download page will only 
confuse newcomers.

Maybe just a link on the downloads page that leads to a separate page 
titled How to decided which python+pygame version is best for me

---
James Paige

On Fri, Sep 30, 2011 at 11:26:56AM -0500, Jake b wrote:
    For the updated website, what versions do you think we should recommend?
    Here's what I think:
 
    1) Python version: 2.7 and 2.6 are good.
        (Almost any random module will work with them, many smaller ones are
    not updated for 3.x )
 
    2) pygame version:
        **need link to the new .exe, which is somewhere in the mailing list**
 
    3) 32bit python also is more common.
        [ You can use 32python on windows 64 bit fine ]
    Note:
      * you can install multiple versions of python on your computer.
      * You can install multiple versions of python modules on your computer.
        [See virtualenv ]
    From the docs, about version number 2.7:
 
    Python 2.7 is intended to be the last major release in the 2.x series. The
    Python maintainers are planning to focus their future efforts on the
    Python 3.x series.
 
    This means that 2.7 will remain in place for a long time, running
    production systems that have not been ported to Python 3.x :
 
    --
    Jake


Re: [pygame] pygame download page still reccomends python 2.5

2011-09-29 Thread Julian Marchant
I second this, mostly because the statement that version 2.5 is the best 
Python on Windows is simply untrue, as far as I can tell. I guess there must 
have been issues in the past or something (I didn't start using Pygame until 
around the time Python 2.7 came out, so I don't know), but right now, I know of 
absolutely no issues with Python 2.6 or Python 2.7. I don't even usually make 
my programs compatible with Python 2.5 (mostly because I use the str.format 
method and from __future__ import print_function). It's an ancient version at 
this point.

--- On Thu, 9/29/11, James Paige b...@hamsterrepublic.com wrote:

From: James Paige b...@hamsterrepublic.com
Subject: [pygame] pygame download page still reccomends python 2.5
To: pygame-users@seul.org
Date: Thursday, September 29, 2011, 9:48 PM

I was talking with a new programmer who is just getting started with 
python and pygame. After a lot of confusion, I realized that he had 
downloaded pygame-1.9.1.win32-py2.5.msi by mistake. The download page 
still has bold text proclaiming (python2.5.4 is the best python on 
windows at the moment)

If anybody knows any reason why that is still true, please correct me, 
but I think instead of bold text to reccomend one version over others, 
there should just be a message saying that a person should take care to 
download the version that matches their python version.

No matter who I am, the best version of pygame is the one that will 
work on my computer ;)

---
James Paige


Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-23 Thread Julian Marchant
What is the purpose to having calculations done with a size that's 10 times 
larger? If it's just precision, the solution could be simply to use floats for 
the calculations and convert to ints as necessary.

Or, you could write some simple functions or methods that divide the x and y by 
10 and then pass the new values to the appropriate Pygame methods. Or, if you 
really want to use the normal Pygame methods, just integer-divide the values as 
you pass them. Even better, you could make a derived class and override the 
Pygame methods with more appropriate ones (a technique commonly used with 
wxPython) like so:

def blit(self, source, dest, area=None, special_flags=0):
# Change dest so that its x and y are divided by 10
pretend_this_function_does_what_you_want()

pygame.Surface.blit(self, source, dest, area, special_flags)

One last possibility that I can think of is to scale up your graphics for 
1000x1000 and then scale the window surface every time you want to draw it. 
That is, draw to a 1000x1000 surface, but shrink it to 100x100 when it's 
displayed. I would only recommend this if you find it easy to implement and any 
performance hit is negligible or unimportant.

Anyway, I hope that helps!

--- On Fri, 9/23/11, Mac Ryan quasipe...@gmail.com wrote:

From: Mac Ryan quasipe...@gmail.com
Subject: [pygame] Native PyGame method for automatically scaling inputs to a 
surface resolution?
To: pygame-users@seul.org
Date: Friday, September 23, 2011, 8:29 AM

Hello,

    back July, I posted a question on StackOverflow titled that so
far still did not get any answer. So - although I believe the answer is
quite simply NO - I thought to repost it here:



In my program (which uses pygame to draw objects on the video) I have
two representation of my world:

- A physical one that I use to make all the calculations involved in the
  simulation and in which objects are located on a 1000x1000 metres
  surface.
- A visual one which I use to draw on the screen, in which my objects
  are located in a window measuring 100x100 pixels.

What I want to achieve is to be able to pass to my pygame drawing
functions (which normally accept inputs in pixels) my
physical/real-word coordinates. In other words, I would like to be able
to say:

Draw a 20m radius circle at coordinates (200m, 500m)
using the precise pygame syntax:

pygame.draw.circle(surface, (255,255,255), (200,500), 20)
and get my circle of 2px radius at centred on pixels (20,50).



If you are on SO and would like to answer there [too], I'll be happy to
dispense upvotes! ;) http://stackoverflow.com/q/6807459/146792


[pygame] iq81c x0flb

2011-09-10 Thread Julian Marchant
2jlpb53f, 43z2qoofk2.
 http://razniekuhni.ru/images/ydvy.html 
ofssm5 d5vnx x3n2p90c4eu, 3dou2v ch5qrua6li. z29mei ulyqvlc.


Re: [pygame] iq81c x0flb

2011-09-10 Thread Julian Marchant
Sorry about this. It seems someone from Saudi Arabia got into my account a 
little more than an hour ago and sent random messages like this to a bunch of 
my contacts. I've changed my password so hopefully it won't happen again.

Sneaky bastard deleted the E-mails from the Sent folder, but forgot to empty my 
trash folder. Whoops. :P


- Original Message -
From: Julian Marchant onp...@yahoo.com
To: pygame-users@seul.org
Cc: 
Sent: Saturday, September 10, 2011 8:15 PM
Subject: [pygame] iq81c x0flb

2jlpb53f, 43z2qoofk2.
http://razniekuhni.ru/images/ydvy.html 
ofssm5 d5vnx x3n2p90c4eu, 3dou2v ch5qrua6li. z29mei ulyqvlc.


Re: [pygame] Sprite troubles

2011-04-30 Thread Julian Marchant
From what I gather, pygame.sprite.RenderPlain, in its current form, just 
points 
to pygame.sprite.Group.





From: David Burton ncdave4l...@gmail.com
To: pygame-users@seul.org; Nathan BIAGINI nathan.o...@gmail.com
Sent: Sat, April 30, 2011 8:52:04 PM
Subject: Re: [pygame] Sprite troubles

RenderPlain?  What's that?  It's not mentioned here: 
 http://www.pygame.org/docs/ref/sprite.html
I found it mentioned in some 2002 documentation.  I think it might be obsolete. 
  Not sure.

I've been using pygame.sprite.OrderedUpdates.


Dave



On Sat, Apr 30, 2011 at 3:53 PM, Nathan BIAGINI nathan.o...@gmail.com wrote:

Hi everyone,

it sounds like a stupid question but i have written a really simple program 
where i just want to add a sprite to a sprite group and then draw the 
containing 
of this group.

Here is the main code :



import pygame
from sprites import Node

pygame.init()

screen = pygame.display.set_mode((640, 480))
node_group = pygame.sprite.RenderPlain()

node = Node((156, 234), 0)
node_group.add(node)

while 1:
node_group.update()
node_group.draw(screen)

pygame.display.flip()


And here is my sprite class :


import pygame
from pygame.locals import *
from loads import loadImage

class Node(pygame.sprite.Sprite):
'''
Node class represent the sprite of each node of the
map. So, one instance of Node is created for each
node.
'''

def __init__(self, pos, node_type):
pygame.sprite.Sprite.__init__(self)

self.pos = pos
self.node_type = node_type

if self.node_type == 0:
self.image, self.rect = loadImage('ground.bmp', -1)

elif self.node_type == 1:
self.image, self.rect = loadImage('wall.bmp', -1)

elif self.node_type == 2:
self.image, self.rect = loadImage('hole.bmp', -1)

self.rect.topleft = pos

def update(self):
pass 


I maybe a bit tired but i can't see what i m doing wrong...

Thanks for your help. 



-- 
“If anyone thinks the words ‘government’ and ‘efficiency’ belong in the same 
sentence, we  have counseling available.”
- Sen. Paul Tsongas (D-MA)

Re: [pygame] Whoa! Bad slowdown!

2011-04-13 Thread Julian Marchant
Ah, of course! I was so fixated on adjusting alpha, I completely ignored 
blending effects. I can't properly test how good it looks yet, but it causes 
very little if any slowdown (seems to be none). Thanks for the help! :)





From: Weeble clockworksa...@gmail.com
To: pygame-users@seul.org
Cc: Julian Marchant onp...@yahoo.com
Sent: Wed, April 13, 2011 1:37:35 AM
Subject: Re: [pygame] Whoa! Bad slowdown!

On Wed, Apr 13, 2011 at 1:49 AM, Julian Marchant onp...@yahoo.com wrote:
 Is there a better way to do what I'm trying to do in that section of code?

Try something like this:

img = self.images[self.leftarm_image][img_index].copy()
img.fill((255,255,255,255*alpha_percent), special_flags=BLEND_RGBA_MULT)

 
 From: Ian Mallett geometr...@gmail.com
 To: pygame-users@seul.org
 Sent: Tue, April 12, 2011 7:53:24 PM
 Subject: Re: [pygame] Whoa! Bad slowdown!

 Well, for one thing, on my machine, it segfaults constantly.

 I tracked it down to ~line 1006:
 scaled = pygame.transform.smoothscale(img, size)
 But there doesn't seem to be anything out of the ordinary there.  Maybe
 trying to resize many 1x1 surfaces to 400x400 leads to a memory leak
 somewhere in PyGame?

 Ian



[pygame] Whoa! Bad slowdown!

2011-04-12 Thread Julian Marchant
I have actually mentioned this project of mine on this list before, but it was 
about a Windows-specific issue. This time, it's about slowdown. Now, my laptop 
is very low-end, so it's not surprising to me when I experience lag in 
particularly graphically-intensive games, but this is ridiculous.

All the files of my project can be found in this download: 
http://www.mediafire.com/?pbr8kubwu9q7vg0

The slowdown I'm experiencing (under Fedora 14/GNOME, at least) is a ridiculous 
level. Each frame takes something like 10-20 seconds, which is just plain 
unimaginable. I have looked through my code, and I find nothing which should 
cause this massive scale of slowdown. A fair amount of stuff happens, and even 
some pixel work with surfarray happens, but I would not expect any less than 
maybe 10 FPS, and that's really stretching it.

Most of the slowdown seems to occur in the PlayerSprite.update and 
PlayerView.update methods. Looking at the system monitor, it seems that the 
program is eating up clock cycles like a starving lion. My question is: can 
anyone see a good reason why these methods would cause as much slowdown as they 
do? If so, any recommendations for optimizing it better?

Thanks! :)


Re: [pygame] Whoa! Bad slowdown!

2011-04-12 Thread Julian Marchant
I tried changing the default fill-in surface size from 1x1 to 200x200 and 
removing all the empty 1x1 images in data/characters/noghost, but it had no 
effect on speed. This error occurred, however, and it seems to be a result of 
removing the 1x1 images (which caused dynamically generated replacements to be 
created):

Traceback (most recent call last):
  File hand2hand.py, line 1920, in module
main()
  File hand2hand.py, line 1916, in main
game.start_game()
  File hand2hand.py, line 511, in start_game
self.all.update(time_passed)
  File /usr/lib/python2.7/site-packages/pygame/sprite.py, line 399, in update
for s in self.sprites(): s.update(*args)
  File hand2hand.py, line 1789, in update
self.draw_rightarm()
  File hand2hand.py, line 1809, in draw_rightarm
img_a = pygame.surfarray.pixels_alpha(img)
  File /usr/lib/python2.7/site-packages/pygame/surfarray.py, line 208, in 
pixels_alpha
return numpysf.pixels_alpha (surface)
  File /usr/lib/python2.7/site-packages/pygame/_numpysurfarray.py, line 302, 
in pixels_alpha
offset=start, strides=(4, surface.get_pitch ()))
ValueError: strides is incompatible with shape of requested array and size of 
buffer

At any rate, I used cProfiler and copied the results to a text file. It looks 
like the draw_rightarm, draw_leftarm, and draw_body methods are the main cause 
for the slowdown in the update methods. Using some instances of print(), I have 
isolated the slowdown of these methods to the following piece of code, which 
occurs in all three:

# Adjust transparency
for row in xrange(0, len(img_a)):
for j in xrange(0, len(img_a[row])):
img_a[row][j] = int(img_a[row][j] * alpha_percent)

img_a is a pygame.surfarray.pixels_alpha object. Based on what I found in the 
documentation, this seemed like the most efficient and easy way to make an 
image 
with per-pixel alpha transparency partially transparent everywhere. But besides 
this slowdown problem that I'm having here, pixels_alpha seems to be causing 
other problems, as can be seen above. Is there a better way to do what I'm 
trying to do in that section of code? I was trying to create a motion trail 
effect.






From: Ian Mallett geometr...@gmail.com
To: pygame-users@seul.org
Sent: Tue, April 12, 2011 7:53:24 PM
Subject: Re: [pygame] Whoa! Bad slowdown!

Well, for one thing, on my machine, it segfaults constantly.  

I tracked it down to ~line 1006:
scaled = pygame.transform.smoothscale(img, size)
But there doesn't seem to be anything out of the ordinary there.  Maybe trying 
to resize many 1x1 surfaces to 400x400 leads to a memory leak somewhere in 
PyGame?

Ian


Re: [pygame] Using reStructuredText for document sources

2011-03-03 Thread Julian Marchant
 This is what I'm afraid of. I would be very disappointed if the
 existence of a wiki led people to believe that maintaining
 proper documentation was no longer required.

If I may jump in briefly, how exactly would this be a bad thing? If people feel 
that it's no longer required, that probably means that it really is no longer 
required. In this case, I doubt there is any advantage at all to having (in 
your 
terms) proper documentation.



  

Re: [pygame] loading images with special characters on file name

2011-02-08 Thread Julian Marchant
I doubt that this is related to your problem, but since you're using Python 3, 
shouldn't that shebang be #!/usr/bin/python3?





From: Rodolfo Neu rneu2...@gmail.com
To: pygame-users@seul.org
Sent: Tue, February 8, 2011 1:41:32 PM
Subject: [pygame] loading images with special characters on file name


Hi,
After installing Python 3.1.3, I have problems loading images whose file name 
contains special characters, like ã and ç
Pygame.image.load doesn't work even with:
#!/usr/bin/python
# -*- coding utf-8 -*-

Any help, please?


  

Re: [pygame] PyGame Windows Key Behaviour

2011-01-31 Thread Julian Marchant
What is this equal function that the AI uses, exactly? Does it use the same 
playerspeed variable?

It might also be possible that you have a rounding problem, especially if you 
aren't limiting the frame rate (which seems to be the case). This might, for 
example, make you move faster in one direction than the other. To avoid these 
issues, you can store an absolute decimal position, and then each step find 
an 
integer pixel position from that each step which can be used for 
calculations, 
drawing, etc in the game. Alternatively, you can abandon the approach you're 
using and just go at a constant frame rate, say 60 FPS, and then define pixels 
per frame speeds instead of pixels per second.





From: Thomas pummer.tho...@gmail.com
To: pygame-users@seul.org
Sent: Mon, January 31, 2011 6:22:46 AM
Subject: [pygame] PyGame Windows Key Behaviour

Hi there!

I've written a small demo pong game. There are 2 players, one is cpu
controlled. To sync there movement i use

clock = pygame.time.Clock()

and in the while loop:

milli = clock.tick()
seconds = milli/1000.

on checking the events it's:

if event.type == KEYDOWN:
if event.key == K_DOWN:
b_y += seconds * playerspeed

cpu changes his position with an equal function, until it reaches the
height of the ball

under winXP cpu and player can move with an equal speed
under win7 the player is significant slower than the cpu. it seems
that a player only can move 2/3 the distance than the cpu player is
able to

Do you have any hint's what can be done to fix this?

with kind regards
Thomas



  

Re: [pygame] Pygame for py3?

2011-01-17 Thread Julian Marchant
I can't figure out how to compile it for Python 3 (3.1, to be exact). Running 
setup.py with Python 3 does no good (if I don't supply an argument it crashes, 
and if I do it just re-installs Pygame to /usr/lib/python2.6), and I don't see 
any arguments for where to install, what Python version, whatever. Sorry if 
this 
sounds like a noobish question, but what do install and build do anyway? 
does install just do the same thing as build and copy the files to another 
directory, or is there a distinction? I'm fairly new to compiling things 
directly from source and install.html isn't helping me much.





From: René Dudfield ren...@gmail.com
To: pygame-users@seul.org
Sent: Sun, January 16, 2011 10:34:53 AM
Subject: Re: [pygame] Pygame for py3?

On Sun, Jan 16, 2011 at 2:33 PM, Julian Marchant onp...@yahoo.com wrote:
 I can see a Windows binary for Python 3.1 on the download page, but I don't
 see a source package for Python 3. Can the source be used for both Py2 and
 Py3?

yeah, same source.


 While I'm at it, why isn't there a Windows installer (or a Mac OS X package,
 for that matter) for Pygame for Python 2.7 listed on the download page?
 Python 2.6 is a bit outdated now.



we haven't gotten around to it yet.  There is a link to a 2.7 download
on an external binary providers web page for 2.7 though.

cheers,



  

[pygame] Pygame for py3?

2011-01-16 Thread Julian Marchant
I can see a Windows binary for Python 3.1 on the download page, but I don't see 
a source package for Python 3. Can the source be used for both Py2 and Py3?

While I'm at it, why isn't there a Windows installer (or a Mac OS X package, 
for 
that matter) for Pygame for Python 2.7 listed on the download page? Python 2.6 
is a bit outdated now.



  

[pygame] Surface blitting not effective

2010-10-09 Thread Julian Marchant
Attached is the file in question, comet_fighter.py (version 0.1.0.5).

Game.menu() is supposed to show a menu. It takes the following arguments:

options, cursor, anim_wait, color=pygame.Color(0,0,0,155), border=16, sep=8

options is a list of surfaces used for the menu choices. cursor is a list 
of 
surfaces which animate to create the selection cursor. anim_wait is the time 
(in milliseconds) between each frame of animation for the cursor. color is a 
pygame.Color object with an alpha value, which is used to set the color and 
alpha of the back of the dialog. border indicates the number of pixels around 
the menu box, and sep is the number of pixels between each menu choice.

The problem is, it doesn't seem to be working like it should.

I tried calling Game.menu() in order to test it. It sort of worked, but not 
really. There are a few issues.

First, the back of the menu is always fully opaque or fully transparent. 
Partial 
transparency isn't working.

Second, and more importantly, the menu choices aren't showing up.

Everything else seems to be working perfectly. I scanned my code at least 
twice, 
and I couldn't find anything wrong with it. Perhaps someone else can have 
better 
luck, or perhaps I'm doing something wrong?



  

comet_fighter-0.1.0.5.py
Description: Binary data


Re: [pygame] Creating sprites on the fly?

2010-04-12 Thread Julian Marchant
OK, thanks!

On Mon, Apr 12, 2010 at 8:58 PM, Lee Buckingham lee.bucking...@gmail.comwrote:

 sounds like the point would be to have something to display in lieu of
 files being in the wrong place or non-existent.

 You'd have to do something like:

 create a pygame.Surface
 do Surface.fill()... etc... or use line drawing or something to create the
 sprite
 remember it for later, then if you do a try-catch block around your image
 load, a fail could then assign the default sprite instead.


 On Mon, Apr 12, 2010 at 5:52 PM, NBarnes nbar...@gmail.com wrote:

 Julian Marchant onp...@gmail.com wrote:

  Hi, I'm somewhat new to Python and very new to Pygame, so please bear
 with
  me if I sound like an idiot.
 
  Is it possible to create sprites on-the-fly?
 
  In my load image function, I would like to add an option to create a
 simple
  back-up sprite (a black rectangle will suffice) on-the-fly if the
 requested
  sprite is unavailable, to allow the game to still run.

 Couldn't you just load a black rectangle at startup and use that in
 place of whatever sprite failed to load?





-- 
Website: http://onpon.co.nr/


Re: [pygame] Python 2.5.4 or 2.6

2010-03-25 Thread Julian Marchant
I'm wondering this, too. I'm only just starting to get into Python, but I do
know that Python 2 is better in the sense that Python 3 is not really
supported by a whole lot of things yet. But, isn't version 2.6 still better
than 2.5? I haven't ever heard of any incompatibilities or disadvantages for
2.6, and I haven't experienced any trouble using 2.6 on Windows.

Sounds to me like someone simply forgetting to update that text, but only
being a novice, I have no idea.

On Thu, Mar 25, 2010 at 1:41 PM, B W stabbingfin...@gmail.com wrote:

 Howdy.

 Pygame download page claims python2.5.4 is the best python on windows at
 the moment. This has been the status since I began with Python and Pygame
 about 1.5 years ago. While I appreciate suggestions that save me time and
 agony, it is my nature to always ask why. If the doc says take this pill, it
 will save your life--I gotta ask! Call it a compulsion.

 Why should I prefer Python 2.5.4 on Windows?

 Will Python 2.6 ever be crowned king? What factors are holding it back?

 Will Python 3 ever be crowned king? What factors are holding it back?

 I'm mostly interested in the opinions of the people who assess such things
 at a technology-readiness level, such as the Pygame maintainers and people
 who follow bug management and other objective indicators. Not particularly
 interested Gumm's personal experience is it works okay responses. :)

 Thanks in advance.

 Gumm




-- 
Website: http://onpon.co.nr/