RE: [pygame] This is why your ball vibrates

2007-12-03 Thread Boer Kees
The solution: :) see my previous post for some code. the problem was twofold: check somehow, if the ball moves SOO slightly, it is to be considered dead. BUT! there also was a major flaw in the way the ball bounced back up: the speed was assumed to INCREASE all the way, even AFTER the dir

RE: [pygame] Why does my ball vibrate?

2007-12-03 Thread Boer Kees
#ok, I think I have it broken down into pieces now... check out this code: # import sys, pygame, mathpygame.init()pixelspercm=10.0gravity=9.80 * 10.0 # meter per second per second (juiced up a little :) )framerate=50.0 # per secondlossperbounce=0.33 # lose energy per bounceframestosilence=3

RE: [pygame] Bouncing ball - separating the physics from the frame rate

2007-12-03 Thread Boer Kees
ok, I had this problem once, a while ago, simulating bouncing rigid balls. lost the code... The best I think you can do, is, in pseudo code: mainloop: -get the current time in ms -calculate the new position of the ball -take speed of ball, take direction of ball, calculate the imaginary e

[pygame] centered screen position using SDL_VIDEO_CENTERED

2007-11-01 Thread Boer Kees
#!/usr/bin/env python import pygame from pygame.locals import * #center screen import os #os.environ["SDL_VIDEO_CENTERED"] = "1" ## (UN)COMMENT TO SEE EFFECT # WITH os.environ["SDL_VIDEO_CENTERED"] = "1" : #when maximized: window does not make it to the top -> half of the taskbars height?? #w

[pygame] screen position in middle of desk / icon with alpha - using wx to load pygame

2007-10-31 Thread Boer Kees
This example is just to show: yes. you CAN put a pygame display in the middle of your screen (on windows only, i guess?) and have a transparancy key in your icon bitmap. Something that bothered me for a long time :) yes, I know wx is no good. If any one knows a better way, please share! (I use