Re: [pygame] Rocket + Bike = Physics

2009-01-08 Thread Ken Seehart

Ian Mallett wrote:

...
F = MA says that we'll accelerate at approximately 0.77 G (darn was 
hoping for something more) But:
After 253 seconds, we'll be traveling at about 1.9 kilometers/second = 
5.6 mach, or fast enough to cross the continental US in about 35 
minutes. 
...
I don't have time to check the math, but I don't see how 0.77G can be 
correct.  The Atlas V must yield sufficient force to give an 
acceleration greater than 1G, otherwise it would not be a very effective 
rocket for the usual vertical operating mode.


Ken



Re: [pygame] py2exe problems

2008-03-16 Thread Ken Seehart

Ian Mallett wrote:

New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It 
says something about not being able to find the surfarray module when 
the .exe is run, but it closes almost instantly, so I can't really 
tell.  I upgraded to pygame 1.8, if that makes a difference.

Ian
Did you try running your exe in a shell?  That way you might get to see 
the error message.

Ken



Re: [pygame] Why does my ball vibrate?

2007-12-06 Thread Ken Seehart

Ian Mallett wrote:
On Dec 5, 2007 4:03 PM, Greg Ewing <[EMAIL PROTECTED] 
> wrote:


Actually, it does -- a photon is an example of an object
with no mass. Such an object always travels at the speed
of light -- it doesn't even need a push to get it going.
It's fundamentally incapable of standing still. 


Heh heh.  Try hitting that with a paddle.

While it has no mass, it does have both energy and
momentum, both of which are proportional to its frequency.

Momentum is defined as mass*velocity.  If mass is zero, how does a 
photon have momentum?
When a physicists say that a photon has zero mass, what they generally 
mean is that photons have zero /rest mass/ (a rather hypothetical notion 
since a photon can't be at rest).  A photon that is moving (the only 
kind of photon there is) has a mass of *h/c**?*.  Since particles have 
ever increasing mass as their velocity increases, approaching infinity 
as velocity approaches *c*.  You can loosely imagine a photon as having 
it's rest mass multiplied by infinity, which would be m = 0*?, which 
doesn't help us much.  The actual equations are:


Energy of a photon is inversely proportional to wavelength* **?*, thats: 
*E = hc/?*, where *h* is Planck's  constant
We also have *E = mc^2*, so dividing both sides by *c^2*, we get mass:  
*m = h/c**?*
Momentum is *p = mv = hv/**c**? = h/? *(because *v=c* since it is a 
photon)



These are conserved in any collision, so when it
bounces off a wall, the wall gains some momentum, just
as it would if a massive particle with the same
momentum bounced off it. And if the wall starts to
move as a result, then it has also gained some energy,
which must have come from the photon, so the reflected
photon must be red-shifted slightly (longer wavelength
= lower frequency = less energy). 

All this is true, but /how/ exactly does a massless particle have 
momentum?


--
Greg

Ian 




Re: [pygame] Free chapter of my book

2007-10-12 Thread Ken Seehart

Will McGugan wrote:

Horst JENS wrote:

I think that either the comment should say "in 10 frames"
or the randint statement should be randint(1,10).



correction:

or the ranint statement should be randint(1,20)

  

Ack! Well spotted. Never hard code values in to comments!

Will
A former employee where I work once said that it's better not to comment 
at all because all comments are fundamentally redundant and might become 
inconsistent with the code.  He proceeded to remove all comments.  
Naturally, he was a perl programmer :-)


Ken



Re: [pygame] Starting Window Position -- oops ignore duplicate post

2007-06-27 Thread Ken Seehart

Doh! Sorry about the duplicate post...

Ken Seehart wrote:

Hi,
When one starts a pygame window in windowed mode, the window pops up 
in an unpredictable place on the screen.  How do you set it to be at a 
certain place?

Thanks
Ian M.








[pygame] Starting Window Position

2007-06-27 Thread Ken Seehart

Hi,
When one starts a pygame window in windowed mode, the window pops up in 
an unpredictable place on the screen.  How do you set it to be at a 
certain place?

Thanks
Ian M.





Re: [pygame] pygame is a disgrace

2007-02-15 Thread Ken Seehart

Thank you for bringing this to our attention.  Clearly, the python
community needs a much superior game library, and clearly you
must be capable of developing such a library or you probably
would not have written that message.  We look forward to seeing
your new library, which is certain to become the new standard
for game development in python once everyone realizes how
awesome it is.  It is most unfortunate that the name "PyGame"
has been taken, but I'm sure you are a very creative person
capable of coming up with an even better name.

- Ken Seehart

Jer Juke wrote:

Yeah, you heard me. Normally I wouldn't feel any need
to pick out some random library and state how awful I
think it is. But this is not "some random library". It
is the "standard" game library for a most beautiful
language known far and wide for it's power and easy of
use, both when it comes to the language itself and
it's libraries.

The fact that Python is generally blessed with truly
magnificent libraries everywhere is what makes Pygame
stand so out. Pygame is in absolutely no way
magnificent or even slightly pythonic. It's just a
goddamn SDL wrapper.  Using the name Pygame for this
abhorrent library is an atrocity. It should be called
PySDL, and make it more obvious to the python
community that Pygame is yet to be properly created.

But that's not the worst part. PySDL (what you all
call Pygame) is actually a very useful library. It
does what it does QUITE WELL! It's perfect for
creating higher level libraries. BUT PYGAME DOESN'T
EVEN MANAGE TO BE PYGAME. Yes, I am talking about the
fact that even half a year after the official Python
2.5 came out, Pygame still does not EXIST FOR THIS
PLATFORM. I can sympathize with taking a month to
compile some new binaries. Developers do after all
have other things to do. Even a couple of months is
acceptable. But SERIOUSLY, a team of people that
maintain THE STANDARD F*CKING GAME PACKAGE USED BY A
GAZILLION OTHER PYTHON PROJECTS but can't make one
required update in the time-span of ONE HALF YEAR is a
disgrace. No one cares if you are in the process of
adding all sorts of awesome new crap to Pygame. Do you
guys even have any idea how many python modules use
Pygame for one reason or another? Until you actually
have Pygame 1.8, COMPILE A GODDAMN 2.5 VERSION FOR THE
OLD PYGAME!!

How about some honesty? How about replacing "we needed
an extra few weeks" on the pygame site with "we are
not able to adequately maintain this package. new
maintainers needed"?

I know whoever maintains pygame aren't "paid". They
don't "owe" anyone anything. But in my opinion, these
people are a disgrace and a detriment to python game
development efforts on the whole.



 


Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091



  






Re: [pygame] Rotating Images on a specified axis.

2006-12-28 Thread Ken Seehart

Caleb Mahase wrote:
I am already using the rotate function. From what I understand, 
rotozoom distorts the image.

Patrick Mullen wrote:
Rotate will distort the image as well, unless you rotate in 90 degree 
increments.  Make sure to always rotate based on the source, and not 
off of previous frames of the rotation.  Rotate is unfiltered, and 
won't look as good as rotozoom; rotozoom is slower I believe.
Also, note that rotozoom will cause less distortion than either scaling 
followed by rotation or rotation followed by scaling.  For best visual 
results, if speed is not a major concern, start with a source image with 
twice the resolution that you actually need, then rotozoom it to the 
size and orientation you want.  As Patrick mentions, you must do your 
rotozoom from a source image rather than accumulating rotations, since 
each rotozoom will add more distortion.


Another thing to keep in mind is that rotation will cause the size of 
the rectangle to change, as well as the position of the center of 
rotation relative to the upper-left corner for reasons that should be 
geometrically obvious.  If you do a little geometry on a piece of paper, 
you can figure out the correction for this.


- Ken Seehart




Re: [pygame] Negative number positive

2006-12-26 Thread Ken Seehart
If you want something that converts negative numbers to positive 
numbers, but leaves positive number alone, use the *abs()* function.


a = abs(b)

If you want something that has the effect of multiplying by -1, just use 
the - operator.


a = -b

Ken Seehart

Farai Aschwanden wrote:

Hello

Erm, not a Pygame 1.8 question but just cant find the the needed 
function: I would like to make a negative number to a positive number, 
like -5 -> 5


Quite easy, just cant find the Python function (if there is one). Sure 
I could multiply the negative value by -1 but I would prefer using the 
convention function. Is there one and what is it called?


Thanks in advance
Farai







[pygame] Anyone using PyMedia?

2006-12-25 Thread Ken Seehart
I'm trying to use PyMedia.  All I need is to process a sequence of video 
frames as strings in 24 or 32 bit (RGB or RGBX) format.  It was pretty 
easy to do with pygame.movie, but my program needs to run on windows, 
and pygame.movie doesn't work on windows any more.


Unfortunately, PyMedia is not nearly as easy as pygame.movie to use.  
Has anyone had any luck with it?


- Ken




Re: [pygame] PyOpenGL and win32screensaver

2006-12-24 Thread Ken Seehart


Thanks Luke, it works great.

Luke Paireepinart wrote:





What kind of side effect should I expect from the OPENGL flag?  Any 
ideas/workarounds?


Happy Everything,

Thanks, Ken!

Okay, you asked for a workaround :)

Don't use win32screensaver!

If you just create a py2exe of your program, rename it to .scr, and 
put it in the right folder, it will work as the screensaver.

Now, you won't get to create a cool demo in the preview window.
Whenever your program's run, Windows will pass it arguments.  SO when 
it's passed the -p, or whatever the 'preview' argument is,

just do nothing.

This should eliminate all conflicts, and you don't have to do any 
weird hardcoding of values!


However, as I said, no preview.  Also, it doesn't pack everything into 
a single EXE. Well, that's why it's called a workaround!
By the way, does win32screensaver create a single file?  I don't 
really want to take the time to check, so if you could just answer 
that for me it would be nice.


Also, remember you have to handle the inputs yourself.
I don't know if win32 screensaver exits on mousemovements or whatever, 
but your program won't if you just py2exe it.

You'll have to check for mousemotion events, or keypresses, and whatnot.

Anyway, HTH,
-Luke







[pygame] PyOpenGL and win32screensaver

2006-12-21 Thread Ken Seehart
I am trying to get a 3D screensaver to work using PyGame, PyOpenGL and 
win32screensaver.  There seems to be an incompatibility that I haven't 
been able to resolve.


Since win32screensaver invokes a special instance of pygame, I know I 
can't import pygame myself or use pygame.display.set_mode without 
extreme care.  So I tried changing win32screensaver to have a 
configurable video_flags parameter.


So pyscr_pygame.py[86] has:
  self.window = self.pygame.display.set_mode((self.width, self.height), 
self.video_flags)


Now I set video_flags to 0x4002 (that's OPENGL|DOUBLEBUF, but of 
course I can't import pygame, so for now I just hard code it, until I 
get something working).  Apparently the OPENGL flag is killing it.  If I 
use the OPENGL flag, the process hangs during initialization (before the 
first draw is attempted).


What kind of side effect should I expect from the OPENGL flag?  Any 
ideas/workarounds?


Should I try taking PyGame out of the loop?  Neither PyOpenGL and 
win32screensaver actually require PyGame, but PyGame seems like it 
should be a convenient glue between the two.  Besides,  I have be able 
to make my PyOpenGL content work under PyGame, and I have successfully 
used win32screensaver with Pygame (without PyOpenGL).  It would be nice 
to be able to do both at the same time.


Happy Everything,
- Ken Seehart