Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.ru/trac/tanchiki/browser/body.py?rev=10%3Ae14e6cf3e9d3&format=txt
Дата изменения: Sat Dec 18 16:20:36 2010
Дата индексирования: Fri Feb 11 20:10:15 2011
Кодировка:
import vector
import math
delta_phi = math.pi # deltha phi = math.pi
speed_delta = 1
delta_t = 1
max_velocity = 2

class Body(object):
def __init__(self, position, velocity, next_position, radius):
self.position = position
self.velocity = velocity
self.next_position = next_position
self.radius = radius


class Tank(Body):
radius = 1
def __init__(self, strength, turret, base_orientation, game, user):
Body.__init__(self, ...)
self.strength = strength
self.turret = turret
self.base_orientation = base_orientation # 1 or -1
self.game = game
self.user = user


# def rotate_base(tank, angle):
# self.velocity.phi += angle
# self.velocity.phi *= self.base_orientation

def rotate_turret(self, angle):
pass

def accelerate(self, speed_delta):
self.velocity.rho += speed_delta * delta_t
if self.velocity.rho > max_velocity:
self.velocity.rho = max_velocity

def fire(self):
pass

def on_tick(self,other_tanks, bullets):
if self.user.base_left == True:
self.rotate_base(delta_phi)
if self.user.base_right == True:
self.rotate_base(-1*delta_phi)
if self.user.accelerate == True:
self.accelerate(speed_delta)

def on_spawn(self):
pass

def on_death(self) :
pass

def on_hit(self,bullet):
pass

def on_collision(self):
pass

def on_wall(self):
pass

class Bullet(Body):
radius = 0.1
pass