comparison demos/shooter/scripts/weapons.py @ 470:3b04e921c93d

Added the fireball projectile. Added a new ship images for the boss. Some enemies now shoot directly at the player.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 14 Apr 2010 19:15:27 +0000
parents 4d0aa75a82f1
children 7a79dc2a0592
comparison
equal deleted inserted replaced
469:5994e61cdebd 470:3b04e921c93d
122 if (self._scene.time - self._lastfired) > self._firerate: 122 if (self._scene.time - self._lastfired) > self._firerate:
123 pjctl = Projectile(self._scene, self._ship, "bullet1", 6000 ) 123 pjctl = Projectile(self._scene, self._ship, "bullet1", 6000 )
124 pjctl.run(velocity, self._ship.location) 124 pjctl.run(velocity, self._ship.location)
125 self._lastfired = self._scene.time 125 self._lastfired = self._scene.time
126 self._scene.addProjectileToScene(pjctl) 126 self._scene.addProjectileToScene(pjctl)
127
128 127
128 class FireBall(Weapon):
129 def __init__(self, scene, ship, firerate):
130 super(FireBall, self).__init__(scene, ship, firerate)
131
132 #cannon's projectile velocity
133 self._projectileVelocity = 0.50
134
135
136 def fire(self, direction):
137 velocity = normalize(direction)
138 velocity.x = velocity.x * self._projectileVelocity
139 velocity.y = velocity.y * self._projectileVelocity
140
141 if (self._scene.time - self._lastfired) > self._firerate:
142 pjctl = Projectile(self._scene, self._ship, "fireball", 6000 )
143 pjctl.run(velocity, self._ship.location)
144 self._lastfired = self._scene.time
145 self._scene.addProjectileToScene(pjctl)
146