def draw(self): pyxel.cls(0) # self.background.draw() if self.scene == SCENE_TITLE: self.draw_title_scene() elif self.scene == SCENE_PLAY: self.draw_play_scene() # elif self.scene == SCENE_GAMEOVER: # self.draw_gameover_scene() pyxel.text(60, 4, "SCORE {:5}".format(self.score), 8)
def Draw(self): pyxel.cls(0) if self.gama_state == GamaState.Title: self.title.Draw() elif self.gama_state == GamaState.GamaMain: self.gama_main.Draw() elif self.gama_state == GamaState.GamaResult: self.gama_result.Draw() elif self.gama_state == GamaState.Exit: pass else: raise Exception("drowで存在しないGamaStateが選択されました。")
def draw(self): pyxel.cls(0) # pyxel.text(5, 5, f'{len(self.enemies)}', 15) for obj in self.objects: obj.draw() if self.game_over: game_over_text = 'GAME OVER' pyxel.rect(57, 18, len(game_over_text) * 4 + 5, 9, 4) pyxel.text(60, 20, game_over_text, 7) press_text = 'Press ESC to quit' pyxel.rect(42, 48, len(press_text) * 4 + 5, 9, 4) pyxel.text(45, 50, press_text, 7)
def draw(self) -> None: """Draw screen with all its elements. If background color is specified then screen is cleared with that color first. """ if self.background_color is not None: pyxel.cls(self.background_color) if self.background_tilemap: self.background_tilemap.draw(Layer(0)) if self.elements: for element in self.elements: element.draw()
def draw(): global puzzle_board global solution_board global is_valid global cell_selected global selected_value global game_won if game_won: pyxel.cls(10) # Make bakcground yellow if game is won # Draw each space for i, row in enumerate(puzzle_board): for j, value in enumerate(row): x_offset = 2 y_offset = 2 x = i * 16 + i + x_offset # where to put the subimage y = j * 16 + j + y_offset # where to put the subimage image_size = 16 w = image_size h = image_size u = 0 v = value * 16 if cell_selected == (i, j): transparent_color = 7 else: transparent_color = 10 pyxel.blt(x, y, 0, u, v, w, h, transparent_color ) # copy part of image from resource file to the screen. # Draw the lines of the board lines_col = 0 pyxel.rect(0 + x_offset, 50 + y_offset, w=16 * 9 + 8, h=1, col=lines_col) pyxel.rect(0 + x_offset, 101 + y_offset, w=16 * 9 + 8, h=1, col=lines_col) pyxel.rect(50 + x_offset, 0 + y_offset, h=16 * 9 + 8, w=1, col=lines_col) pyxel.rect(101 + x_offset, 0 + y_offset, h=16 * 9 + 8, w=1, col=lines_col) pyxel.rect(0, 156, h=7, w=200, col=0) for idx in range(9): if selected_value == idx + 1: transparent_color = 7 else: transparent_color = 10 pyxel.blt(idx * 16 + idx + x_offset, 165, 0, u=0, v=(idx + 1) * 16, w=image_size, h=image_size, colkey=transparent_color ) #copy part of image from resource file to the screen.
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(3) if self.stat == "MENU": self.status[0].draw() elif self.stat == "PAUSA": self.status[1].draw() elif self.stat == "JOGO": self.status[2].draw() elif self.stat == "CREDITOS": self.status[3].draw() elif self.stat == "GAMEOVER": self.status[4].draw()
def draw(self): pyxel.cls(0) pyxel.text(213, 18, "(" + str(pyxel.mouse_x) + ", " + str(pyxel.mouse_y) + ")", 1) call_frame_methods.call_gameframes() calendar.Calendar.season() next_turn.Turns.next_turn() next_turn.Turns.auto_status() next_turn.textbox() pyxel.text(pyxel.mouse_x, pyxel.mouse_y, ".", 2) pyxel.text(213, 28, str(pyxel.frame_count), 2)
def draw_game(): pyxel.cls(Color.LIGHT_BLUE) for brick in bricks: brick.draw_brick() for cloud in clouds: cloud.draw() door.draw() character.draw_character() if is_game_over(character): pyxel.text(100, WINDOW_HEIGHT / 2, "GAME OVER", Color.WHITE) pyxel.text(101, WINDOW_HEIGHT / 2 + 1, "GAME OVER", Color.RED) life.draw()
def draw(self): pyxel.cls(1) pyxel.circ(self.pos_atual_bola.x, self.pos_atual_bola.y, self.raio_bola, 7) pyxel.rectb(self.pos_caixa.x, self.pos_caixa.y, self.pos_caixa.x + self.caixa_l, self.pos_caixa.y + self.caixa_a, 10) pyxel.line(self.p1.x, self.p1.y, self.p2.x, self.p2.y, 7) ponto = self.interseccao(self.p1, self.p2, self.pos_caixa, self.pos_caixa + Ponto(self.caixa_l, 0)) if ponto: pyxel.circ(ponto.x, ponto.y, 3, 8)
def draw(self): pyxel.cls(pyxel.COLOR_BLACK) # Make the background black self.player.draw() # Draw the player for b in blocks: # Draw the blocks b.draw() for b in bullets: # Draw the bullets b.draw() if self.ended: pyxel.text(10, 10, "You Won!" if self.did_win else "Game Over!", pyxel.COLOR_GREEN if self.did_win else pyxel.COLOR_RED) pyxel.text(10, 20, "Press ENTER to play again...", pyxel.COLOR_WHITE)
def draw(): global player, balls, counter, hiscore, missiles pyxel.cls(12) player.draw() for b in balls: b.draw() pyxel.text(5, 4, str(counter), 1) pyxel.text(220, 4, str(hiscore), 1) if state == 'GAMEOVER': pyxel.text(100, 100, 'Game Over', 8) for m in missiles: m.draw()
def draw(self): pyxel.cls(0) # text(x, y, s, col) 色colの文字列sを (x, y) に描画する pyxel.text( 0, 0, f"Hello, Pyxel! {pyxel.frame_count}", pyxel.frame_count % 16) pyxel.text(0, 16, "あアァ亜Aa", 15) # アルファベットのみ # blt(x, y, img, u, v, w, h, [colkey]) u = pyxel.image(0).width v = pyxel.image(0).height # print(v) center = self._centering(128, 128, 38, 16) pyxel.blt(center.x, center.y, 0, 0, 0, center.u, center.v)
def draw(): def part(ox, oy, r, r2): pyxel.circ(ox, oy, r, 7) pyxel.circb(ox, oy, r, 0) dx, dy, r = pyxel.mouse_x - ox, pyxel.mouse_y - oy, r - r2 l = (dx * dx + dy * dy)**0.5 # math.sqrt pyxel.circ( *((pyxel.mouse_x, pyxel.mouse_y) if l < r else (ox + dx * r // l, oy + dy * r // l)), r2, 0) pyxel.cls(3) [part(ox, 10, 10, 3) for ox in (10, 30)]
def draw(self): pyxel.cls(12) # draw sky # location fixed pyxel.blt(0, 88, 0, 0, 88, 160, 32) # draw mountain # location fixed pyxel.blt(0, 88, 0, 0, 64, 160, 24, 12) # draw forest offset = pyxel.frame_count % 160 for i in range(2): pyxel.blt(i * 160 - offset, 104, 0, 0, 48, 160, 16, 12) # draw clouds offset = (pyxel.frame_count // 16) % 160 for i in range(2): for x, y in self.far_cloud: pyxel.blt(x + i * 160 - offset, y, 0, 64, 32, 32, 8, 12) offset = (pyxel.frame_count // 8) % 160 for i in range(2): for x, y in self.near_cloud: pyxel.blt(x + i * 160 - offset, y, 0, 0, 32, 56, 8, 12) # draw floors for x, y, is_active in self.floor: 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 player pyxel.blt( self.player_x, self.player_y, 0, 16 if self.player_vy > 0 else 0, 0, 16, 16, 12, ) # draw score s = "SCORE {:>4}".format(self.score) # draw two score texts having different color to make them look like shadowed text pyxel.text(5, 4, s, 1) pyxel.text(4, 4, s, 7)
def draw(): for step in range(5): space.step(0.007 / 5) pyxel.cls(0) space.debug_draw(options) oopv_sleep(space, 1) for i, p in enumerate(particles): pyxel.text(0, 0 + 7 * i, str(p.body.is_sleeping), col=pyxel.COLOR_RED) static_circ(100, 70, 5, pyxel.COLOR_LIGHTBLUE, space, friction=1) static_rect(50, 120, 120, 10, pyxel.COLOR_RED, space, friction=1)
def draw(self): pyxel.cls(Color.BLACK) self.ball.draw() self.player1_bat.draw() self.player2_bat.draw() winner = self.get_winner() if winner is not None: draw_centered_text( Vector(Game.WIDTH / 2, Game.HEIGHT / 2), f'The Winner is: {winner}', Color.WHITE, )
def draw(self): pyxel.cls(0) next_world = self.world.copy() for y in range(0, self.height): for x in range(0, self.width): next_world[x, y] = self.judge_window(self.world, x, y) self.world = next_world self.generation += 1 for y in range(0, self.height): for x in range(0, self.width): pyxel.pset(x, y, self.color[self.world[x, y]]) pyxel.text(0, self.height-16, "gen: {}".format(self.generation), 14)
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 game_over(self): pyxel.cls(2) pyxel.text(61, 40, 'GAME OVER', 6) s = "SCORE:{:04}".format(self.score) pyxel.text(60, 50, s, 6) pyxel.text(47, 70, 'Press R to restart', 6) if pyxel.btnp(pyxel.KEY_R): self.stop = False self.score = 0 self.x = 80 self.y = 60 self.fuel = 100
def draw(self) -> None: pyxel.cls(0) for x in range(self.width): for y in range(self.height): particle = self.env.get(x, y) if particle is None: continue pyxel.rect(x, y, 1, 1, particle.color) pyxel.text(2, 2, "Press numbers 1-3 to switch particles", 7)
def draw(self): pyxel.cls(12) # draw sky pyxel.blt(0, 88, 0, 0, 88 + self.plus, 160, 32) # draw mountain pyxel.blt(0, 88, 0, 0, 64, 160 + self.plus, 24, 12) # draw forest offset = pyxel.frame_count % 160 for i in range(2): pyxel.blt(i * 160 - offset, 104, 0, 0, 48, 160 + self.plus, 16, 12) # draw clouds offset = (pyxel.frame_count // 16) % 160 for i in range(2): for x, y in self.far_cloud: pyxel.blt(x + i * 160 - offset, y, 0, 64, 32, 32 + self.plus, 8, 12) offset = (pyxel.frame_count // 8) % 160 for i in range(2): for x, y in self.near_cloud: pyxel.blt(x + i * 160 - offset, y, 0, 0, 32, 56 + self.plus, 8, 12) # draw floors for x, y, is_active in self.floor: pyxel.blt(x, y, 0, 0, 16, 40 + self.plus, 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 + self.plus, 16, 12) # draw player pyxel.blt( self.player_x, self.player_y, 0, 16 if self.player_vy > 0 else 0, 0, 16 + self.plus, 16, 12, ) # draw score s = "SCORE {:>4}".format(self.score) pyxel.text(5, 4, s, 1) pyxel.text(4, 4, s, 7)
def draw(): global header, which_turn, one_score, two_score, weight, cannot_put, gameEnd pyxel.cls(9) pyxel.rect(0, header, 200, 200, 3) pyxel.circ(50, 35, 10, 7) if which_turn == 1: pyxel.rect(80, 10, 40, 15, 7) else: pyxel.rect(80, 10, 40, 15, 0) pyxel.text(75 + 5, 33, str(one_score), 7) pyxel.circ(150, 35, 10, 0) pyxel.text(125 - 12, 33, str(two_score), 0) pyxel.text(83, 15, "{}P's turn".format(which_turn), 5) for i in range(7): pyxel.rect(i * 33, header, 2, 200, 0) pyxel.rect(0, header + (i * 33), 200, 2, 0) for i in range(1, 7): for j in range(1, 7): tx = i - 1 ty = j - 1 margin = 17 if board[i][j] == 1: #白 pyxel.circ(ty * 33 + margin, tx * 33 + margin + header, 14, 7) pyxel.text(ty * 33 - 1 + margin, tx * 33 + margin + header - 2, str(weight[i][j]), 0) elif board[i][j] == 2: #黒 pyxel.circ(ty * 33 + margin, tx * 33 + margin + header, 14, 0) pyxel.text(ty * 33 - 1 + margin, tx * 33 + margin + header - 2, str(weight[i][j]), 7) if okeru[i][j] == 3: pyxel.circ(ty * 33 + margin, tx * 33 + margin + header, 14, 10) if cannot_put == True and gameEnd == 0: pyxel.rect(40, 125, 120, 25, 15) pyxel.text(50, 130, "there is no place to put", 0) pyxel.text(75, 140, "click to pass", 0) if gameEnd == 1: pyxel.rect(40, 125, 120, 25, 15) pyxel.text(50, 130, "1P win!", 0) if gameEnd == 2: pyxel.rect(40, 125, 120, 25, 15) pyxel.text(50, 130, "2P win!", 0) if gameEnd == 3: pyxel.rect(40, 125, 120, 25, 15) if one_score > two_score: pyxel.text(85, 135, "1P win!", 0) elif two_score > one_score: pyxel.text(85, 135, "2P win!", 0) else: pyxel.text(90, 135, "draw", 0)
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)
def _draw(self): blink = itertools.cycle([True]*18+[False]*18).__next__ for _ in range(30*6): pyxel.cls(0) draw_score() self.frame_count += 1 pyxel.text(self.frame_count, self.frame_count, f"{self.frame_count}", 7) if blink(): pyxel.text(60, 120, "Demo Scene", 7) yield if btnpA(): break yield TitleState()
def draw(self): pyxel.cls(5) if self.facing_left: m = 1 else: m = -1 # if self.heart == False: # pyxel.blt(self.player_x, self.player_y, 0, 0, 0, 16*m, 16, 5) # else: # pyxel.blt(self.player_x, self.player_y, 0, 0, 16, 16*m, 16, 5) pyxel.rect(self.player_x, self.player_y, self.player_x + 8, self.player_y + 8, 1)
def draw(): global koritsi_x, koritsi_y, clown_x, clown_y pyxel.cls(0) koritsi_x = koritsi_x + koritsi_dx koritsi_y = koritsi_y + koritsi_dy pyxel.blt(koritsi_x, koritsi_y, 0, 0, 0, 16, 16) if koritsi_tsirizi: pyxel.blt(koritsi_x + 10, koritsi_y + 2, 0, 32, 0, 8, 8, 0) clown_x = clown_x + clown_dx clown_y = clown_y + clown_dy pyxel.blt(clown_x, clown_y, 0, 18, 0, 12, 16, 0)
def draw_intro(self): pyxel.cls(3) if not self.played_dad_music: self.played_dad_music = True pyxel.playm(3, loop=True) pyxel.rect(0, 0, SCREEN_WIDTH, 48, 0) pyxel.blt(SCREEN_MARGIN, SCREEN_MARGIN, 0, DAD[0], DAD[1], 32, 32, 0) pyxel.text(48, SCREEN_MARGIN, self.DAD_LINES[self.WHAT_LINE_IS_IT_ANYWAYS], 7) if pyxel.btnp(pyxel.KEY_SPACE): self.WHAT_LINE_IS_IT_ANYWAYS = self.WHAT_LINE_IS_IT_ANYWAYS + 1 if self.WHAT_LINE_IS_IT_ANYWAYS > 13: self.intro = False
def draw_loading(self): """ ロード画面を描画 """ # ウサギがジャンプする画像を表示 if self.flip: tm_x = 32 tm_y = 0 else: tm_x = 16 tm_y = 0 pyxel.cls(7) pyxel.bltm(0, 0, 0, tm_x, tm_y, 16, 16) self.flash_object()
def draw(self): pyxel.cls(0) # 地面を描画 pyxel.rect(0, self.GROUND_Y, pyxel.width, pyxel.height, 4) px = self.x py = self.y if self.state == State.RECOVERY: if self.recovery_frame % 2 == 0: py += self.recovery_frame / 4 pyxel.blt(px, py, 0, 0, 0, 16, 16, 5)