Beispiel #1
0
 def __init__(this, pos, aim, speed):
     '''initializes a missile projectile, used for the missileLauncher weapon'''
     projectile.__init__(this, True, pos, aim, speed)
     this.form = poly((10, 0), (-5, 5), (-5, -5))
     this.form.color = (255, 180, 0)
     this.form.thickness = 2
     this.life = 110
     this.lock = None
 def __init__(this, pos, power):
     '''initializes an item object'''
     this.pos = pos
     this.form = poly((10, 0), (7, 7), (0, 10), (-7, 7), (-10, 0), (-7, -7),
                      (0, -10), (7, -7))
     this.form.color = (0, 0, 255)
     this.form.scale = 1.5
     this.life = 600
     this.pow = power
     this.radius = 20
     this.powersprite = power
 def draw(this):
     '''draws the reticle for the rapid gun'''
     thick = 2
     col = (255, 230, 20)
     ret1 = poly((0, 0), (1, 0))
     tpos = transform((20, 10), (0, 0), GlobalVariables.p1.angle)
     ret1.pos = addPoints(tpos, GlobalVariables.p1.pos)
     ret1.thickness = thick
     ret1.color = col
     ret1.scale = this.ammo / 7
     ret1.angle = GlobalVariables.p1.angle
     ret2 = poly((0, 0), (1, 0))
     tpos = transform((20, -10), (0, 0), GlobalVariables.p1.angle)
     ret2.pos = addPoints(tpos, GlobalVariables.p1.pos)
     ret2.thickness = thick
     ret2.color = col
     ret2.scale = this.ammo / 7
     ret2.angle = GlobalVariables.p1.angle
     GlobalVariables.maincam.toDraw(ret1)
     GlobalVariables.maincam.toDraw(ret2)
 def __init__(this, pos):
     '''initializes an alien enemy'''
     enemy.__init__(this, pos)
     this.form = poly((5, 0), (3, 3), (0, 5), (-3, 5), (-4, 3), (-1, 2), (-6, 0), \
                      (-1, -2), (-4, -3), (-3, -5), (0, -5), (3, -3))
     this.form.scale = 2
     this.health = 1
     ang = direction(subtractPoints(GlobalVariables.p1.pos,
                                    this.pos)) + randRange(1, -1)
     this.vel = multPoint(xyComponent(ang), 2.5)
     this.firedelay = 60
 def buildForm(this):
     this.form = poly()
     verts = [ \
         (20, 0), (19, 1), (18, 1), (16, 3), (16, 5), (17, 6), (17, 7), (16, 7), (15, 6), (13, 6), (11, 8), (11, 9),
         (10, 10), (9, 9), (9, 8), (7, 6), (5, 6), (4, 7), (3, 7), (3, 6), (4, 5), (4, 3), (2, 1), (1, 1), (0, 0), \
         (1, -1), (2, -1), (4, -3), (4, -5), (3, -6), (3, -7), (4, -7), (5, -6), (7, -6), (9, -8), (9, -9),
         (10, -10), (11, -9), (11, -8), (13, -6), (15, -6), (16, -7), (17, -7), (17, -6), (16, -5), (16, -3),
         (18, -1), (19, -1) \
         ]
     for vert in verts:
         this.form.verts.append(subtractPoints(vert, (10, 0)))
def drawStars():
    '''draws the stars'''
    itr = 0
    for star in GlobalVariables.stars:
        pol = poly()
        pol.color = (140, 140, 140)
        pol.verts = [(0, 0)]
        pol.verts.append((0, 1))
        pol.pos = star
        pol.thickness = 2
        verts = GlobalVariables.maincam.renderPoly(pol)
        itr += 1
Beispiel #7
0
 def pDraw(this):
     itr = 0
     for field in this.matrix:
         if (field):
             anginc = math.pi * 2 * (itr / 6)
             tform = poly((30, -10), (30, 10), (30, 10))
             tform.angle = anginc
             tform.pos = GlobalVariables.p1.pos
             tform.color = (0, 0, 255)
             tform.thickness = 3
             GlobalVariables.maincam.toDraw(tform)
         itr += 1
 def draw(this):
     '''draws the player to the global cam query'''
     if (this.health == None):
         return
     this.drawPowers()
     this.curWep().draw()
     # outline
     pshape = poly()
     pshape.color = (0, 255, 0)
     pshape.verts = [(-10, 10), (-10, -10), (15, 0)]
     pshape.pos = this.pos
     pshape.angle = this.angle
     pshape.thickness = 2
     # fill
     fshape = poly()
     fshape.color = (0, 100, 0)
     fshape.verts = pshape.verts
     fshape.pos = pshape.pos
     fshape.angle = pshape.angle
     fshape.thickness = 0
     fshape.draw(GlobalVariables.maincam)
     pshape.draw(GlobalVariables.maincam)
 def fire(this, pos, aim, vel):
     '''releases 5 evenly spread projectiles'''
     this.ammo -= 1
     for i in range(5):
         spr = (i - 2) * 0.2
         proj = projectile(True, pos, aim + spr, 15)
         proj.life = 20
         proj.damage = 0.5
         proj.vel = addPoints(proj.vel, vel)
         proj.form = poly((0, -3), (0, 3))
         proj.form.color = (0, 200, 255)
         proj.form.thickness = 4
         GlobalVariables.projectiles.append(proj)
    def draw(this):
        '''draws the spreadgun reticle'''
        thick = 4
        col = (0, 100, 255)

        ret1 = poly((0, 0), (1, .6))
        tpos = transform((20, 10), (0, 0), GlobalVariables.p1.angle)
        ret1.pos = addPoints(tpos, GlobalVariables.p1.pos)
        ret1.thickness = thick
        ret1.color = col
        ret1.scale = this.ammo / 3
        ret1.angle = GlobalVariables.p1.angle
        ret2 = poly((0, 0), (1, -.6))
        tpos = transform((20, -10), (0, 0), GlobalVariables.p1.angle)
        ret2.pos = addPoints(tpos, GlobalVariables.p1.pos)
        ret2.thickness = thick
        ret2.color = col
        ret2.scale = this.ammo / 3
        ret2.angle = GlobalVariables.p1.angle

        GlobalVariables.maincam.toDraw(ret1)
        GlobalVariables.maincam.toDraw(ret2)
Beispiel #11
0
    def draw(this):
        '''draws the ion cannon's reticle'''
        thick = 3
        col = (0, 255, 255)

        ret1 = poly((0, 0), (1, 0))
        tpos = transform((20, 5), (0, 0), GlobalVariables.p1.angle)
        ret1.pos = addPoints(tpos, GlobalVariables.p1.pos)
        ret1.thickness = thick
        ret1.color = col
        ret1.scale = this.ammo / 10
        ret1.angle = GlobalVariables.p1.angle
        ret2 = poly((0, 0), (1, 0))
        tpos = transform((20, -5), (0, 0), GlobalVariables.p1.angle)
        ret2.pos = addPoints(tpos, GlobalVariables.p1.pos)
        ret2.thickness = thick
        ret2.color = col
        ret2.scale = this.ammo / 10
        ret2.angle = GlobalVariables.p1.angle

        GlobalVariables.maincam.toDraw(ret1)
        GlobalVariables.maincam.toDraw(ret2)
Beispiel #12
0
 def pDraw(this):
     ang = GlobalVariables.p1.angle + math.pi / 2
     for i in range(3):
         tpos = xyComponent(ang)
         tpos = multPoint(tpos, 30)
         tpos = addPoints(tpos, GlobalVariables.p1.pos)
         tform = poly((0, 0), (1, 0), (0, 0))
         tform.scale = this.life / 30
         tform.pos = tpos
         tform.angle = ang
         tform.color = (255, 255, 0)
         tform.thickness = 2
         GlobalVariables.maincam.toDraw(tform)
         ang += math.pi / 2
 def draw(this):
     # draws the reticle of the missileLauncher
     col = (255, 100, 0)
     verts1 = [(0, 0), (0, 1), (2, 0)]
     verts2 = [(0, 0), (0, -1), (2, 0)]
     ret1 = poly()
     tpos = transform((20, 10), (0, 0), GlobalVariables.p1.angle)
     ret1.pos = addPoints(tpos, GlobalVariables.p1.pos)
     ret1.angle = GlobalVariables.p1.angle
     ret1.verts = verts1
     ret1.scale = 7 * (this.ammo / 45)
     ret1.thickness = 3
     ret1.color = col
     ret2 = poly()
     tpos = transform((20, -10), (0, 0), GlobalVariables.p1.angle)
     ret2.pos = addPoints(tpos, GlobalVariables.p1.pos)
     ret2.angle = GlobalVariables.p1.angle
     ret2.verts = verts2
     ret2.scale = 7 * (this.ammo / 45)
     ret2.thickness = 3
     ret2.color = col
     GlobalVariables.maincam.toDraw(ret2)
     GlobalVariables.maincam.toDraw(ret1)
Beispiel #14
0
 def draw(this):
     '''adds the projectile to the main drawQuery'''
     if (this.form == None):
         # creates a temporary form to render if it has no previously defined form
         tform = poly()
         tform.color = this.color
         tform.thickness = this.thickness
         tform.verts = [
             (0, 0),
             (distance(subtractPoints(this.vel, GlobalVariables.p1.vel)), 0)
         ]
         tform.pos = this.pos
         tform.angle = direction(
             subtractPoints(this.vel, GlobalVariables.p1.vel))
         GlobalVariables.maincam.toDraw(tform)
         return
     this.form.pos = this.pos
     this.form.angle = direction(this.vel)
     GlobalVariables.maincam.toDraw(this.form)
Beispiel #15
0
 def __init__(this, pos):
     enemy.__init__(this, pos)
     this.form = poly((5, 0), (3, 3), (0, 5), (-5, 4), (-2, 0), (-5, -4),
                      (0, -5), (3, -3))
     this.form.scale = 3
     this.health = 6
Beispiel #16
0
 def __init__(this, pos, aim, speed):
     '''initializes an enemy bullet instance, used by alien objects to fire at the player'''
     projectile.__init__(this, False, pos, aim, speed)
     this.form = poly((3, 0), (0, 3), (-5, 0), (0, -3))