Example #1
0
    def update(self):
        if self.pos_x > self.display.get_width():
            surface_manager.remove(self)
        self.pos_x += self.velocity

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #2
0
 def update(self):
     self.check_if_tocada()
     
     if self.is_tocada:
         surface_manager.remove(self)
         
     self.rect.topleft = (self.pos_x, self.pos_y)
    def update(self):
        if self.pos_x+100 > self.display.get_width():
            surface_manager.remove(self)
        self.pos_x += self.velocity

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #4
0
    def update(self):
        if self.pos_x > self.display.get_width():
            surface_manager.remove(self)
        self.pos_x += math.cos(self.angle)*self.velocity
        self.pos_y += math.sin(self.angle)*self.velocity

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #5
0
 def self_hit(self):
     collidelist = pygame.sprite.spritecollide(self, surface_manager.surface_list, False)
     for item in collidelist:
         if type(item) is player.Player:
             surface_manager.remove(self)
             if game.Game.player.bullets<=0:
                 return;
             game.Game.player.bullets-=5
Example #6
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)
            return
        else:
            self.pos_x -= 12

            self.rect.topleft = (self.pos_x, self.pos_y)
Example #7
0
    def check_if_hit(self):
        if self.is_hit:
            return
        collidelist = pygame.sprite.spritecollide(self, surface_manager.surface_list, False)

        for item in collidelist:
            if type(item) is projectile.Projectile:
                surface_manager.remove(item)
                self.is_hit = True
                self.image = pygame.transform.flip(self.image, False, True)
                self.hit_sound.play()
Example #8
0
    def update(self):

        if self.pos_x < 0 - self.rect.width and self.has_shown:
            surface_manager.remove(self)
        elif not self.has_shown and self.pos_x < 0:
            self.pos_x += 12
        elif self.pos_x >= 0 - self.rect.width and time.clock() > self.delay + 3:
            self.has_shown = True
            self.pos_x -= 12
        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #9
0
    def check_if_hit(self):
        if self.is_hit:
            return
        collidelist = pygame.sprite.spritecollide(self, surface_manager.surface_list, False)

        for item in collidelist:
            if type(item) is arma.Arma:
                surface_manager.remove(item)
                self.is_hit = True
                self.image = pygame.transform.flip(self.image, False, True)
                self.hit_sound.play()
Example #10
0
    def check_if_hit(self):
        if self.is_hit:
            return
        collidelist = pygame.sprite.spritecollide(self, surface_manager.surface_list, False)

        for item in collidelist:
            if type(item) is projectile.Projectile:
                surface_manager.remove(item)
                self.is_hit = True
                self.image = pygame.transform.flip(self.image, False, True)
                
                game.update_score()
Example #11
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        if self.is_consumed():
            self.add_bonus()
            surface_manager.remove(self)

        self.pos_x -= 12

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #12
0
    def update(self):

        if self.pos_x < 0 - self.rect.width and self.has_shown:
            surface_manager.remove(self)
        elif not self.has_shown and self.pos_x < 0:
            self.pos_x += 12
        elif self.pos_x >= 0 - self.rect.width and time.clock(
        ) > self.delay + 3:
            self.has_shown = True
            self.pos_x -= 12
        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #13
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        if self.is_consumed():
            self.add_bonus()
            surface_manager.remove(self)

        self.pos_x -= 12

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #14
0
    def update(self):
        self.check_if_hit()
        
        if self.is_hit:
            surface_manager.remove(self)
        
        if self.on_platform_L2():
            self.is_falling = False
            
        if self.pos_x < self.anc_plat and self.is_mov_der:
                
            self.pos_x += 1
            try:
                self.timer.tick(50)
                self.current_frame += 1
                self.image = self.frame_set_der[self.current_frame]
            except IndexError:
                self.timer.tick(50)
                self.current_frame = 0
                self.image = self.frame_set_der[self.current_frame]
                
        if self.pos_x >= self.anc_plat:
            self.timer.tick(50)
            self.is_mov_der = False
            self.current_frame = 0
            self.image = self.frame_set_der[self.current_frame]
                
            
        if self.pos_x > self.posx_plat and not self.is_mov_der:
            self.pos_x -= 1
            try:
                self.timer.tick(50)
                self.current_frame += 1
                self.image = self.frame_set_izq[self.current_frame]
            except IndexError:
                self.timer.tick(50)
                self.current_frame = 0
                self.image = self.frame_set_izq[self.current_frame]
            
        if self.pos_x <= self.posx_plat:
            self.timer.tick(50)
            self.is_mov_der = True
            self.current_frame = 0
            self.image = self.frame_set_izq[self.current_frame]

        if self.is_falling:
            self.pos_y += 8
            self.dirty = 1
            
        self.rect.topleft = (self.pos_x, self.pos_y)
Example #15
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        self.check_if_hit()

        if self.is_hit:
            self.pos_y += 10
            if self.pos_y >= self.display.get_height():
                surface_manager.remove(self)
        if not self.is_hit:                
            self.pos_x += self.velx
            self.pos_y += self.vely

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #16
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        self.check_if_hit()

        if self.is_hit:
            self.pos_y += 10
            if self.pos_y >= self.display.get_height():
                surface_manager.remove(self)
        if not self.is_hit:
            self.pos_x += self.velx
            self.pos_y += self.vely

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #17
0
    def update(self):
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)
            return
        else:
            if self.nivel==1:
                self.pos_x -= 1
            elif self.nivel==2:
                self.pos_x -= 3
            elif self.nivel==3:
                self.pos_x -=4
        
        #if self.pos_x < 150 - self.rect.width:
            #self.saltar.play()

        self.rect.topleft = (self.pos_x, self.pos_y)
Example #18
0
    def update(self):
        #if enemy is past left side of screen , remove from game
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        self.check_if_hit()
        self.check_if_hit2()
        if self.is_hit:
            self.pos_y += 10
            if self.pos_y >= self.display.get_height():
                surface_manager.remove(self)
        if not self.is_hit:
            self.pos_x += self.velx
            self.pos_y += self.vely

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #19
0
    def update(self):
        ## INFO : an enemy will always come from two directions
        ## the shuriken of the player is only able to throw in one direction
        ## TODO : the enemy, ennemy can arrive from many directions
        if self.pos_x < 0 - self.rect.width:
            surface_manager.remove(self)

        self.check_if_hit()

        if self.is_hit:
            self.pos_y += 10
            if self.pos_y >= self.display.get_height():
                surface_manager.remove(self)
        else:
            self.pos_x += self.velx
            self.pos_y += self.vely

        self.rect.topleft = (self.pos_x, self.pos_y)
        self.dirty = 1
Example #20
0
 def remove_existing(self):
     for surface in surface_manager.surface_list:
         if type(surface) is ComboElement:
             surface_manager.remove(surface)
             return
Example #21
0
 def remove_existing(self):
     for surface in surface_manager.surface_list:
         if type(surface) is ComboElement:
             surface_manager.remove(surface)
             return
Example #22
0
 def remove_existing(self):
     #This set removes the combo statement from the display
     for surface in surface_manager.surface_list:
         if type(surface) is ComboElement:
             surface_manager.remove(surface)
             return
Example #23
0
    def remove_existing(self):
		#This set removes the combo statement from the display
        for surface in surface_manager.surface_list:
            if type(surface) is ComboElement:
                surface_manager.remove(surface)
                return