Snake game in Python: use Pygame to build your game

von
Coursera Project Network
In diesem angeleitetes Projekt werden Sie:

Learn pygame library and its different modules and functions.

Apply programming techniques in game development.

Clock1 hour 40 minutes
IntermediateMittel
CloudKein Download erforderlich
VideoVideo auf geteiltem Bildschirm
Comment DotsEnglisch
LaptopNur Desktop

In this 1-hour long project-based course, you will be able to create the famous snake game using Python and Pygame modules, also you will be able to identify most of the objects and functions in the pygame library that will help you to build your own game projects. This includes applying draw, time, and display modules, handling different types of events, and defining functions for completing the game logic. Python language is one of the most accessible programming languages available because of Its simplified syntax that gives emphasis on natural language. Python and Pygame are good languages and framework for rapid game prototyping or for beginners learning how to make simple games. Note: This project works best for learners who are based in the North America region. We’re currently working on providing the same experience in other regions.

Kompetenzen, die Sie erwerben werden

  • Video Game Development
  • Pygame library
  • Python Programming
  • Pygame
  • Game Programming

Schritt für Schritt lernen

In einem Video, das auf einer Hälfte Ihres Arbeitsbereichs abgespielt wird, führt Sie Ihr Dozent durch diese Schritte:

  1. By the end of Task 1, you will be able to initiate Pygame and create the first game screen.

  2. By the end of Task 2, you will be able to create RGB colors to draw rectangles and change the desktop background color.

  3. By the end of Task 3, you will be able to handle key down events, and apply the time module for controlling the snake speed.

  4. By the end of Task 4, you will be able to use if conditions for controlling the game logic and define the game_loop function.

  5. By the end of Task 5, you will be able to use different font functions to show messages on the screen, and use the random library to create food objects.

  6. By the end of Task 6, you will be able to use lists and logics to increase the length of the snake when eating the food.

  7. By the end of Task 7, you will be able to display the score on the screen, finalize the game logic, and implement the full generic game code.

Ablauf angeleiteter Projekte

Ihr Arbeitsbereich ist ein Cloud-Desktop direkt in Ihrem Browser, kein Download erforderlich

Ihr Dozent leitet Sie in einem Video mit geteiltem Bildschirm Schritt für Schritt an.

Häufig gestellte Fragen

Häufig gestellte Fragen

Haben Sie weitere Fragen? Besuchen Sie das Learner Help Center.