Exemple #1
0
    def loop(self, screen):
        img_manager.draw_rect(screen, Vector2(), Rect(Vector2(),engine.get_screen_size()),self.bg_color)
        snd_manager.update_music_status()
        """
        if CONST.render == 'kivy':
            for layer in self.objects:
                for img in layer:
                    #set img pos outside the screen
                    if isinstance(img, AnimImage):
                        for kivy_img in img.anim.img_indexes:
                            kivy_img.x = -engine.get_screen_size().x
                            kivy_img.y = -engine.get_screen_size().y
        """
        '''Event
        If mouse_click on element, execute its event, of not null'''
        if self.show_mouse:
            show_mouse()
            mouse_pos, pressed = get_mouse()
            if pressed[0] and not self.click:
                event = None
                self.click = True
                for layer in self.objects:
                    for image in layer:
                        if image.check_click(mouse_pos, self.screen_pos):
                            event = image.event
                if event:
                    event.execute()
            elif not pressed[0]:
                self.click = False



        if not self.lock:
            physics_manager.loop()


        '''Show images'''
        if self.player and self.player.anim:
            self.screen_pos = self.player.anim.get_screen_pos()
        remove_image = []
        for i, layer in enumerate(self.objects):
            if i == 2:
                NetworkGamestate.loop(self, screen)
            for j, img in enumerate(layer):
                img.loop(screen, self.screen_pos)
                if img.remove:
                    remove_image.append(img)
        for r in remove_image:
            self.objects[i].remove(r)

        '''GUI'''
        GUI.loop(self, screen)

        '''Editor'''
        if CONST.debug:
            Editor.loop(self, screen, self.screen_pos)
Exemple #2
0
    def loop(self, screen):
        if self.get_loading_state():
            switch_level(GameState(CONST.startup))
            return


        img_manager.draw_rect(screen,Vector2(),Rect(Vector2(), engine.get_screen_size()),(255,255,255))
        self.counter = (self.counter + 1) % self.anim_length
        if self.counter == 0:
            self.text_points += "."
            if self.text_points == '....':
                self.text_points = ""
            self.loading_text.set_text("Loading"+self.text_points)
        self.loading_text.loop(screen,Vector2())
Exemple #3
0
 def loop(self,screen,screen_pos):
     pos = (0,0)
     if self.pos:
         pos = self.pos
     
     if self.screen_relative_pos is not None:
         pos = pos + self.screen_relative_pos*engine.get_screen_size()
     
     if self.screen_relative:
         pos = self.pos
     else:
         pos = pos-screen_pos
     if CONST.debug:
         self.update_rect()
         if not self.screen_relative:
             img_manager.draw_rect(screen, screen_pos, self.rect, (0,0,255,200), self.angle)
             if self.click_rect:
                 img_manager.draw_rect(screen,screen_pos,self.click_rect,(0,255,0,100))
Exemple #4
0
 def loop(self, screen):
     img_manager.draw_rect(screen,Vector2(),Rect(Vector2(0,0),engine.get_screen_size()),(255,255,255))
     self.text.loop(screen, Vector2())
     if snd_manager.check_music_status():
         from engine.level_manager import switch_level
         switch_level(self.loading_screen)