@@ -242,16 +242,29 @@ def getPosition(self):
242
242
r = self .boundingRect ()
243
243
return QtCore .QPointF (p .x () + r .width ()/ 2 , p .y ()+ r .height ()/ 2 )
244
244
245
+ def getGunHeading (self ):
246
+ return self .gun .rotation ()
247
+
248
+ def getHeading (self ):
249
+ return self .gun .rotation ()
250
+
251
+ def getRadarHeading (self ):
252
+ return self .gun .rotation ()
253
+
245
254
def reset (self ):
246
255
self .physics .reset ()
247
256
248
- def getNbrOfEnemiesLeft (self ):
257
+ def getEnemiesLeft (self ):
249
258
return len (self .parent .aliveBots )
250
259
251
260
def rPrint (self , msg ):
252
261
self .info .out .add (str (msg ))
253
262
254
-
263
+ def pause (self , duration ):
264
+ self .stop ()
265
+ for i in range (int (duration )):
266
+ self .physics .move .append (0 )
267
+ self .stop ()
255
268
###end of functions accessable from robot###
256
269
257
270
# Calculus
@@ -289,6 +302,7 @@ def wallRebound(self, item):
289
302
y = - self .physics .step * 1.1
290
303
self .setPos (self .pos ().x () + x , self .pos ().y () + y )
291
304
self .changeHealth (self , - 1 )
305
+ self .onHitWall ()
292
306
293
307
294
308
def robotRebound (self , robot ):
@@ -307,6 +321,7 @@ def robotRebound(self, robot):
307
321
robot .setPos (x + dx , y + dy )
308
322
self .changeHealth (robot , - 1 )
309
323
self .changeHealth (self , - 1 )
324
+ self .onRobotHit (id (robot ))
310
325
311
326
def bulletRebound (self , bullet ):
312
327
self .changeHealth (self , - bullet .power )
@@ -330,7 +345,7 @@ def death(self):
330
345
self .parent .aliveBots .remove (self )
331
346
self .onRobotDeath ()
332
347
self .parent .removeItem (self )
333
-
348
+ print len ( self . parent . aliveBots )
334
349
if len (self .parent .aliveBots ) <= 1 :
335
350
self .parent .battleFinished ()
336
351
0 commit comments