Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.su/trac/tanchiki/browser/tanchiki/body.py?rev=26%3Af0ff33fb578f
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Tue Apr 12 01:23:44 2016
Êîäèðîâêà: IBM-866
body.py in tanchiki òÀÓ Tanchiki

source: tanchiki/body.py @ 25:54871be350eb

Revision 25:54871be350eb, 750 bytes checked in by Peter Zotov <whitequark@òÀæ>, 5 years ago (diff)

More fixes to body.

Lineˆà
1#coding:utf-8
2
3importˆàvector
4importˆàmath
5
6classˆàBody(object):
7ˆà ˆà ˆà ˆà defˆà__init__(self,ˆàposition,ˆàvelocity =ˆàvector.Vector.null):
8ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.position =ˆàposition
9ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.velocity =ˆàvelocity
10
11classˆàTank(Body):
12ˆà ˆà ˆà ˆà radius =ˆà1
13ˆà ˆà ˆà ˆà model =ˆà"tank"
14
15ˆà ˆà ˆà ˆà defˆà__init__(self,ˆàposition,ˆàcontroller):
16ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà Body.__init__(self,ˆàposition)
17ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.controller =ˆàcontroller
18ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.turret =ˆàvector.Vector()
19ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.strength =ˆà0
20
21ˆà ˆà ˆà ˆà defˆàrotate_base(tank,ˆàangle):ˆà
22ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.velocity.phi +=ˆàangle
23
24ˆà ˆà ˆà ˆà defˆàrotate_turret(self,ˆàangle):
25ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.turret.phi +=ˆàangle
26
27ˆà ˆà ˆà ˆà defˆàaccelerate(self,ˆàspeed_delta):
28ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.velocity.rho +=ˆàspeed_delta *ˆàdelta_t
29ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà ifˆàself.velocity.rho >ˆàmax_velocity :
30ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà self.velocity.rho =ˆàmax_velocity
31
32ˆà ˆà ˆà ˆà defˆàfire(self):
33ˆà ˆà ˆà ˆà ˆà ˆà ˆà ˆà pass
34
35classˆàBullet(Body):
36ˆà ˆà ˆà ˆà radius =ˆà0.1
37ˆà ˆà ˆà ˆà model =ˆà"bullet"
38
39ˆà ˆà ˆà ˆà pass
Note: See TracBrowser for help on using the repository browser.