Source code for yracing.weapon.rocket.logic

from math import pi
from yracing.weapon.weapon.logic import WeaponLogic, WeaponLogicNetwork
from yyagl.engine.vec import Vec


[docs]class RocketLogic(WeaponLogic): def __init__(self, mediator, car, cars, wpn_id): WeaponLogic.__init__(self, mediator, car, cars, wpn_id) self.tsk = None self.particle = None
[docs] def fire(self, sfx): WeaponLogic.fire(self, sfx) self.mediator.phys.fire() self.tsk = self.eng.do_later(10, self.mediator.destroy) self.particle = self.eng.particle(self.mediator.gfx.gfx_np, 'dust', (.9, .7, .2, .6), pi/20, .1, .001, 0, vel=3, part_duration=1.2)
[docs] def destroy(self): if self.particle: self.particle.destroy() if self.tsk: self.eng.rm_do_later(self.tsk) WeaponLogic.destroy(self)
[docs]class RocketLogicNetwork(WeaponLogicNetwork, RocketLogic): pass