view game.py @ 8:4f578d001608
Game.collides and Game.handle_collision are now methods of game, not hidden functions
author |
Daniil Alexeyevsky <me.dendik@gmail.com> |
date |
Sat, 18 Dec 2010 16:09:05 +0300 |
parents |
af02cd410e37 |
children |
43f5b82f3491 c71c27b09bc7 |
line source
5 def __init__(self, bodies, users, width, height):
13 game.check_collisions()
15 game.update_positions()
19 def next_positions(game):
22 i.next_position = i.position + i.velocity*(delta_t)
25 def check_collisions(game):
28 def collides(self,body1,body2):
31 def handle_collision(self,body1,body2):
34 def check_walls(game):
35 for i in game.bodies :
36 if ((i.next_position.x - i.radius) <= 0) or ((i.next_position.y - i.radius) <= 0) or ((i.next_position.x + i.radius) >= game.width) or ((i.next_position.y + i.radius) >= game.height) :
40 def update_positions(game):
42 i.position = i.next_position
44 def invoke_ticks(game):
46 i.tank.on_tick(other_tanks,bullets)
50 if i.tank.strength == 0 :