def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured( 0, 0, WIDTH, HEIGHT, self.rooms[self.current_room].background) self.rooms[self.current_room].wall_list.draw() self.player_list.draw()
def draw(self): if self.background is not None: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) if self.bucket_list is not None: self.bucket_list.draw() if self.object_list is not None: self.object_list.draw() if self.selected_bucket is not None: arcade.draw_rectangle_outline( self.bucket_list[self.selected_bucket].center_x, self.bucket_list[self.selected_bucket].center_y, self.bucket_list[self.selected_bucket].height * 1.2, self.bucket_list[self.selected_bucket].width * 1.2, self.bucket_list[self.selected_bucket].color, (self.tick % 12) + 2, 0) arcade.draw_text( "Time Left {:d}".format(int( (self.length - self.tick) / 60)), (SCREEN_WIDTH / 6) * 4, SCREEN_HEIGHT - (SCREEN_HEIGHT / 10), arcade.color.BLACK, 60) arcade.draw_text("Score: {}".format(self.score), 0, (SCREEN_HEIGHT / 10) * 9, arcade.color.RED, 64) if self.tick > self.length: arcade.draw_text("GAME OVER", (SCREEN_WIDTH / 5) * 1, (SCREEN_HEIGHT / 6) * 3, arcade.color.BLACK, 128)
def on_draw(self): """ Draw this view """ arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, constants.MAX_X, constants.MAX_Y, self.background) arcade.draw_text("You made it past Wave 5! You Win!", constants.MAX_X / 2, 700, arcade.color.WHITE, font_size=50, anchor_x="center") arcade.draw_text( f"Your score was: {self.cast['score'][0].get_score()} ", constants.MAX_X / 2, 90, arcade.color.WHITE, font_size=50, anchor_x="center") arcade.draw_text("Click Anywhere to Go to Main Menu", constants.MAX_X / 2, constants.MAX_Y / 50, arcade.color.WHITE, font_size=20, anchor_x="center")
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.load_texture("png_ground/BG/BG.png")) arcade.draw_text("INSTRUCTION", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 1.2, arcade.color.BLACK, font_size=50, anchor_x="center") arcade.draw_text("Collect coins and find the exit!", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 1.5, arcade.color.ORANGE_PEEL, font_size=50, anchor_x="center") arcade.draw_text( "Use arrow keys to run and space bar for jump.\n\n" "Press P to pause the game", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2.3, arcade.color.BLACK, font_size=30, anchor_x="center") draw_menu_button()
def on_draw(self): """ Draw the menu """ arcade.start_render() arcade.draw_lrwh_rectangle_textured( bottom_left_x=self.game_view.view_left, bottom_left_y=self.game_view.view_bottom, width=SCREEN_WIDTH, height=SCREEN_HEIGHT, texture=arcade.load_texture("images/JWDLx5AZBtI.jpg"), alpha=200) arcade.draw_scaled_texture_rectangle( self.game_view.view_left + 400, self.game_view.view_bottom + 150, arcade.load_texture("images/Tiles/lockRed.png"), scale=1.4) arcade.draw_text("GAME OVER", self.game_view.view_left + 400, self.game_view.view_bottom + 400, arcade.color.BLACK, font_size=50, anchor_x="center") arcade.draw_text("PRESS ENTER TO REPLAY", self.game_view.view_left + 400, self.game_view.view_bottom + 300, arcade.color.ORANGE_PEEL, font_size=30, anchor_x="center") PauseView(self.game_view).draw_menu_gameplay() self.game_view.update_score()
def on_draw(self): """ Called automatically by the arcade framework. Handles the responsiblity of drawing all elements. """ # clear the screen to begin drawing arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) self.dashboard.draw() self.draw_score() self.bullets.draw() self.meteors.draw() #Check if the ship is still alive if (self.ship.alive): self.ship.draw() #Render current animations self.animations.draw() #Verify if animations have been loaded else display a "get ready" message if (not self.animationsLoaded): self.draw_get_ready() #Draw the hearts on the screen self.lifeList.draw()
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, self.width, self.height, self.background) arcade.draw_text( "Flawless", self.width // 2, self.height * 0.90, TEXT_COLOR, 20, anchor_x="center", ) field = self.field_list[self.selection_index] arcade.draw_rectangle_outline( center_x=field.x - 40, center_y=field.y + 8, width=self.width // 8 - 20, height=30, color=TEXT_COLOR, ) for field in self.field_list: field.draw() self.draw_information_text(TEXT_COLOR, nav=True)
def on_draw(self): """ Draw this view """ arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.intro_background) arcade.draw_rectangle_filled(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 800, 115, arcade.color.NAVY_BLUE, 0) arcade.draw_text("Interactive Astronomy Observation (at Hamilton!)", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, arcade.color.WHITE, font_size=25, anchor_x="center") arcade.draw_text("Summer of Code 2020", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 50, arcade.color.WHITE, font_size=20, anchor_x="center") arcade.draw_text("[Click to begin]", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 250, arcade.color.WHITE, font_size=20, anchor_x="center")
def on_draw(self): """ Called automatically by the arcade framework. Handles the responsibility of drawing all elements. """ # clear the screen to begin drawing arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) # TODO: draw each object self.draw_score() self.draw_level() self.ship.draw(self.ship_img) for rock in self.rocks: if type(rock) == Big_Rock: rock.draw(self.big_rock_img) elif type(rock) == Mid_Rock: rock.draw(self.mid_rock_img) else: rock.draw(self.small_rock_img) for laser in self.lasers: laser.draw(self.laser_img) if self.over: self.game_over()
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, 1500, 800, self.backgroundVictoria) arcade.draw_text("VICTORIA", 500, 600, arcade.color.WHITE, 100) time_taken_formatted = f"{round(self.time_taken,2)} segundos" arcade.draw_text(f"Tiempo: {time_taken_formatted}", 700, 500, arcade.color.WHITE, font_size=15, anchor_x="center") output_total = f"Puntuacion Total: {self.window.total_score} puntos" arcade.draw_text(output_total, 600, 450, arcade.color.WHITE, 14) arcade.draw_text("Para volver a jugar pulsa: R", 700, 400, arcade.color.WHITE, font_size=15, anchor_x="center") arcade.draw_text("Para volver al menu: M", 700, 350, arcade.color.WHITE, font_size=15, anchor_x="center") arcade.draw_text("Para salir del juego: ESC", 700, 300, arcade.color.WHITE, font_size=15, anchor_x="center")
def on_draw(self): arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) self.sprite_list.draw() self.on_draw_chat() # self.on_draw_board() self.on_draw_hud()
def genera_texto(self, text): arcade.draw_lrwh_rectangle_textured( self.view_left, self.player_sprite.center_y / 5.15, WIDTH, HEIGHT / 2, arcade.load_texture("resources" + os.path.sep + "sprites" + os.path.sep + "messages" + os.path.sep + text))
def on_draw(self): """ Called automatically by the arcade framework. Handles the responsibility of drawing all elements. """ # clear the screen to begin drawing arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background, 0, 255) self.lives.draw() for x in self.rock_list: x.draw() for bullet in self.magazine: bullet.draw() if self.ship.alive: self.ship.draw() elif (self.ship.alive is False) and (self.lives.lives > 0): self.ship = Ship() else: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.gameover, 0, 255)
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.backdrop) arcade.draw_rectangle_filled(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 50, SCREEN_WIDTH, 100, (127, 212, 23, 127)) arcade.draw_text_2(f"score:{self.score}", 50, SCREEN_HEIGHT - 20, arcade.color.WHITE, 15, align="center") arcade.draw_text_2(f"wave:{self.wave}", 50, SCREEN_HEIGHT - 70, arcade.color.WHITE, 15, align="center") arcade.draw_text_2(f"life:{self.Hero.getLifePoints()}", 400, SCREEN_HEIGHT - 20, arcade.color.WHITE, 15, align="center") self.Barriers.draw_wall_up() self.Hero.draw_hero() self.Enemys.drawEnemy() self.Barriers.draw_wall_down() self.Hero.bulletDraw()
def on_draw(self): """ Render the screen. """ # Clear the screen to the background color arcade.start_render() scale = constants.SCREEN_WIDTH / self.background.width arcade.draw_lrwh_rectangle_textured(self.view_left, self.view_bottom, constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT, self.background) # Draw our sprites self.wall_list.draw() self.tweet_list.draw() self.damage_list.draw() self.player_list.draw() self.tan_list.draw() self.enemy_list.draw() try: for projectile in self.player.projectiles: projectile.draw() except AttributeError: pass # Draw our score on the screen, scrolling it with the viewport score_text = f"Score: {self.score}" arcade.draw_text(score_text, 10 + self.view_left, 10 + self.view_bottom, arcade.csscolor.WHITE, 18) # Draw our health on the screen, scrolling it with the viewport health_text = f"Health: {self.player.health}" arcade.draw_text(health_text, 10 + self.view_left, 30 + self.view_bottom, arcade.csscolor.WHITE, 18)
def on_draw(self): """ Draw this view """ arcade.start_render() arcade.draw_text("PyCharmers", self.controlador.SCREEN_WIDTH / 2, self.controlador.SCREEN_HEIGHT / 2, arcade.color.BEAU_BLUE, font_size=50, anchor_x="center") """ Set up this view. """ self.ui_manager.purge_ui_elements() y_slot = self.window.height // 4 left_column_x = self.window.width // 2 backgound_menu = arcade.load_texture('assets/menu.png') button_normal = arcade.load_texture('assets/iconn.png') hovered_texture = arcade.load_texture('assets/iconn.png') pressed_texture = arcade.load_texture('assets/iconn.png') arcade.draw_lrwh_rectangle_textured(0, 0, self.controlador.SCREEN_WIDTH, self.controlador.SCREEN_HEIGHT, backgound_menu) button = arcade.gui.UIImageButton(center_x=left_column_x, center_y=y_slot * 1, normal_texture=button_normal, hover_texture=hovered_texture, press_texture=pressed_texture, text='') self.ui_manager.add_ui_element(button)
def on_draw(self): super().on_draw() # Draw the media arcade.draw_lrwh_rectangle_textured(self.bottom_left_x, self.bottom_left_y, self.width, self.height, self.media)
def on_draw( self ): # this method is called when program things it needs to draw something """ Render the screen. """ # This command has to happen before we start drawing arcade.start_render() #start rendering # Drawing the background image arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) # Drawing Lines # X is varying so it mean looping horizontally for x in range(0, SCREEN_WIDTH + 1, GRID_GAP): arcade.draw_line(x, 0, x, SCREEN_HEIGHT, arcade.color.WHITE_SMOKE, 3) # Y is varying sot looping vertically for x in range(0, SCREEN_HEIGHT + 1, GRID_GAP): arcade.draw_line(0, x, SCREEN_WIDTH, x, arcade.color.WHITE_SMOKE, 3) # Draw splases and draw snails self.splash_list.draw() self.coin_list.draw()
def on_draw(self): """ Draw the menu """ arcade.start_render() # Draw the background texture arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) arcade.draw_text("3", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 100, arcade.color.DARK_RED, font_size=200, anchor_x="center") arcade.draw_text("Math Blaster", SCREEN_WIDTH / 2 + 15, SCREEN_HEIGHT / 2, arcade.color.WHITE, font_size=60, anchor_x="center") arcade.draw_text("Click 'F1' for full screen or any key to advance", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 120, arcade.color.WHITE, font_size=20, anchor_x="center")
def on_draw(self): """ Render the screen. """ # This command has to happen before we start drawing arcade.start_render() # Draw the background texture arcade.draw_lrwh_rectangle_textured( 0, 0, 900, 790, self.rooms[self.current_room].background) # Draw all the walls in this room self.rooms[self.current_room].wall_list.draw() # If you have coins or monsters, then copy and modify the line # above for each list. self.player_list.draw() self.player_bullet_list.draw() self.rooms[self.current_room].health_power_up_list.draw() self.rooms[self.current_room].enemy_bullet_list.draw() self.rooms[self.current_room].coin_list.draw() self.rooms[self.current_room].enemy_list.draw() # Display score output = f"Score: {self.score}" arcade.draw_text(output, 10 + self.view_left, 20 + self.view_bottom, arcade.color.WHITE, 25) # Display hearts output = f"Hearts: {self.hearts}" arcade.draw_text(output, 10 + self.view_left, 50 + self.view_bottom, arcade.color.WHITE, 25)
def on_draw(self): """ Draw the menu """ arcade.start_render() arcade.draw_lrwh_rectangle_textured( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.load_texture("png_ground/BG/BG.png")) arcade.draw_lrwh_rectangle_textured( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.load_texture("images/level_select.png")) arcade.draw_text("SELECT THE LEVEL", SCREEN_WIDTH / 2, SCREEN_HEIGHT / 1.3, arcade.color.BLACK, font_size=30, anchor_x="center") arcade.draw_scaled_texture_rectangle(BUTTONS['first_level'][1], BUTTONS['first_level'][2], BUTTONS['first_level'][0], scale=0.7) arcade.draw_scaled_texture_rectangle(BUTTONS['second_level'][1], BUTTONS['second_level'][2], BUTTONS['second_level'][0], scale=0.7) arcade.draw_scaled_texture_rectangle(BUTTONS['escape_level'][1], BUTTONS['escape_level'][2], BUTTONS['escape_level'][0], scale=0.7)
def on_draw(self): """ Render the screen. """ # This command should happen before we start drawing. It will clear # the screen to the background color, and erase what we drew last frame. # Call draw() on all your sprite lists below """ Draw everything """ arcade.start_render() # Draw the background texture arcade.draw_lrwh_rectangle_textured( 0, 0, self.screen_width, self.screen_height, self.rooms[self.current_room].background) # Draw all the walls in this room self.rooms[self.current_room].wall_list.draw() self.player_list.draw() self.objectives.draw() self.explosions_list.draw() self.attack_list.draw() self.bullet_list.draw() # Put the text on the screen. # output = f"Score: {self.score} \n Position: {self.player.center_x} {self.player.center_y}" # output = f""" # Number: {self.current_player} # Name: {self.player_list[self.current_player].name} # Position: {self.player_list[self.current_player].center_x} {self.player_list[self.current_player].center_y} # """ output = f"Score: {self.actions.get_score()}\nPhase: {self.actions.get_phase()}\nAction: {self.actions.get_action()}" arcade.draw_text(output, 10, 20, arcade.color.BLACK, 14)
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.load_texture("png_ground/BG/BG.png")) self.show_table() draw_menu_button()
def draw_field(self): if self.background is not None: arcade.draw_lrwh_rectangle_textured(0, 0, self.box.box_sizes[0], self.box.box_sizes[1], self.background) else: arcade.cleanup_texture_cache() if self.box.field is None: return gx = numpy.arange(0, self.box.box_sizes[0], 50) gy = numpy.arange(0, self.box.box_sizes[1], 50) for x in gx: for y in gy: position = self.box.center.copy() position[0] = x position[1] = y value = 10 * self.box.field.equation(position=position) try: arcade.draw_line(x, y, x + value[0], y + value[1], [255, 255, 255], 1) arcade.draw_circle_filled(x + value[0], y + value[1], 2, [255, 255, 255]) except Exception: pass self.background = arcade.Texture("background", arcade.get_image(0, 0))
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured( 0, 0, constants.LEVEL_WIDTH, self.window.h, # 100 x 9 level self.background) self.platform_list.draw() self.enemy_list.draw() self.cashier.draw() self.player_list.draw() self.window.item_list.draw() tp_amount = arcade.load_texture( "assets/amounts/toilet_paper_amount.png") scale = 1 arcade.draw_scaled_texture_rectangle( max(120, self.view_left + 70), self.window.h - 35, tp_amount, scale, 0) score_text = f"{self.window.score}" arcade.draw_text(score_text, max(94, self.view_left + 44), self.window.h - 50, arcade.csscolor.BLACK, 18) if self.window.score < self.window.goal and arcade.check_for_collision(self.player, self.cashier): arcade.draw_text("Come back with 15 items", self.view_left + self.window.w / 2, self.window.h - 50, arcade.csscolor.CRIMSON, 24, anchor_x="center") elif self.window.score >= self.window.goal: arcade.draw_text("Find the cashier to checkout", self.view_left + self.window.w / 2, self.window.h - 50, arcade.csscolor.CRIMSON, 24, anchor_x="center")
def on_draw(self) -> None: """Show the widgets.""" arcade.start_render() # Draw the background arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) arcade.draw_text( self.window.caption, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, arcade.color.WHITE, font_size=30, anchor_x="center", ) arcade.draw_text( "Press S to start | Toggle instructions with I", SCREEN_WIDTH / 2, SCREEN_HEIGHT * 0.2, arcade.color.WHITE, font_size=30, anchor_x="center", )
def on_draw(self): """ Render the screen. """ # This command has to happen before we start drawing arcade.start_render() self.print_numlist.draw() ## LINES SEPARATING THE GRID ## arcade.draw_line(0, (2 / 3) * SCREEN_HEIGHT, SCREEN_WIDTH, (2 / 3) * SCREEN_HEIGHT, arcade.color.SILVER, line_width=7) arcade.draw_line(0, (1 / 3) * SCREEN_HEIGHT, SCREEN_WIDTH, (1 / 3) * SCREEN_HEIGHT, arcade.color.SILVER, line_width=7) arcade.draw_line((1 / 2) * SCREEN_WIDTH, 0, (1 / 2) * SCREEN_WIDTH, SCREEN_HEIGHT, arcade.color.SILVER, line_width=7) # Final screen telling user if they won or lost if self.correct == True: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.win) elif self.incorrect == True: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.lost)
def on_draw(self): arcade.start_render() self._background_controller.on_draw() CallbacksRegisterer.on_draw(self) if self._is_splash_screen_visible: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self._splash_screen)
def on_draw(self): """ Draw this view. GUI elements are automatically drawn. """ """ Draw this view """ arcade.start_render() backgound_menu = arcade.load_texture('assets/menu.png') arcade.draw_lrwh_rectangle_textured(0, 0, self.controlador.SCREEN_WIDTH, self.controlador.SCREEN_HEIGHT, backgound_menu) self.buttons_list.draw() arcade.draw_text("Continuar", self.window.width // 2, self.window.height // 4 * 1, arcade.csscolor.BLACK, 18, align="center", anchor_x="center", anchor_y="center", font_name='assets/Boxy-Bold.ttf') arcade.draw_text("Novo Jogo", self.window.width // 2, self.window.height // 4 * 2, arcade.csscolor.BLACK, 18, align="center", anchor_x="center", anchor_y="center", font_name='assets/Boxy-Bold.ttf')
def draw(self): # Draw the background texture (left, right, bottom, top) = viewport = arcade.get_viewport() arcade.draw_lrwh_rectangle_textured(left, bottom, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) # Draw the tiles super().draw()