Exemplo n.º 1
0
 def setLevel(self, lvl):#sets level, uses math
     self.level = lvl
     self.damage = self.baseDamage + (self.baseDamage * (self.level // 10))#gets the new damage
     self.expToLevel = 50 * 2**(lvl-1)#uses the explicit geometric equation to find the new exp
     self.exp = 0
     self.maxHealth = 100 + (lvl-1)*20#uses the explicit arithmetic equation to find the new max health
     self.health = self.maxHealth
     ParticleEngine.createPoint(10,self.x,self.y,(-10,10),(-10,10),(0,100,255),'Circle Rand',grav = True)#blue circles of fun are diployed
     if self.ID == self.over.obj.ID:#if the self.overlay character is this character
         self.over.addToQue('You have reached level '+str(lvl)+'!')#say good job
Exemplo n.º 2
0
def fireBlast (mage,target = None):#this function shoots a fireball, mage is a character that shoots the spell and target the targeted character
    damage = 20#base damage is 20
    damage = damage + (damage * (mage.level // 10))#modifies the damge according to the mage's level
    mage.armLeft.setRotation(90, -mage.attackSpeed)#rotates the mage's arm

    if mage.faceRight == False:#x range is the x speed
        xRange = -20
    else:
        xRange = 20
    
    mage.shootProject(0,(xRange, 0),damage,mage)#shoots a projectile
    ParticleEngine.createPoint(10,mage.x,mage.y,(-10,10),(-10,10),(255,100,0),'Circle Rand',grav = True)#create an explosion of particles
    return damage#returns the damage done
Exemplo n.º 3
0
    def takeDamage(self,amount,attacker = None, distance=10, flashes=2):#take a certain amount of damage
        if self.invincible == False:

            self.jump()
            self.addSpeed(distance, breakLimit=True)
            self.health -= amount
            self.over.updateHealthbar()
            ParticleEngine.createPoint(50, self.x, self.y, (-10,10), (-10,10), (255,0,0), 'Line', grav=True)#create a blood explosion
            self.control = False

            if self.player == True:
                self.flashes = 5#longer flashing for players
            
            self.invincible = True
            self.flashAmount = flashes
Exemplo n.º 4
0
 def testShotHit(shot):
     p = Environment.Environment.sun
     x, y, z = shot.pos.Pos()
     sp = Vex(x, y)
     dmg = shot.damage / 100.0
     d = p.pos.dist2D(sp)
     if d <= Sun.minRad:
         ParticleEngine.Emitter(Vex(x, y), shot.angle_rad, 2)
         p.corHealth -= dmg * 10
         if p.corHealth <= 0:
             # destroy sun, destroy planets, generate random asteroids
             pass
         return True
     return False
Exemplo n.º 5
0
    def takeDamage(self,
                   amount,
                   attacker=None,
                   distance=10,
                   flashes=2):  #take a certain amount of damage
        if self.invincible == False:

            self.jump()
            self.addSpeed(distance, breakLimit=True)
            self.health -= amount
            self.over.updateHealthbar()
            ParticleEngine.createPoint(50,
                                       self.x,
                                       self.y, (-10, 10), (-10, 10),
                                       (255, 0, 0),
                                       'Line',
                                       grav=True)  #create a blood explosion
            self.control = False

            if self.player == True:
                self.flashes = 5  #longer flashing for players

            self.invincible = True
            self.flashAmount = flashes
Exemplo n.º 6
0
    def testShotHit(shot):
        x, y, z = shot.pos.Pos()
        lx, ly, lz = shot.lpos.Pos()
        sp = Vex(x, y)
        #        lsp = Vex(lx, ly)
        dmg = shot.damage
        for p in Asteroid.asteroids:
            d = p.pos.dist2D(sp)
            if d < 2:
                ParticleEngine.Emitter(p.pos, shot.angle_rad, 2, 50, Vex(0, 0),
                                       False, 25)
                p.corHealth -= dmg
                if p.corHealth <= 0:
                    ParticleEngine.Emitter(p.pos, shot.angle_rad, 1, 50,
                                           Vex(0, 0), False, 50)
                    p.corHealth = 150
                    d = p.pos.dist2D(p.parent.pos)
                    delt = p.parent.pos - p.pos
                    a1 = math.degrees(math.atan2(delt.y(), delt.x()))
                    ra = math.radians(-a1 + 90 + p.speed + 180)
                    dp = Vex(math.sin(ra) * d, math.cos(ra) * d)
                    np = p.parent.pos - dp
                    p.pos.assign(np)
                return True

        for p in Asteroid.tempAsteroids:
            d = p.pos.dist2D(sp)
            if d < 2:
                ParticleEngine.Emitter(p.pos, shot.angle_rad, 2)
                p.corHealth -= dmg
                if p.corHealth <= 0:
                    ParticleEngine.Emitter(p.pos, shot.angle_rad, 1, 10,
                                           Vex(0, 0), False, 1)
                    Asteroid.tempAsteroids.remove(p)
                return True
        return False
Exemplo n.º 7
0
    bottomRow = worldBack.size[1]//32#finds bottom row

    def displayFPS(font):#displays the frames per second
        fps = int(clock.get_fps())#gets fps
        fpsFont = font.render(str(fps), 1, (250, 250, 250))#font renders it
        fpsPos = fpsFont.get_rect()
        fpsPos.centerx = 50
        fpsPos.centery = 50
        screen.blit(fpsFont,fpsPos)

    def setNight():#sets time to night, unused
        background.fill((0,0,0))
        worldBack.baseLightLevel = 0
        worldBack.lighting.lightSection(0,worldBack.columns,0,worldBack.rows)

    ParticleEngine.setGravity(True)#turns on particle engine gravity
    projectiles = []#makes empty list of projectiles

    over.updateHealthbar()#update the healthbar
    #player.changeWeapon(weapons[0])#gives player a weapon
    player.inv.addToInventory(1,1)
    player.inv.addToInventory(3,1)
    player.inv.addToInventory(5,1)
    player.inv.addToInventory(0,80)
    player.inv.addToInventory(2,80)
    player.inv.addToInventory(10,1)
    player.inv.addToInventory(8,80)

    toFocus = 0#unused, kinda
    mouseInv = (None,None)
    clickDel = 0.5
Exemplo n.º 8
0
    bottomRow = worldBack.size[1] // 32  # finds bottom row

    def displayFPS(font):  # displays the frames per second
        fps = int(clock.get_fps())  # gets fps
        fpsFont = font.render(str(fps), 1, (250, 250, 250))  # font renders it
        fpsPos = fpsFont.get_rect()
        fpsPos.centerx = 50
        fpsPos.centery = 50
        screen.blit(fpsFont, fpsPos)

    def setNight():  # sets time to night, unused
        background.fill((0, 0, 0))
        worldBack.baseLightLevel = 0
        worldBack.lighting.lightSection(0, worldBack.columns, 0, worldBack.rows)

    ParticleEngine.setGravity(True)  # turns on particle engine gravity
    projectiles = []  # makes empty list of projectiles

    over.updateHealthbar()  # update the healthbar
    # player.changeWeapon(weapons[0])#gives player a weapon
    player.inv.addToInventory(1, 1)
    player.inv.addToInventory(3, 1)
    player.inv.addToInventory(5, 1)
    player.inv.addToInventory(0, 80)
    player.inv.addToInventory(2, 80)
    player.inv.addToInventory(10, 1)
    player.inv.addToInventory(8, 80)

    toFocus = 0  # unused, kinda
    mouseInv = (None, None)
    clickDel = 0.5
Exemplo n.º 9
0
 def die(self):#self explanatory
     ParticleEngine.createPoint(150,self.x,self.y,(-15,15),(-10,40),(255,0,0),'Line',grav = True)#blood/confetti depends on violence is sanctified
     self.dead = True