def draw(self): pyxel.bltm(0, 0, 0, 0, 0, MAP_WIDTH, MAP_HEIGHT) pyxel.text(4, 4, "POINTS " + str(self.score), 7) if self.mGameOver: # à faire écrire les meilleures resultats pyxel.text(20, 80, "C'est fini!", 7) pyxel.text(10, 90, "Votre resultat est: {0}".format(self.score), 7)
def draw(self): pyxel.cls(0) #Draw tilemap pyxel.bltm(0, 0, 0, 0, 0, 16, 16) #Player draw////////////////////////////// x = self.player.p_x y = self.player.p_y if self.player.p_j == True: pyxel.blt(x, y, 0, 8, 0, 8, 8, 0) elif self.player.p_m == 2: if self.player.p_c % 15 == 0: self.player.p_m2 += 1 if self.player.p_m2 % 2 == 0: pyxel.blt(x, y, 0, 0, 8, 8, 8, 0) else: pyxel.blt(x, y, 0, 8, 8, 8, 8, 0) elif self.player.p_m == 4: if self.player.p_c % 15 == 0: self.player.p_m2 += 1 if self.player.p_m2 % 2 == 0: pyxel.blt(x, y, 0, 0, 16, 8, 8, 0) else: pyxel.blt(x, y, 0, 8, 16, 8, 8, 0) elif self.player.p_m == 0: pyxel.blt(x, y, 0, 0, 0, 8, 8, 0)
def render(self, x=0, y=0): '''Draw layer''' pyxel.rect(0, 0, *SCREEN_SIZE, self._mask_) pyxel.bltm(x, y, FLOOR_TILEMAP, 0, 0, self._map_width_, self._map_height_, self._mask_) pyxel.bltm(x, y, DECORATION_TILEMAP, 0, 0, self._map_width_, self._map_height_, self._mask_)
def draw(self): self.check_fuel() self.make_fuel = True pyxel.cls(0) pyxel.bltm(0, 10, 0, 0, 0, 30, self.side_scroll_y, True) player = pyxel.blt(self.x, self.y, 0, 32, 0, 16, 16, pyxel.COLOR_WHITE) ## player movements if pyxel.btn(pyxel.KEY_RIGHT) or pyxel.btn(pyxel.KEY_E): player = pyxel.blt(self.x, self.y, 0, 0, 0, 16, 16, pyxel.COLOR_WHITE) self.score += 10 elif pyxel.btn(pyxel.KEY_LEFT) or pyxel.btn(pyxel.KEY_Q): player = pyxel.blt(self.x - 1, self.y, 0, 16, 0, 16, 16, pyxel.COLOR_WHITE) self.score += 10 ## print the score, position, and fuel, clearing the screen stops overwriting pyxel.rect(0, 0, SCREEN_WIDTH, 10, pyxel.COLOR_BLACK) s = "SCORE:{:04}".format(self.score) pyxel.text(0, 0, s, 6) f = "FUEL:{:02}".format(self.fuel) pyxel.text(120, 0, f, 6) self.show_fuel() self.check_fuel()
def desenhar(): """ Desenha elementos na tela. """ # Fundo azul pyxel.cls(12) # Canos: cada cano é representado por uma tupla (x, y), com a posição do # em x e a altura do cano for (x, y) in canos: pyxel.blt(x, y, 1, 0, 0, 25, 150, 0) pyxel.blt(x, y + ABERTURA, 1, 0, 0, -25, -150, 0) # Chão: desenhamos duas texturas separadas pela largura da tela que # se deslocam 1 pixel por frame offset = -pyxel.frame_count % LARGURA pyxel.bltm(offset, ALTURA - 16, 0, 0, 0, 32, 3) pyxel.bltm(offset - LARGURA, ALTURA - 16, 0, 0, 0, 32, 3) # Flappy frame = (pyxel.frame_count // 4) % 3 pyxel.blt(flappy_x, flappy_y, 0, 0, frame * 16, 17, 13, 0) # Desenha instruções na tela e placar if not ativo: msg = "APERTE ESPACO OU SETA PARA CIMA PARA COMECAR" pyxel.text(LARGURA / 2 - len(msg) * 2, ALTURA / 3, msg, 7) else: pyxel.text(LARGURA // 2, ALTURA // 3, str(score), 7) if morto: msg = "Aperte R para reiniciar" pyxel.text(LARGURA // 2 - len(msg) * 2, ALTURA // 2, msg, 7)
def draw(self): # ゲーム内描画処理 cls(0) # 真っ黒背景塗りつぶし # タイルマップ描画 x = y = u = v = tm = 0 #template番号 w = h = 16 # block size bltm(x, y, tm, u, v, w, h) # 指定したtemplate番号のuv座標をxy座標にマップして描画する # pacman描画 if self.pacman.V[0] or self.pacman.V[1]: self.pacman.pattern = { (0, -1): 8, (0, 1): 24, (1, 0): 16, (-1, 0): 32 }[tuple(self.pacman.V)] # 移動する場合、向きに応じた口パターンをゲット if pyxel.frame_count % 2 == 0: self.pacman.pattern = 0 # 口の動きを表現するために、2フレームに1回丸の状態を表示する # イメージ0に登録されている(self.pacman.pattern,0)の座標から 8×8サイズを参照にして、(self.pacman.P[0],self.pacman.P[1])の座標に描画する pyxel.blt(self.pacman.P[0], self.pacman.P[1], 0, self.pacman.pattern, 0, 8, 8) #dscore描画 score = "SCORE : {:05}".format(self.pacman.score) pyxel.text(1, 132, score, 6)
def draw(self): #pyxel.cls(15) pyxel.bltm(0, 0, 0, 0, 0, MAP_X, MAP_Y) #pyxel.text(55, 41, "Hello World!", pyxel.frame_count % 16) # draw player pyxel.blt(self.player_x, self.player_y, 0, 0, 0, 16 * (1 - (self.atr << 1)), 16, 12) #pyxel.blt(10, 10, 0, 0 , 0, 16, 16, 12) # draw floors #for x, y, is_active in self.floor: #pyxel.blt(0, 90, 0, 0, 40, 160, 5, 12) for x, y, is_active in self.movefloor: pyxel.blt(x, y, 0, 0, 16, 40, 8, 12) # draw fruits for x, y, kind, is_active in self.fruit: if is_active: pyxel.blt(x, y, 0, 32 + kind * 16, 0, 16, 16, 12) # draw item for x, y, is_active in self.item: pyxel.blt(x, y, 0, 0, 24, 8, 8, 12) # draw score s = "SCORE {:>4}".format(self.score) pyxel.text(5, 4, s, 1) pyxel.text(4, 4, s, 7) #ゲームオーバー中央表示 if self.gameover: pyxel.text((MAP_X >> 1) - 20, (MAP_Y >> 1) + 5, "GAME OVER", 7)
def display(self): global MUSIC if MUSIC != 3: pyxel.stop() MUSIC = 3 pyxel.playm(MUSIC, loop=True) if (CURRENT_REALM == DEVA_REALM): tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y pyxel.pal(11,7) elif (CURRENT_REALM == MANUSSA_REALM): tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y pyxel.pal() elif (CURRENT_REALM == TIRAACCHANA_REALM): tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y pyxel.pal(11,10) elif (CURRENT_REALM == PETA_REALM): tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y pyxel.pal(11,8) elif (CURRENT_REALM == NIRAYA_REALM): tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y pyxel.pal(11,5) # 指定したtm(template)番号の(u,v)座標から # サイズ(w,h)の大きさを(base_x,base_y)座標に描画する pyxel.bltm(self.base_x,self.base_y,tm,u,v,w,h)
def draw(self): pyxel.cls(6) pyxel.bltm(x=0, y=0, tm=0, u=0, v=0, w=21, h=21, colkey=2) for i in range(BOARD_SIZE[0]): for j in range(BOARD_SIZE[1]): if self.get_element(i, j) == None: pass else: #pyxel.rect(16 + 8 * j, 8 * i, 8, 8, 8 + int(self.get_element(i, j))) pyxel.blt(x=16 + 8 * j, y=8 * i, img=0, u=0, v=8 * (self.get_element(i, j) - 1), w=8, h=8, colkey=2) # Next for tetrimino in TETRIMINOS[self.tetrimino_next_type][0]: pyxel.blt(x=120 + 8 * tetrimino[1], y=20 + 8 * tetrimino[0], img=0, u=0, v=8 * self.tetrimino_next_type, w=8, h=8, colkey=2) pyxel.text(120, 48, f"{self.clear_line_count}", 7) if self.check_gameover(): pyxel.text(x=120, y=40, s="GAME OVER", col=7)
def draw(self): pyxel.cls(13) #Draw tilemap pyxel.bltm(0, 0, 0, 0, 0, 8, 5) #Draw_player if self.move_r == 1: pyxel.blt(self.Player.player_x, self.Player.player_y, 0, 0, 16, 16, 16, 3) elif self.move_l == 1: pyxel.blt(self.Player.player_x, self.Player.player_y, 0, 16, 16, 16, 16, 3) elif self.atk_flug == 1: #Draw_upper if self.up_flug == 1: if self.atk_count < 9: s = self.atk_count + 2 pyxel.blt(self.Player.player_x + 0.1, self.Player.player_y - s, 0, 0, 32, 16, 20, 3) else: s = 18 - self.atk_count pyxel.blt(self.Player.player_x, self.Player.player_y - s, 0, 16, 32, 16, 20, 3) else: pyxel.blt(self.Player.player_x, self.Player.player_y, 0, 16, 0, 16, 16, 3) else: pyxel.blt(self.Player.player_x, self.Player.player_y, 0, 0, 0, 16, 16, 3) #Draw_hadou if len(self.Hadou) >= 1: pyxel.blt(self.Hadou[0].hadou_x, self.Hadou[0].hadou_y, 0, 32, 0, 8, 8, 3)
def draw(self, px, py): u = px * 2 - WINDOW_WIDTH // 16 v = py * 2 - WINDOW_HEIGHT // 16 pyxel.bltm(0, 0, 0, u, v, WINDOW_WIDTH // 8, WINDOW_HEIGHT // 8) sx = (Stage.stair_x - px) + WINDOW_WIDTH // 32 sy = (Stage.stair_y - py) + WINDOW_HEIGHT // 32 pyxel.blt(sx * 16, sy * 16, 0, Stage.stair_u, Stage.stair_v, 16, 16)
def campo(x): # desenho do campo pyxel.bltm(0, 0, x, 0, 0, 30, 30) pyxel.text(15, 17, "FutAvengers", 7) #nome do jogo pyxel.text(80, 13, "P l a y e r 1", 3) #placar - jogador 1 pyxel.text(170, 13, "P l a y e r 2", 8) #placar - jogador 2 pyxel.circb(0, 120, 30, 7) #círculo do lado esquerdo pyxel.circb(240, 120, 30, 7) #círculo do lado esquerdo
def draw_game(self): pyxel.cls(0) pyxel.bltm(0 - self.cam.x, 0 - self.cam.y, 0, 0, 0, MAP_WIDTH, MAP_HEIGHT, 0) for obj_list in self.game_objects.values(): for obj in obj_list: obj.draw(self.cam) self.cam.draw()
def draw_map(self): x = 0 y = 0 tm = 0 u = 0 v = 0 w = 16 h = 16 pyxel.bltm(x, y, tm, u, v, w, h)
def draw(self): pyxel.bltm(globals.camX, globals.camY, self.current_tm, self.tm_offsetX, self.tm_offsetY, config['width'], config['height'], 0) self.world.draw() if config['debug']: self.world.debug_draw()
def tilemap_draw(self): base_x = 0 base_y = 0 tm = 0 u = 0 v = 0 w = 16 h = 20 pyxel.bltm(base_x, base_y, tm, u, v, w, h)
def tilemap_draw(self): x = 0 y = 0 tm = 0 u = self.stage * 16 v = 0 w = 16 h = 16 pyxel.bltm(x, y, tm, u, v, w, h)
def draw_menu(self): pyxel.bltm(0, 0, 0, 0, 16, 16, 16, 0) pyxel.text(14, 16, 'INVENTORY:', 9) # text for i in range(9): try: pyxel.text(14, (i * 10) + 26, self.item_database[self.inventory[i]][0], 15) except IndexError: break
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()
def move(self, direction, x): if direction == 'right': self.virtual_x = -x pyxel.bltm(self.virtual_x, self.virtual_y, 0, 0, 0, 256, 16, 0) #print(f"blitting tilemap at: {self.virtual_x}") if direction == 'left': self.virtual_x = -x pyxel.bltm(self.virtual_x, self.virtual_y, 0, 0, 0, 256, 16, 0)
def draw_office(self): """ ゲーム画面を描画 """ pyxel.cls(7) pyxel.bltm(0, 0, 0, 48, 0, 16, 16) pyxel.text(5, 5, str(self.score), 14) # オブジェクト self.draw_object() # プレイヤー pyxel.blt(self.player.position[0], self.player.position[1], 0, 0, 0, 16, 16, 5)
def tilemap_draw(self): # 指定したtm(template)番号の(u,v)座標から # サイズ(w,h)の大きさを(base_x,base_y)座標に描画する base_x = 0 base_y = 0 tm = 0 u = 0 v = 0 w = 32 h = 32 pyxel.bltm(base_x, base_y, tm, u, v, w, h)
def draw(self): pyxel.cls(0) pyxel.bltm(0, 0, 0, 0, 0, 128, 128) #self.jogador.draw() if self.tipo_tile is not None: pyxel.text(0, 0, str(self.tipo_tile), 7) posicao_mouse = '(' + str(self.posicao.x) + ', ' + str( self.posicao.y) + ')' pyxel.text(0, 8, str(posicao_mouse), 7) self.jogador.draw()
def draw(self): pyxel.bltm( globs.camera.x, globs.camera.y, self.index, self.offsetx, self.offsety, globs.config.width, globs.config.height, 0 )
def draw(self): pyxel.cls(BG_COLOR) #draw map pyxel.bltm(0,0,0, self.x, self.y, 71, 55) self.text_score(230, 16, 300) #train pyxel.blt(0, 194, 0, 0, 16, 32, 8)
def draw_tilemap(self): base_x = 0 base_y = 0 tm = 0 u = 0 v = 0 w = 16 h = 16 # 指定したtm(template)番号の(u,v)座標から # サイズ(w,h)の大きさを(base_x,base_y)座標に描画する pyxel.bltm(base_x,base_y,tm,u,v,w,h)
def draw(self): px.bltm(-self.position.x + self.original_position.x, -self.position.y + self.original_position.y, 0, 0, 0, 255, 255) px.blt(self.original_position.x, self.original_position.y, 0, 8, 8, 8, 8, colkey=1) px.pset(self.x, self.y, px.COLOR_PINK)
def draw(self): px.cls(0) px.bltm(0, 0, 0, 0, 0, 32, 32, 0) self.player.draw() for i in self.hazard_list: i.draw() px.text(17, 9, 'score: ' + str(self.score), px.COLOR_WHITE) px.text(17, 18, 'Fire count: ' + str(self.how_much_fire), px.COLOR_WHITE) px.text(178, 9, 'time remaining: ' + str(30 - int(self.actual_time)), px.COLOR_WHITE) px.text(178, 18, 'highscore: ' + str(self.highscore), px.COLOR_WHITE)
def draw(self): pyxel.cls(self.BGColor) pyxel.bltm(pyxel.width//2-4+(self.MapLeft-self.x)*8-self.sx+g_offset_x, pyxel.height//2-4+(self.MapTop-self.y)*8-self.sy+g_offset_y, self.MapID, self.MapLeft, self.MapTop, self.MapRight-self.MapLeft, self.MapBottom-self.MapTop) # 何も考えずに全マップ描画 [npc.draw(pyxel.width//2-4-self.x*8-self.sx, pyxel.height//2-4-self.y*8-self.sy) for npc in self.NPCs] pyxel.blt(pyxel.width//2-4, pyxel.height//2-4-1, 0, (self.direction*2+blinker())*8, 32, 8, 8, 0) # 中央に主人公を if pyxel.frame_count - self.idle_start > 45: draw_playerstatus() if self.textbox: self.textbox.draw_just() if self.fdraw_poison: pyxel.rectb(0, 0, pyxel.width, pyxel.height, 8) self.fdraw_poison = False
def draw(self): #color background white pyxel.cls(7) #paste map pyxel.bltm(0, 0, 0, 0, 0, 8, 8, 0) #draw player pyxel.blt(self.IB9.x, self.IB9.y, 0, 8 * self.IB9.v[0], 0, 8 * self.IB9.v[1], 8 * self.IB9.v[1], 11) #draw goal pyxel.blt(self.goal[0], self.goal[1], 0, 24, 8, 8, 8, 0) #draw box for box in self.box: pyxel.blt(box.x, box.y, 0, 16, 8, 8, 8, 0)