.. _example-code: Examples ======== Starting Templates ------------------ .. figure:: images/thumbs/starting_template.png :figwidth: 170px :target: starting_template.html :ref:`starting_template` .. figure:: images/thumbs/template_platformer.png :figwidth: 170px :target: template_platformer.html :ref:`template_platformer` Primitives ---------- Drawing Primitives ^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/happy_face.png :figwidth: 170px :target: happy_face.html :ref:`happy_face` .. figure:: images/thumbs/drawing_primitives.png :figwidth: 170px :target: drawing_primitives.html :ref:`drawing_primitives` .. figure:: images/thumbs/drawing_text.png :figwidth: 170px :target: drawing_text.html :ref:`drawing_text` .. figure:: images/thumbs/drawing_text_objects.png :figwidth: 170px :target: drawing_text_objects.html :ref:`drawing_text_objects` .. figure:: images/thumbs/drawing_text_objects.png :figwidth: 170px :target: drawing_text_objects_batch.html :ref:`drawing_text_objects_batch` Animating Drawing Primitives ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/bouncing_rectangle.png :figwidth: 170px :target: bouncing_rectangle.html :ref:`bouncing_rectangle` .. figure:: images/thumbs/shapes.png :figwidth: 170px :target: shapes.html#shapes-slow :ref:`shapes-slow` .. figure:: images/thumbs/radar_sweep.png :figwidth: 170px :target: radar_sweep.html :ref:`radar_sweep` .. figure:: images/thumbs/snow.png :figwidth: 170px :target: snow.html :ref:`snow` .. _shape-element-lists: Faster Drawing with ShapeElementLists ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/shape_list_demo.png :figwidth: 170px :target: shape_list_demo.html :ref:`shape_list_demo` .. figure:: images/thumbs/lines_buffered.png :figwidth: 170px :target: lines_buffered.html :ref:`lines_buffered` .. figure:: images/thumbs/shape_list_demo_skylines.png :figwidth: 170px :target: shape_list_demo_skylines.html :ref:`shape_list_demo_skylines` .. figure:: images/thumbs/gradients.png :figwidth: 170px :target: gradients.html :ref:`gradients` .. _sprite_examples: Sprites ------- .. _sprite_player_movement: Player Movement ^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_collect_coins.png :figwidth: 170px :target: sprite_collect_coins.html :ref:`sprite_collect_coins` .. figure:: images/thumbs/sprite_collect_coins.png :figwidth: 170px :target: sprite_move_keyboard.html :ref:`sprite_move_keyboard` .. figure:: images/thumbs/sprite_collect_coins.png :figwidth: 170px :target: sprite_move_keyboard_better.html :ref:`sprite_move_keyboard_better` .. figure:: images/thumbs/sprite_collect_coins.png :figwidth: 170px :target: sprite_move_keyboard_accel.html :ref:`sprite_move_keyboard_accel` .. figure:: images/thumbs/sprite_move_angle.png :figwidth: 170px :target: sprite_move_angle.html :ref:`sprite_move_angle` .. figure:: images/thumbs/sprite_face_left_or_right.png :figwidth: 170px :target: sprite_face_left_or_right.html :ref:`sprite_face_left_or_right` .. figure:: images/thumbs/sprite_collect_coins.png :figwidth: 170px :target: sprite_move_controller.html :ref:`sprite_move_controller` .. figure:: images/thumbs/dual_stick_shooter.png :figwidth: 170px :target: dual_stick_shooter.html :ref:`dual_stick_shooter` .. figure:: images/thumbs/turn_and_move.png :figwidth: 170px :target: turn_and_move.html :ref:`turn_and_move` .. figure:: images/thumbs/sprite_rotate_around_tank.png :figwidth: 170px :target: sprite_rotate_around_tank.html :ref:`sprite_rotate_around_tank` Non-Player Movement ^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_collect_coins_move_down.png :figwidth: 170px :target: sprite_collect_coins_move_down.html :ref:`sprite_collect_coins_move_down` .. figure:: images/thumbs/sprite_collect_coins_move_bouncing.png :figwidth: 170px :target: sprite_collect_coins_move_bouncing.html :ref:`sprite_collect_coins_move_bouncing` .. figure:: images/thumbs/sprite_bouncing_coins.png :figwidth: 170px :target: sprite_bouncing_coins.html :ref:`sprite_bouncing_coins` .. figure:: images/thumbs/sprite_collect_coins_move_circle.png :figwidth: 170px :target: sprite_collect_coins_move_circle.html :ref:`sprite_collect_coins_move_circle` .. figure:: images/thumbs/sprite_collect_rotating.png :figwidth: 170px :target: sprite_collect_rotating.html :ref:`sprite_collect_rotating` .. figure:: images/thumbs/sprite_rotate_around_point.png :figwidth: 170px :target: sprite_rotate_around_point.html :ref:`sprite_rotate_around_point` Easing ^^^^^^ .. figure:: images/thumbs/easing_example_1.png :figwidth: 170px :target: easing_example_1.html :ref:`easing_example_1` .. figure:: images/thumbs/easing_example_2.png :figwidth: 170px :target: easing_example_2.html :ref:`easing_example_2` Calculating a Path ^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/follow_path.png :figwidth: 170px :target: follow_path.html :ref:`follow_path` .. figure:: images/thumbs/sprite_follow_simple.png :figwidth: 170px :target: sprite_follow_simple.html :ref:`sprite_follow_simple` .. figure:: images/thumbs/sprite_follow_simple_2.png :figwidth: 170px :target: sprite_follow_simple_2.html :ref:`sprite_follow_simple_2` .. figure:: images/thumbs/line_of_sight.png :figwidth: 170px :target: line_of_sight.html :ref:`line_of_sight` .. figure:: images/thumbs/astar_pathfinding.png :figwidth: 170px :target: astar_pathfinding.html :ref:`astar_pathfinding` Sprite Properties ^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_health.png :figwidth: 170px :target: sprite_health.html :ref:`sprite_health` .. figure:: images/thumbs/sprite_properties.png :figwidth: 170px :target: sprite_properties.html :ref:`sprite_properties` .. figure:: images/thumbs/sprite_change_coins.png :figwidth: 170px :target: sprite_change_coins.html :ref:`sprite_change_coins` .. figure:: images/thumbs/sprite_depth_cosine.png :figwidth: 170px :target: sprite_depth_cosine.html :ref:`sprite_depth_cosine` Games with Levels ^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_collect_coins_diff_levels.gif :figwidth: 170px :target: example-sprite-collect-coins-diff-levels.html :ref:`example-sprite-collect-coins-diff-levels` .. figure:: images/thumbs/sprite_rooms.png :figwidth: 170px :target: sprite_rooms.html :ref:`sprite_rooms` Shooting with Sprites ^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_bullets.png :figwidth: 170px :target: sprite_bullets.html :ref:`sprite_bullets` .. figure:: images/thumbs/sprite_bullets_aimed.png :figwidth: 170px :target: sprite_bullets_aimed.html :ref:`sprite_bullets_aimed` .. figure:: images/thumbs/sprite_bullets_periodic.png :figwidth: 170px :target: sprite_bullets_periodic.html :ref:`sprite_bullets_periodic` .. figure:: images/thumbs/sprite_bullets_random.png :figwidth: 170px :target: sprite_bullets_random.html :ref:`sprite_bullets_random` .. figure:: images/thumbs/sprite_bullets_enemy_aims.png :figwidth: 170px :target: sprite_bullets_enemy_aims.html :ref:`sprite_bullets_enemy_aims` .. figure:: images/thumbs/sprite_explosion_bitmapped.png :figwidth: 170px :target: sprite_explosion_bitmapped.html :ref:`sprite_explosion_bitmapped` .. figure:: images/thumbs/sprite_explosion_particles.png :figwidth: 170px :target: sprite_explosion_particles.html :ref:`sprite_explosion_particles` Audio ----- Sound Effects ^^^^^^^^^^^^^ .. figure:: images/thumbs/sound_demo.png :figwidth: 170px :target: sound_demo.html :ref:`sound_demo` .. figure:: images/thumbs/sound_speed_demo.png :figwidth: 170px :target: sound_speed_demo.html :ref:`sound_speed_demo` Music ^^^^^ .. figure:: images/thumbs/music_control_demo.png :figwidth: 170px :target: music_control_demo.html :ref:`music_control_demo` Display Management ------------------ Resizable Windows ^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/resizable_window.png :figwidth: 170px :target: resizable_window.html :ref:`resizable_window` .. figure:: images/thumbs/full_screen_example.png :figwidth: 170px :target: full_screen_example.html :ref:`full_screen_example` Backgrounds ^^^^^^^^^^^ .. figure:: images/thumbs/sprite_collect_coins_background.png :figwidth: 170px :target: sprite_collect_coins_background.html :ref:`sprite_collect_coins_background` .. figure:: images/thumbs/background_parallax.png :figwidth: 170px :target: background_parallax.html :ref:`background_parallax` .. _camera_examples: Cameras ^^^^^^^ .. figure:: images/thumbs/sprite_move_scrolling.png :figwidth: 170px :target: sprite_move_scrolling.html :ref:`sprite_move_scrolling` .. figure:: images/thumbs/sprite_move_scrolling_box.png :figwidth: 170px :target: sprite_move_scrolling_box.html :ref:`sprite_move_scrolling_box` .. figure:: images/thumbs/sprite_move_scrolling.png :figwidth: 170px :target: sprite_move_scrolling_shake.html :ref:`sprite_move_scrolling_shake` .. figure:: images/thumbs/camera_platform.png :figwidth: 170px :target: camera_platform.html :ref:`camera_platform` .. _view_examples: View Management --------------- Instruction and Game Over Screens ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/view_screens_minimal.png :figwidth: 170px :target: view_screens_minimal.html :ref:`view_screens_minimal` .. figure:: images/thumbs/view_instructions_and_game_over.png :figwidth: 170px :target: view_instructions_and_game_over.html :ref:`view_instructions_and_game_over` .. figure:: images/thumbs/view_pause_screen.png :figwidth: 170px :target: view_pause_screen.html :ref:`view_pause_screen` .. figure:: images/thumbs/view_screens_minimal.png :figwidth: 170px :target: transitions.html :ref:`transitions` .. _section_examples: Sectioning a View ^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sections_demo_1.png :figwidth: 170px :target: sections_demo_1.html :ref:`sections_demo_1` .. figure:: images/thumbs/sections_demo_2.png :figwidth: 170px :target: sections_demo_2.html :ref:`sections_demo_2` .. figure:: images/thumbs/sections_demo_3.png :figwidth: 170px :target: sections_demo_3.html :ref:`sections_demo_3` Platformers ----------- Basic Platformers ^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_move_walls.png :figwidth: 170px :target: sprite_move_walls.html :ref:`sprite_move_walls` .. figure:: images/thumbs/sprite_no_coins_on_walls.png :figwidth: 170px :target: sprite_no_coins_on_walls.html :ref:`sprite_no_coins_on_walls` .. figure:: images/thumbs/sprite_move_animation.gif :figwidth: 170px :target: sprite_move_animation.html :ref:`sprite_move_animation` .. figure:: images/thumbs/sprite_moving_platforms.png :figwidth: 170px :target: sprite_moving_platforms.html :ref:`sprite_moving_platforms` .. figure:: images/thumbs/sprite_enemies_in_platformer.png :figwidth: 170px :target: sprite_enemies_in_platformer.html :ref:`sprite_enemies_in_platformer` .. figure:: images/thumbs/11_animate_character.png :figwidth: 170px :target: platformer_tutorial.html :ref:`platformer_tutorial` Tiled Map Editor ^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/sprite_tiled_map.png :figwidth: 170px :target: sprite_tiled_map.html :ref:`sprite_tiled_map` .. figure:: images/thumbs/sprite_tiled_map_with_levels.png :figwidth: 170px :target: sprite_tiled_map_with_levels.html :ref:`sprite_tiled_map_with_levels` Procedural Generation ^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/maze_recursive.png :figwidth: 170px :target: maze_recursive.html :ref:`maze_recursive` .. figure:: images/thumbs/maze_depth_first.png :figwidth: 170px :target: maze_depth_first.html :ref:`maze_depth_first` .. figure:: images/thumbs/procedural_caves_cellular.png :figwidth: 170px :target: procedural_caves_cellular.html :ref:`procedural_caves_cellular` .. figure:: images/thumbs/procedural_caves_bsp.png :figwidth: 170px :target: procedural_caves_bsp.html :ref:`procedural_caves_bsp` .. _gui_examples_overview: Graphical User Interface ------------------------ .. figure:: images/thumbs/gui_0_basic_setup.png :figwidth: 170px :target: gui_0_basic_setup.html :ref:`gui_0_basic_setup` .. figure:: images/thumbs/gui_1_layouts.png :figwidth: 170px :target: gui_1_layouts.html :ref:`gui_1_layouts` .. figure:: images/thumbs/gui_2_widgets.png :figwidth: 170px :target: gui_2_widgets.html :ref:`gui_2_widgets` .. figure:: images/thumbs/gui_3_buttons.png :figwidth: 170px :target: gui_3_buttons.html :ref:`gui_3_buttons` .. figure:: images/thumbs/gui_4_with_camera.png :figwidth: 170px :target: gui_4_with_camera.html :ref:`gui_4_with_camera` .. figure:: images/thumbs/gui_5_uicolor_picker.png :figwidth: 170px :target: gui_5_uicolor_picker.html :ref:`gui_5_uicolor_picker` .. figure:: images/thumbs/gui_6_size_hints.png :figwidth: 170px :target: gui_6_size_hints.html :ref:`gui_6_size_hints` .. figure:: images/thumbs/gui_own_widgets.png :figwidth: 170px :target: gui_own_widgets.html :ref:`gui_own_widgets` .. figure:: images/thumbs/gui_own_layout.png :figwidth: 170px :target: gui_own_layout.html :ref:`gui_own_layout` .. note:: Not all existing examples made it into this section. You can find more under `Arcade GUI Examples `_ Experimental Widgets ^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/gui_exp_hidden_password.png :figwidth: 170px :target: gui_exp_hidden_password.html :ref:`gui_exp_hidden_password` .. note:: Experimental widgets are not yet part of the official release. They are subject to change and may not be fully functional. Feedback is very welcome, please let us know what you think about them. Grid-Based Games ---------------- .. figure:: images/thumbs/array_backed_grid.png :figwidth: 170px :target: array_backed_grid.html :ref:`array_backed_grid` .. figure:: images/thumbs/array_backed_grid.png :figwidth: 170px :target: array_backed_grid_buffered.html :ref:`array_backed_grid_buffered` .. figure:: images/thumbs/array_backed_grid.png :figwidth: 170px :target: array_backed_grid_sprites_1.html :ref:`array_backed_grid_sprites_1` .. figure:: images/thumbs/array_backed_grid.png :figwidth: 170px :target: array_backed_grid_sprites_2.html :ref:`array_backed_grid_sprites_2` .. figure:: images/thumbs/tetris.png :figwidth: 170px :target: tetris.html :ref:`tetris` .. figure:: images/thumbs/conway_alpha.png :figwidth: 170px :target: conway_alpha.html :ref:`conway_alpha` Advanced -------- .. _example-code-pymunk: Using PyMunk for Physics ^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: images/thumbs/pymunk_box_stacks.png :figwidth: 170px :target: pymunk_box_stacks.html :ref:`pymunk_box_stacks` .. figure:: images/thumbs/pymunk_pegboard.png :figwidth: 170px :target: pymunk_pegboard.html :ref:`pymunk_pegboard` .. figure:: images/thumbs/pymunk_demo_top_down.png :figwidth: 170px :target: pymunk_demo_top_down.html :ref:`pymunk_demo_top_down` .. figure:: images/thumbs/pymunk_joint_builder.png :figwidth: 170px :target: pymunk_joint_builder.html :ref:`pymunk_joint_builder` .. figure:: images/thumbs/pymunk_platformer.png :figwidth: 170px :target: pymunk_platformer_tutorial.html :ref:`pymunk_platformer_tutorial` Frame Buffers ^^^^^^^^^^^^^ .. figure:: images/thumbs/minimap.png :figwidth: 170px :target: minimap.html :ref:`minimap` .. figure:: images/thumbs/light_demo.png :figwidth: 170px :target: light_demo.html :ref:`light_demo` .. figure:: images/thumbs/transform_feedback.png :figwidth: 170px :target: transform_feedback.html :ref:`transform_feedback` .. figure:: images/thumbs/game_of_life_fbo.png :figwidth: 170px :target: game_of_life_fbo.html :ref:`game_of_life_fbo` .. figure:: images/thumbs/perspective.png :figwidth: 170px :target: perspective.html :ref:`perspective` .. figure:: images/thumbs/depth_of_field.png :figwidth: 170px :target: depth_of_field.html :ref:`depth_of_field` .. _opengl: OpenGL ^^^^^^ .. figure:: images/thumbs/normal_mapping.png :figwidth: 170px :target: normal_mapping.html :ref:`normal_mapping` .. figure:: images/thumbs/spritelist_interaction_visualize_dist_los.png :figwidth: 170px :target: spritelist_interaction_visualize_dist_los.html :ref:`spritelist_interaction_visualize_dist_los` .. _concept_games: Concept Games ------------- .. figure:: images/thumbs/asteroid_smasher.png :figwidth: 170px :target: asteroid_smasher.html :ref:`asteroid_smasher` .. figure:: https://raw.githubusercontent.com/pythonarcade/asteroids/main/screenshot.png :figwidth: 170px :target: https://github.com/pythonarcade/asteroids `Asteroids with Shaders `_ .. figure:: images/thumbs/slime_invaders.png :figwidth: 170px :target: slime_invaders.html :ref:`slime_invaders` .. figure:: images/thumbs/community-rpg.png :figwidth: 170px :target: https://github.com/pythonarcade/community-rpg `Community RPG `_ .. figure:: images/thumbs/2048.png :figwidth: 170px :target: https://github.com/pvcraven/2048 `2048 `_ .. figure:: images/thumbs/rogue_like.png :figwidth: 170px :target: https://github.com/pythonarcade/roguelike `Rogue-Like `_ Odds and Ends ------------- .. figure:: images/thumbs/timer.png :figwidth: 170px :target: timer.html :ref:`timer` .. figure:: images/thumbs/performance_statistics.png :figwidth: 170px :target: performance_statistics_example.html :ref:`performance_statistics_example` .. figure:: images/thumbs/text_loc_example_translated.png :figwidth: 170px :target: text_loc_example.html :ref:`text_loc_example` Particle System ^^^^^^^^^^^^^^^ .. figure:: images/thumbs/particle_fireworks.png :figwidth: 170px :target: particle_fireworks.html :ref:`particle_fireworks` .. figure:: images/thumbs/particle_systems.png :figwidth: 170px :target: particle_systems.html :ref:`particle_systems` Tutorials --------- .. figure:: /tutorials/platform_tutorial/intro_screen.png :figwidth: 170px :target: /tutorials/platform_tutorial/index.html :ref:`platformer_tutorial` .. figure:: images/thumbs/solitaire_11.png :figwidth: 170px :target: /tutorials/card_game/index.html :ref:`solitaire_tutorial` .. figure:: images/thumbs/crt_filter.png :figwidth: 170px :target: /tutorials/crt_filter/index.html :ref:`crt_filter` .. figure:: images/thumbs/raycasting_tutorial.png :figwidth: 170px :target: /tutorials/raycasting/index.html :ref:`raycasting_tutorial` .. figure:: images/thumbs/pymunk_platformer_tutorial.png :figwidth: 170px :target: /tutorials/pymunk_platformer/index.html :ref:`pymunk_platformer_tutorial` .. figure:: images/thumbs/shader_toy_tutorial.png :figwidth: 170px :target: /tutorials/shader_toy_glow/index.html :ref:`shader_toy_tutorial_glow` Stress Tests ------------ .. figure:: images/thumbs/stress_test_draw_moving.png :figwidth: 170px :target: stress_test_draw_moving.html :ref:`stress_test_draw_moving` .. figure:: images/thumbs/stress_test_collision.png :figwidth: 170px :target: stress_test_collision.html :ref:`stress_test_collision`