Ejemplo n.º 1
0
    def __on_draw(self):
        self.draw_frame(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            self.parent.image,
            self.viewport_x,
            self.viewport_y,
            self.width - 2,
            self.height - 2,
        )

        pyxel.clip(
            self.x + 1, self.y + 1, self.x + self.width - 2, self.y + self.height - 2
        )

        x = self.x + self.select_x - self.viewport_x
        y = self.y + self.select_y - self.viewport_y

        if self._is_tilemap_mode:
            pyxel.rectb(x, y, x + 9, y + 9, 0)
            pyxel.rectb(x - 1, y - 1, x + 10, y + 10, 7)
            pyxel.rectb(x - 2, y - 2, x + 11, y + 11, 0)
        else:
            pyxel.rectb(x, y, x + 17, y + 17, 0)
            pyxel.rectb(x - 1, y - 1, x + 18, y + 18, 7)
            pyxel.rectb(x - 2, y - 2, x + 19, y + 19, 0)

        pyxel.clip()
Ejemplo n.º 2
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            self.parent.image,
            self.viewport_x,
            self.viewport_y,
            self.width - 2,
            self.height - 2,
        )

        pyxel.clip(self.x + 1, self.y + 1, self.x + self.width - 2,
                   self.y + self.height - 2)

        x1 = self.x + self._focus_x - self.viewport_x + 1
        y1 = self.y + self._focus_y - self.viewport_y + 1
        x2 = x1 + self._focus_width - 1
        y2 = y1 + self._focus_height - 1

        pyxel.rectb(x1, y1, x2, y2, 7)
        pyxel.rectb(x1 + 1, y1 + 1, x2 - 1, y2 - 1, 0)
        pyxel.rectb(x1 - 1, y1 - 1, x2 + 1, y2 + 1, 0)

        pyxel.clip()
Ejemplo n.º 3
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            self.parent.image,
            self.viewport_x,
            self.viewport_y,
            self.width - 2,
            self.height - 2,
        )

        pyxel.clip(self.x + 1, self.y + 1, self.width - 2, self.height - 2)

        x = self.x + self._focus_x - self.viewport_x + 1
        y = self.y + self._focus_y - self.viewport_y + 1
        w = self._focus_width
        h = self._focus_height

        pyxel.rectb(x, y, w, h, 7)
        pyxel.rectb(x + 1, y + 1, w - 2, h - 2, 0)
        pyxel.rectb(x - 1, y - 1, w + 2, h + 2, 0)

        pyxel.clip()
Ejemplo n.º 4
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            3,
            TILEMAP_IMAGE_X,
            TILEMAP_IMAGE_Y,
            TILEMAP_IMAGE_WIDTH,
            TILEMAP_IMAGE_HEIGHT,
        )

        pyxel.clip(self.x + 1, self.y + 1, self.x + self.width - 2,
                   self.y + self.height - 2)

        x1 = self.x + self.parent.drawing_x // 4 + 1
        y1 = self.y + self.parent.drawing_y // 4 + 1
        x2 = x1 + 3
        y2 = y1 + 3

        pyxel.rectb(x1, y1, x2, y2, 7)
        pyxel.rectb(x1 - 1, y1 - 1, x2 + 1, y2 + 1, 0)

        pyxel.clip()
Ejemplo n.º 5
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        if self._is_tilemap_mode:
            pyxel.bltm(
                self.x + 1,
                self.y + 1,
                self.parent.image,
                self.parent.tilemap,
                self.viewport_x,
                self.viewport_y,
                16,
                16,
            )

            for i in range(16):
                y = self.y + i * 8 + 1
                for j in range(16):
                    x = self.x + j * 8 + 1

                    val = self._overlay_canvas.data[i, j]
                    if val != OverlayCanvas.COLOR_NONE:
                        sx = (val % 32) * 8
                        sy = (val // 32) * 8
                        pyxel.blt(x, y, self.parent.image, sx, sy, 8, 8)
        else:
            for i in range(16):
                y = self.y + i * 8 + 1
                for j in range(16):
                    x = self.x + j * 8 + 1

                    val = self._overlay_canvas.data[i, j]
                    if val != OverlayCanvas.COLOR_NONE:
                        col = self._overlay_canvas.data[i, j]
                    else:
                        data = pyxel.image(self.parent.image).data
                        col = data[self.viewport_y + i, self.viewport_x + j]

                    pyxel.rect(x, y, x + 7, y + 7, col)

        pyxel.line(self.x + 1, self.y + 64, self.x + 128, self.y + 64, 1)
        pyxel.line(self.x + 64, self.y + 1, self.x + 64, self.y + 128, 1)

        if self.parent.tool == TOOL_SELECT and self._select_x1 >= 0:
            pyxel.clip(self.x + 1, self.y + 1, self.x + 128, self.y + 128)

            x1 = self._select_x1 * 8 + 12
            y1 = self._select_y1 * 8 + 17
            x2 = self._select_x2 * 8 + 19
            y2 = self._select_y2 * 8 + 24

            pyxel.rectb(x1, y1, x2, y2, 15)
            pyxel.rectb(x1 + 1, y1 + 1, x2 - 1, y2 - 1, 0)
            pyxel.rectb(x1 - 1, y1 - 1, x2 + 1, y2 + 1, 0)

            pyxel.clip()
Ejemplo n.º 6
0
    def on_draw(self):
        img = self.parent._image_button.index
        pyxel.blt(self.x, self.y, img, self.preview_x, self.preview_y, 64, 128)

        pyxel.clip(self.x - 1, self.y - 1, self.x + self.width,
                   self.y + self.height)
        x = self.x + self.parent.edit_x - self.preview_x
        y = self.y + self.parent.edit_y - self.preview_y
        pyxel.rectb(x - 1, y - 1, x + 16, y + 16, 7)
        pyxel.clip()
Ejemplo n.º 7
0
 def test_clip(self):
     pyxel.clip()
     if not self.clip_test_is_enabled:
         return
     x = math.sin(pyxel.frame_count * 0.02) * 39 + 40
     y = math.sin(pyxel.frame_count * 0.03) * 29 + 30
     w = 120
     h = 90
     pyxel.text(x, y - 8, "clip(x,y,w,h)", 14)
     pyxel.rectb(x - 1, y - 1, w + 2, h + 2, 14)
     pyxel.clip(x, y, w, h)
Ejemplo n.º 8
0
    def draw(self):
        fc=pyxel.frame_count
        if self.pallet_test==1:pal(2,3)# pallet swap - test_pal1
        if self.pallet_test==2:pal(4,7)
        if self.pallet_test==3:pal(7,10)
        _,__=cls(2),text(6,6, "cls(col)",7) #self.test_cls(6, 6)
        
        text(6, 20, "pix(x,y,col)", 7)
        for i in range(16):pix(10 + i*2, 30, i)

        text(106, 6, "line(x1,y1,x2,y2,col)", 7)
        for i in range(3):line(110, 15 + i * 8, 158, 15 + i * 8, 5+i)
        for i in range(4):line(110 + i*16, 15,110 + i * 16,31, 8+i)
        for i in range(4):line(110 + i*16, 15,110+ (3 - i) * 16,31, 12+i)
        
        text(6, 38, "rect(x,y,w,h,col)", 7)
        for i in range(8):rect(10 + i * 8, 54 - i, i + 1, i + 1, i + 8)

        text(106, 38, "rectb(x,y,w,h,col)", 7)
        for i in range(8):rectb(110+i*8,54- i, i + 1, i + 1, i + 8)

        text(6,61, "circ(x,y,r,col)", 7)
        for i in range(8):circ(10+ i * 8,76, i, i + 8)
        
        text(106, 61, "circb(x,y,r,col)", 7)
        for i in range(8):circb(110+i*8,76,i,i+8)

        text(6,88, "blt(x,y,img,u,v,\n    w,h,[colkey])", 7)
        x,y=6,103
        blt(x, y, 0, 0, 0, 16, 16)
        blt(x + math.sin(fc * 0.1) * 2 + 19, y, 0, 0, 0, 16, 16, 5)
        blt(x + 38, y, 0, 0, 0, -16, 16, 5)
        blt(x + 57, y, 0, 0, 0, 16, -16, 5)
        blt(x + 76, y, 0, 0, 0, -16, -16, 5)

        text(106, 88, "bltm(x,y,tm,u,v,\n w,h,[colkey])", 7)
        bltm(106, 103, 0, 0, 0, 11, 2, 2)

        text(6, 124, "text(x,y,s,col)",7)
        s = "Elapsed frame count is {}\n" "Current mouse position is ({},{})".format(fc,pyxel.mouse_x,pyxel.mouse_y)
        text(11,133,s,1)# shadow
        text(10,132,s,9)

        _,__=text(106, 124, "pal(col1,col2)", 4),pal()# test_pal2 

        if not self.clip_test:return
        clip()
        x,y,w,h=math.sin(fc*0.02)*39+40,math.sin(fc*0.03)*29+30,120,90
        text(x,y-8,"clip(x,y,w,h)",14)
        rectb(x-1,y-1,w+2,h+2,14)
        clip(x,y,w,h)
Ejemplo n.º 9
0
    def test_clip(self):
        pyxel.clip()

        if not self.clip_test_is_enabled:
            return

        x1 = math.sin(pyxel.frame_count * 0.02) * 39 + 40
        y1 = math.sin(pyxel.frame_count * 0.03) * 29 + 30
        x2 = x1 + 119
        y2 = y1 + 89

        pyxel.text(x1, y1 - 8, "clip(x1,y1,x2,y2)", 14)
        pyxel.rectb(x1 - 1, y1 - 1, x2 + 1, y2 + 1, 14)
        pyxel.clip(x1, y1, x2, y2)
Ejemplo n.º 10
0
    def __on_draw(self):
        self.draw_frame(self.x, self.y, self.width, self.height)

        pyxel.blt(self.x + 1, self.y + 1, 3, 0, 192, 64, 63)

        pyxel.clip(self.x + 1, self.y + 1, self.x + self.width - 2,
                   self.y + self.height - 2)

        x = self.x + self.parent.edit_x // 4
        y = self.y + self.parent.edit_y // 4
        pyxel.rectb(x, y, x + 5, y + 5, 0)
        pyxel.rectb(x - 1, y - 1, x + 6, y + 6, 7)
        pyxel.rectb(x - 2, y - 2, x + 7, y + 7, 0)

        pyxel.clip()
Ejemplo n.º 11
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        # Draw edit panel
        canvas, offset_x, offset_y = (
            (self._edit_canvas, 0, 0)
            if self._is_dragged
            else (self.canvas_var, self.focus_x_var * 8, self.focus_y_var * 8)
        )
        if self._is_tilemap_mode:
            pyxel.bltm(
                self.x + 1,
                self.y + 1,
                canvas,
                offset_x * 8,
                offset_y * 8,
                128,
                128,
            )
        else:
            for yi in range(16):
                for xi in range(16):
                    pyxel.rect(
                        self.x + xi * 8 + 1,
                        self.y + yi * 8 + 1,
                        8,
                        8,
                        canvas.pget(offset_x + xi, offset_y + yi),
                    )
        pyxel.line(
            self.x + 1, self.y + 64, self.x + 128, self.y + 64, WIDGET_PANEL_COLOR
        )
        pyxel.line(
            self.x + 64, self.y + 1, self.x + 64, self.y + 128, WIDGET_PANEL_COLOR
        )

        # Draw selection area
        if self.tool_var == TOOL_SELECT and self._select_x1 >= 0:
            x = self._select_x1 * 8 + 12
            y = self._select_y1 * 8 + 17
            w = self._select_x2 * 8 - x + 20
            h = self._select_y2 * 8 - y + 25
            pyxel.clip(self.x + 1, self.y + 1, 128, 128)
            pyxel.rectb(x, y, w, h, PANEL_SELECT_FRAME_COLOR)
            pyxel.rectb(x + 1, y + 1, w - 2, h - 2, PANEL_SELECT_BORDER_COLOR)
            pyxel.rectb(x - 1, y - 1, w + 2, h + 2, PANEL_SELECT_BORDER_COLOR)
            pyxel.clip()
Ejemplo n.º 12
0
    def draw(self):

        if Battle.anim_frame <= 64:
            self.closing_anim(Battle.anim_frame)  # closing anim
            Battle.anim_frame += 1

        else:
            self.init_scene()  # drawing bg

        if Battle.anim_frame <= 128:
            self.opening_anim(Battle.anim_frame)  # opening anim
            Battle.anim_frame += 1

        elif Battle.anim_frame == 129:
            pyxel.clip()  # fully opening anim
            self.sprite_draw(Battle.anim_frame_sprites)
            if Battle.anim_frame_sprites <= 26:
                Battle.anim_frame_sprites += 1
                self.monster_x = -16 + Battle.anim_frame_sprites
                self.player_x = 128 - Battle.anim_frame_sprites  # drawing sprites
        if Battle.anim_frame_sprites == 27:
            if not self.messeage_shown:
                self.draw_hint_window(
                    Battle.anim_frame_hint_window)  # draw hint window
            if Battle.anim_frame_hint_window <= 55:
                Battle.anim_frame_hint_window += 1
        if Battle.anim_frame_hint_window == 56:  # fight
            if not self.messeage_shown:
                pyxel.text(9, 21, 'To attack choose attack di-', 7)
                pyxel.text(9, 31, 'rection with up and down', 7)
                pyxel.text(9, 41, 'arrows          <ENTER>', 7)
                if pyxel.btn(pyxel.KEY_ENTER):
                    self.messeage_shown = True
            if pyxel.btn(pyxel.KEY_UP):
                Battle.attack = True
                Battle.attack_dir = 1
            elif pyxel.btn(pyxel.KEY_DOWN):
                Battle.attack = True
                Battle.attack_dir = 0

            self.draw_hp_bars()
            if Battle.attack:
                self.attack_anim(Battle.anim_hit_frame)
                self.sprite_draw(Battle.anim_frame_sprites)
                if Battle.anim_hit_frame <= 60:  # battle anim
                    Battle.anim_hit_frame += 1
Ejemplo n.º 13
0
    def draw(self):
        if self.check_win():
            pyxel.clip(0, 0, pyxel.width, pyxel.height)
            pyxel.cls(5)
            pyxel.text(pyxel.width // 3 + 6, pyxel.height // 2, "Winner!",
                       pyxel.frame_count % 16)

        else:
            pyxel.cls(0)
            for i in range(self.grid_size[0]):
                for j in range(self.grid_size[1]):
                    self.draw_box(
                        (j * self.box_size, i * self.box_size),
                        (self.grid[self.calculate_coord(
                            (j * self.box_size, i * self.box_size))]))

            self.draw_player()
            self.draw_clip()
Ejemplo n.º 14
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        # Draw tilemap
        pyxel.blt(
            self.x + 1,
            self.y + 1,
            self._tilemap_image,
            0,
            0,
            self._tilemap_image.width,
            self._tilemap_image.height,
        )

        # Draw focus
        x = self.x + self.focus_x_var * 2 + 1
        y = self.y + self.focus_y_var * 2 + 1
        pyxel.clip(self.x + 1, self.y + 1, self.width - 2, self.height - 2)
        pyxel.rectb(x, y, 4, 4, PANEL_FOCUS_COLOR)
        pyxel.rectb(x - 1, y - 1, 6, 6, PANEL_FOCUS_BORDER_COLOR)
        pyxel.clip()
Ejemplo n.º 15
0
    def draw_clip(self):
        pyxel.clip(self.clip_corner[0], self.clip_corner[1],
                   self.clip_corner[0] + self.clip_size[0],
                   self.clip_corner[1] + self.clip_size[1])

        self.clip_corner[0] = np.clip(self.clip_corner[0] + self.clip_speed[0],
                                      -self.clip_size[0], pyxel.width)
        self.clip_corner[1] = np.clip(self.clip_corner[1] + self.clip_speed[1],
                                      -self.clip_size[1], pyxel.height)

        #check corners
        if (self.clip_corner[0] <= -self.clip_size[0]
            ) or (self.clip_corner[0] +
                  self.clip_size[0]) >= pyxel.width + self.clip_size[0]:
            self.clip_speed[0] = -1 * np.sign(
                self.clip_speed[0]) * np.random.randint(low=2, high=6)

        if (self.clip_corner[1] <= -self.clip_size[1]
            ) or (self.clip_corner[1] +
                  self.clip_size[1]) >= pyxel.height + self.clip_size[1]:
            self.clip_speed[1] = -1 * np.sign(
                self.clip_speed[1]) * np.random.randint(low=2, high=6)
Ejemplo n.º 16
0
    def switch_next_netmap(self, next_map):
        xy = self.get_center_xy()
        x = xy[0]
        y = xy[1]
        x2 = x
        y2 = y
        #print("[+] x:" + str(x) + ", y:" + str(y))

        max_width = pyxel.width / 2
        max_height = pyxel.height / 2

        if (self.view_object_scale_x2 < max_width - env.GROW_X):
            self.view_object_scale_x2 += env.GROW_X
        else:
            self.view_object_scale_x2 = max_width

        if (self.view_object_scale_y2 < max_height - env.GROW_Y):
            self.view_object_scale_y2 += env.GROW_Y
        else:
            self.view_object_scale_y2 = max_height

        if x >= 0:
            x = x - self.view_object_scale_x2
            y = y - self.view_object_scale_y2
            x2 = x2 + self.view_object_scale_x2
            y2 = y2 + self.view_object_scale_y2

        # 表示領域を制限
        pyxel.clip(x, y, x2, y2)

        draw_netmap.net_obj(self.netmap_att, [])

        draw_netmap.address(self.netmap_att)

        if (self.view_object_scale_x2 == max_width
                and self.view_object_scale_y2 == max_height):
            self.netmap_att["netmap"] = next_map
            self.netmap_reset()
Ejemplo n.º 17
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            3,
            TILEMAP_IMAGE_X,
            TILEMAP_IMAGE_Y,
            TILEMAP_IMAGE_WIDTH,
            TILEMAP_IMAGE_HEIGHT,
        )

        pyxel.clip(self.x + 1, self.y + 1, self.x + self.width - 2,
                   self.y + self.height - 2)

        x = self.x + self.parent.drawing_x // 4
        y = self.y + self.parent.drawing_y // 4
        pyxel.rectb(x, y, x + 5, y + 5, 0)
        pyxel.rectb(x - 1, y - 1, x + 6, y + 6, 7)
        pyxel.rectb(x - 2, y - 2, x + 7, y + 7, 0)

        pyxel.clip()
Ejemplo n.º 18
0
    def __on_draw(self):
        pyxel.blt(
            self.x,
            self.y,
            self.parent.image,
            self.viewport_x,
            self.viewport_y,
            self.width,
            self.height,
        )

        pyxel.clip(self.x - 1, self.y - 1, self.x + self.width,
                   self.y + self.height)

        x = self.x + self.select_x - self.viewport_x
        y = self.y + self.select_y - self.viewport_y

        if self._is_tilemap_mode:
            pyxel.rectb(x - 1, y - 1, x + 8, y + 8, 7)
        else:
            pyxel.rectb(x - 1, y - 1, x + 16, y + 16, 7)

        pyxel.clip()
Ejemplo n.º 19
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        # Draw image
        pyxel.blt(
            self.x + 1,
            self.y + 1,
            self.image_no_var,
            self.viewport_x_var * 8,
            self.viewport_y_var * 8,
            self.width - 2,
            self.height - 2,
        )

        # Draw focus
        x = self.x + (self.focus_x_var - self.viewport_x_var) * 8 + 1
        y = self.y + (self.focus_y_var - self.viewport_y_var) * 8 + 1
        w = self.focus_w_var * 8
        h = self.focus_h_var * 8
        pyxel.clip(self.x + 1, self.y + 1, self.width - 2, self.height - 2)
        pyxel.rectb(x, y, w, h, PANEL_FOCUS_COLOR)
        pyxel.rectb(x + 1, y + 1, w - 2, h - 2, PANEL_FOCUS_BORDER_COLOR)
        pyxel.rectb(x - 1, y - 1, w + 2, h + 2, PANEL_FOCUS_BORDER_COLOR)
        pyxel.clip()
Ejemplo n.º 20
0
    def __on_draw(self):
        self.draw_panel(self.x, self.y, self.width, self.height)

        pyxel.blt(
            self.x + 1,
            self.y + 1,
            3,
            TILEMAP_IMAGE_X,
            TILEMAP_IMAGE_Y,
            TILEMAP_IMAGE_WIDTH,
            TILEMAP_IMAGE_HEIGHT,
        )

        pyxel.clip(self.x + 1, self.y + 1, self.width - 2, self.height - 2)

        x = self.x + self.parent.drawing_x // 4 + 1
        y = self.y + self.parent.drawing_y // 4 + 1
        w = 4
        h = 4

        pyxel.rectb(x, y, w, h, PANEL_FOCUS_COLOR)
        pyxel.rectb(x - 1, y - 1, w + 2, h + 2, PANEL_FOCUS_BORDER_COLOR)

        pyxel.clip()
Ejemplo n.º 21
0
 def draw(self):
     #  MAIN TIMELINE  #
     print('Monster Id ', self.monster_id, 'Monster Dmg ', self.monster_dmg,
           'Monster Hp ', self.monster_hp, 'Player Hp ', self.player_hp,
           'Player Dmg', self.player_dmg, 'Frame', self.frame)
     if self.frame < 32:  # clothing game window
         self.i += 2
         pyxel.clip(self.i, self.i, 128 - self.i, 128 - self.i)
         self.frame += 1
     elif self.frame < 64:  # opening game window
         pyxel.bltm(0, 0, 0, 16, 16, 16, 16)
         self.i += 2
         pyxel.clip(self.i, self.i, 128 - self.i, 128 - self.i)
         self.draw_sprites()
         self.frame += 1
     else:  # infinity
         pyxel.bltm(0, 0, 0, 16, 16, 16, 16)
         pyxel.clip()
         self.monster_dmg = Monster.monster_database[self.monster_id][8]
         self.draw_sprites()
         if not self.end_anim:
             self.player_hit_anim()
         if pyxel.btn(pyxel.KEY_T):
             self.frame = 0
             self.battle_frame = 0
             self.i = 0
             self.end_anim = False
             Monster.battle = False
     if self.end_anim:
         if self.frame == 64:
             self.i = 0
         if self.frame < 97:
             pyxel.rect(0, 0, 128, self.i, 0)
             self.i += 4
             self.frame += 1
         else:
             self.attack = False
             self.player_x = 100
             self.frame = 0
             self.battle_frame = 0
             self.i = 0
             self.end_anim = False
             Monster.battle = False
Ejemplo n.º 22
0
 def opening_anim(self, i):
     pyxel.clip(128 - i, 128 - i, i, i)
Ejemplo n.º 23
0
 def closing_anim(self, i):
     pyxel.clip(i, i, 128 - i, 128 - i)
Ejemplo n.º 24
0
    def draw(self):
        pyxel.cls(0)
        pyxel.clip(0, 0, 256, 192)

        #pyxel.text(55, 41, "Hello, Pyxel!", pyxel.frame_count % 16)
        #pyxel.blt(61, 66, 0, 0, 0, 38, 16)

        # 星
        if gcommon.draw_star:
            gcommon.drawStar2(-gcommon.cur_scroll_x)

        ObjMgr.drawDrawMapBackground()

        for obj in ObjMgr.objs:
            if (obj.layer & gcommon.C_LAYER_UNDER_GRD) != 0:
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor2)
                obj.drawLayer(gcommon.C_LAYER_UNDER_GRD)
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor1)

        ObjMgr.drawDrawMap()

        # enemy(ground)
        for obj in ObjMgr.objs:
            if (obj.layer & gcommon.C_LAYER_GRD) != 0:
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor2)

                obj.drawLayer(gcommon.C_LAYER_GRD)
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor1)

        # my ship
        ObjMgr.myShip.draw0()

        # # item
        # for obj in ObjMgr.objs:
        # 	if (obj.layer != gcommon.C_LAYER_ITEM) != 0:
        # 		obj.draw()

        # enemy(sky)
        for obj in ObjMgr.objs:
            if (obj.layer & gcommon.C_LAYER_SKY) != 0:
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor2)

                obj.drawLayer(gcommon.C_LAYER_SKY)
                if obj.hitcolor1 != 0 and obj.hit:
                    pyxel.pal(obj.hitcolor1, obj.hitcolor1)

        # enemy shot and explosion(sky)
        for obj in ObjMgr.objs:
            if (obj.layer &
                (gcommon.C_LAYER_EXP_SKY | gcommon.C_LAYER_E_SHOT)) != 0:
                obj.drawLayer(gcommon.C_LAYER_EXP_SKY | gcommon.C_LAYER_E_SHOT)

        # my shot
        for shot in ObjMgr.shots:
            shot.draw()

        # my ship
        ObjMgr.myShip.draw()

        ObjMgr.drawDrawMap2()

        for obj in ObjMgr.objs:
            if (obj.layer & gcommon.C_LAYER_UPPER_SKY) != 0:
                obj.drawLayer(gcommon.C_LAYER_UPPER_SKY)

        for obj in ObjMgr.objs:
            if (obj.layer & gcommon.C_LAYER_TEXT) != 0:
                obj.drawLayer(gcommon.C_LAYER_TEXT)

        # 当たり判定描画
        if gcommon.ShowCollision:
            for shot in ObjMgr.shots:
                if shot.removeFlag == False:
                    self.drawObjRect(shot)
            self.drawObjRect(ObjMgr.myShip)
            for obj in ObjMgr.objs:
                if obj.removeFlag or (obj.shotHitCheck == False
                                      and obj.hitCheck == False):
                    continue
                self.drawObjRect(obj)

        pyxel.clip()
        # SCORE表示
        Drawing.showText(0, 192, "SC " + str(GameSession.score).rjust(8))
        # 残機
        pyxel.blt(232, 192, 0, 8, 32, 8, 8, gcommon.TP_COLOR)
        Drawing.showText(242, 192, str(GameSession.playerStock).rjust(2))

        # 武器表示
        if GameSession.weaponType == gcommon.WeaponType.TYPE_A:
            for i in range(0, 3):
                if i == ObjMgr.myShip.weapon:
                    pyxel.blt(96 + 40 * i, 192, 0, 128 + i * 40, 248, 40, 8)
                else:
                    pyxel.blt(96 + 40 * i, 192, 0, 128 + i * 40, 240, 40, 8)
        else:
            for i in range(0, 4):
                if i == ObjMgr.myShip.weapon:
                    pyxel.blt(96 + 32 * i, 192, 0, 128 + i * 32, 232, 40, 8)
                else:
                    pyxel.blt(96 + 32 * i, 192, 0, 128 + i * 32, 224, 40, 8)

        #pyxel.text(120, 184, str(gcommon.back_map_x), 7)
        if gcommon.DebugMode:
            gcommon.Text2(121, 184, str(gcommon.game_timer), 7, 0)
            gcommon.Text2(160, 184, str(len(ObjMgr.objs)), 7, 0)
            gcommon.Text2(0, 184,
                          str(gcommon.map_x) + " " + str(gcommon.map_y), 7, 0)
            #gcommon.Text2(0, 184, str(gcommon.back_map_x), 7, 0)
            #pyxel.text(160, 184, str(len(ObjMgr.shots)), 7)
        #pyxel.text(160, 188, str(self.event_pos),7)
        #pyxel.text(120, 194, str(gcommon.getMapData(ObjMgr.myShip.x, ObjMgr.myShip.y)), 7)
        # マップ位置表示
        #pyxel.text(200, 184, str(gcommon.map_x) + " " +str(gcommon.map_y), 7)

        if self.pauseMode == gcommon.PAUSE_PAUSE:
            self.drawPauseMenu()
        elif self.pauseMode == gcommon.PAUSE_CONTINUE:
            self.drawContinueMenu()

        # マウスカーソル
        if self.mouseManager.visible:
            pyxel.blt(pyxel.mouse_x - 7, pyxel.mouse_y - 7, 0, 24, 32, 16, 16,
                      2)
Ejemplo n.º 25
0
 def draw_just(self):
     draw_frameC(TextBox.OX, TextBox.OY, TextBox.W, TextBox.H)
     pyxel.clip(TextBox.OX, TextBox.OY, TextBox.W, TextBox.H)
     draw_textC(TextBox.OX, TextBox.OY - self.sy, self.text0)
     pyxel.clip()