PyGame
Python programming with PyGame
Keep this under your pillow
Game Media
Sounds
- SFXR en zie ook de andere projecten van DrPetter
- BFXR als SFXR maar dan online!
- Freesound.org
- Free Sound Effect Archive
Music
Zowel VLC als Pygame speelt alle klassieke Amiga-formaten, zoals MOD, S3M en XM !
Image
Documentatie
- A Guide to Programming Asteroids as a Java Applet [PDF]
- (Wikipedia) Asteroids (video game)
- Rice rocks met ballen met elastische botsing
- Youtube : Java Game Programming Tutorial part 1
Elastic collision
Fragment uit Rice rocks met ballen met elastische botsing
if len(pong.balls) > 1: founded = False for ball in pong.balls: if founded: if self.touch(ball): # Elastic collision (with radius as mass) sound_balls_collision.play() sum = self.radius + ball.radius diff = self.radius - ball.radius double = 2*ball.radius new_x = float(diff*self.vel.x + double*ball.vel.x)/sum new_y = float(diff*self.vel.y + double*ball.vel.y)/sum double = 2*self.radius ball.vel.x = float(double*self.vel.x - diff*ball.vel.x)/sum ball.vel.y = float(double*self.vel.y - diff*ball.vel.y)/sum self.vel.x = new_x self.vel.y = new_y elif self.same_pos(ball): founded = True