Example #1
0
 def __init__(self, shooter, game_obj, range=500, damage=20, *args, **kwargs):
     GameObject.__init__(self, *args, **kwargs)
     self.range = range
     self.damage = damage
     self.shooter = shooter
     self.game_obj = game_obj
     self.push_forward(self.max_vel)
     self.start_loc = self.loc 
Example #2
0
 def get_data(self):
     d = GameObject.get_data(self)
     d['shooter_id'] = self.shooter.id
     return d 
Example #3
0
 def update(self, delta, relative_obj):
     GameObject.update(self, delta, relative_obj)
     if self.loc.sub(self.start_loc).magnitude() > self.range:
         self.game_obj.remove_obj(self)
Example #4
0
 def __init__(self, game_obj, source):
     GameObject.__init__(self, source=source)
     self.game_obj = game_obj
Example #5
0
 def set_data(self, data):
     GameObject.set_data(self, data)
     if 'health' in data:
         self.health = data['health'] 
Example #6
0
 def get_data(self):
     d = GameObject.get_data(self)
     d['health'] = self.health
     return d
Example #7
0
 def update(self, delta, relative_obj):
     GameObject.update(self, delta, relative_obj)
     if self.controls['thrust'] == 1: self.push_forward()
     if self.controls['turn_right'] == 1: self.turn_right()
     if self.controls['turn_left'] == 1: self.turn_left()
     if self.controls['attack'] == 1: self.shoot() 
Example #8
0
 def __init__(self, game_obj, controls=None):
     GameObject.__init__(self, source=game_obj.image_map['player'])
     self.image_map = game_obj.image_map
     self.game_obj = game_obj
     if controls: self.controls.update(controls)