def __init__(self, screen=None):
     Sprite.__init__(self)
     source = Resources().get_surface("panel_info")
     self.image = source[0]
     self.width_height = np.array([source[1], source[2]])
     self.screen = screen
     self.pos = np.array([0, 0])
     self.name = "panel"
     self.content = "empty"
     self.show_pos = np.array([2, 2])
     self.rect = (self.pos[0], self.pos[1], self.width_height[0],
                  self.width_height[1])
     self.text = Resources().get_font("panel")
class Panel(Sprite):
    def __init__(self, screen=None):
        Sprite.__init__(self)
        source = Resources().get_surface("panel_info")
        self.image = source[0]
        self.width_height = np.array([source[1], source[2]])
        self.screen = screen
        self.pos = np.array([0, 0])
        self.name = "panel"
        self.content = "empty"
        self.show_pos = np.array([2, 2])
        self.rect = (self.pos[0], self.pos[1], self.width_height[0],
                     self.width_height[1])
        self.text = Resources().get_font("panel")

    def show(self):
        self.pos = self.show_pos
        self.rect = (self.pos[0], self.pos[1], self.width_height[0],
                     self.width_height[1])

    def hide(self):
        self.pos = np.array(PANEL_HIDE_POS)
        self.rect = (self.pos[0], self.pos[1], self.width_height[0],
                     self.width_height[1])

    def update_content(self, sprite):
        self.content = sprite.panel_info()
        source = Resources().get_surface("panel_info")
        self.image = source[0]
        if self.text:
            text_fmt = self.text.render(self.content, 1, (255, 255, 255))
            self.image.blit(text_fmt, (120, 40))
 def __init__(self, scene):
     super(Qie, self).__init__(scene=scene)
     self.init_frame(*Resources().get_surface("qie"))
     self.sprite_type = 1
     self.weapon = Weapon(self)
     self.weapon.bullet = Bullet(self.weapon)
     self.weapon.bullet.image = pygame.Surface((16, 16))
 def update_content(self, sprite):
     self.content = sprite.panel_info()
     source = Resources().get_surface("panel_info")
     self.image = source[0]
     if self.text:
         text_fmt = self.text.render(self.content, 1, (255, 255, 255))
         self.image.blit(text_fmt, (120, 40))
    def init_elements(self):
        self.view_port = ViewPort()
        self.controller = UserController()
        self.resource = Resources()
        self.sprite_group = IGroup()
        self.explosion_group = IGroup()
        self.map = Map()

        main_sprite = Qie(self)
        main_sprite.pos = np.random.randint(-100, 100, size=(1, 2))
        self.sprite_group.add(main_sprite)
        main_sprite.attack_range = 2000
        insect = Insect(self)
        insect.pos = np.random.randint(-100, 100, size=(1, 2))
        insect.speed = 1
        insect.target = main_sprite
        self.sprite_group.add(insect)

        exp = BombExplosion(self)
        exp.pos = np.random.randint(-100, 100, size=(1, 2))
        self.explosion_group.add(exp)
        exp = MissalBullet(self)
        exp.pos = np.random.randint(-100, 100, size=(1, 2))
        exp.speed = 1
        exp.target = main_sprite
        self.sprite_group.add(exp)
        self.framerate.tick(30)
        ticks = pygame.time.get_ticks()
        exp.explode(ticks)

        self.controller.main_actor = main_sprite
Exemple #6
0
 def __init__(self, parent):
     super(Weapon, self).__init__(parent)
     self.master_image = Resources().get_surface("gun2")[0]
     self.pos = np.array([20, 20])
     self.weapon = None
     self.frame = None
     self.image = None
     self.offset_value = -12
     self.offset_waist_value = 20
     self.bullet = None
     self.head_offset = None
from zhak_projects.agame.map import ViewPort, VIEW_PORT_W, VIEW_PORT_H, Map
# from zhak_projects.agame.test_game.test_run_map_bilt import tilesize
from zhak_projects.agame.zhgame import UserController, LIFE_STATE_GHOST, is_in_rect
from zhak_projects.groups import IGroup

pygame.init()

print(len(""))

view_port = ViewPort()
screen = pygame.display.set_mode((VIEW_PORT_W, VIEW_PORT_H), 0, 32)
controller = UserController()
pygame.display.set_caption("精灵类测试")
framerate = pygame.time.Clock()

resource = Resources()

sprite_group = IGroup()

# sa=Ghost(screen)
# sa.pos=np.random.randint(-100,100, size=(1,2))
# group.add(sa)
#
sa = Phoenix(screen)
sa.pos = np.random.randint(-100, 100, size=(1, 2))
sprite_group.add(sa)

sa = Kuaile(screen)
sa.pos = np.random.randint(-100, 100, size=(1, 2))
sprite_group.add(sa)
sa.type = 1
Exemple #8
0
 def __init__(self, scene):
     super(BombExplosion, self).__init__(scene=scene)
     self.init_frame(*Resources().get_surface("explosion"))
Exemple #9
0
 def __init__(self, scene):
     super(MissalBullet, self).__init__(scene=scene)
     self.init_frame(*Resources().get_surface("bullet"))
     self.explosion = BombExplosion
Exemple #10
0
 def __init__(self, scene):
     SpriteActor.__init__(self, scene)
     self.sprite_type = 2
     self.init_frame(*Resources().get_surface("qie"))
Exemple #11
0
 def __init__(self, scene):
     super(Insect, self).__init__(scene)
     self.sprite_type = 9
     self.init_frame(*Resources().get_surface("insect"))
Exemple #12
0
 def __init__(self, scene):
     SpriteActor.__init__(self, )
     self.sprite_type = 6
     self.init_frame(*Resources().get_surface("yaorao"))
Exemple #13
0
 def __init__(self, scene):
     SpriteActor.__init__(self, scene)
     self.type = 5
     self.init_frame(*Resources().get_surface("xiaohua"))
Exemple #14
0
 def __init__(self):
     self.tilemap_dict = Resources().tilemap_dict
     self.tilemapT_dict = Resources().tilemapT_dict
     self.viewport = ViewPort()
     self.layer1 = MapLayerTerritory(self.tilemapT_dict, self.viewport)
     self.layer2 = MapLayerGroundObject(self.tilemap_dict, self.viewport)
Exemple #15
0
 def init_elements_mapEditor(self):
     self.view_port = ViewPort()
     self.controller = UserController()
     self.resource = Resources()
     self.sprite_group = IGroup()
     self.map = Map()