def on_tank_purchase(self, emitter): print("tank purchased") tank = Sprite(Constants.Paths.Units.tankGreen) self.state.player1.tanks.append(tank) self.add(tank) tank.position = random.randint(tank.width / 2, 300), 190 + tank.height / 2 tank.velocity = (100.0, 0.0) tank.gasoline = random.randint(0, 1280)
def shootBullet(self): if gVariables.g_IS_FX: SFX(self.R._SFX[0]) bullet = Sprite(self.R._BULLET[gVariables.g_PlayerIndex]) bullet.position = (self.PLAYER.position[0] + bullet.width / 2, self.PLAYER.position[1]) bullet.cshape = CollisionModel.AARectShape(bullet.position, bullet.width / 2, bullet.height / 2) bullet.scale = 0.8 bullet.velocity = (self.bullet_speed, 0) bullet.do(Move()) self.bullet_Lists.add(bullet) self.collisionManager.add(bullet) self.batch.add(bullet, self.bulletZ)