- Saved searches
- Use saved searches to filter your results more quickly
- License
- PacktPublishing/Learning-Python-by-building-games
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Learn Python by Building 5 Games
- Build games using the command line, turtle, and Pygame
- Топ-8 игр, чтобы научиться программированию на Python
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Learning Python by building Games, published by Packt
License
PacktPublishing/Learning-Python-by-building-games
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Learning Python by Building Games
This is the code repository for Learning Python by Building Games, published by Packt.
A beginner’s guide to Python programming and game development
A fun and interactive way to get started with the Python language and its libraries is by getting hands-on with game development. Learning Python by Building Games brings you the best of both worlds. The book will first introduce you to Python fundamentals, which you will then use to develop a basic game. You’ll gradually explore the different Python libraries best suited for game development such as Pygame, Pyglet, and PyOpenGL. From building game characters through to using 3D animation techniques, you’ll discover how to create an aesthetic game environment. In addition to this, you’ll focus on game physics to give your effects a realistic feel, complete with movements and collisions. The book will also cover how you can use particle systems to simulate phenomena such as an explosion or smoke. In later chapters, you will gain insights into object-oriented programming by modifying a snake game, along with exploring GUI programming to build a user interface with Python’s turtle module.
This book covers the following exciting features:
- Explore core Python concepts by understanding Python libraries
- Build your first 2D game using Python scripting
- Understand concepts such as decorators and properties in the Python ecosystem
- Create animations and movements by building a Flappy Bird-like game
- Design game objects and characters using Pygame, PyOpenGL, and Pymunk
If you feel this book is for you, get your copy today!
Instructions and Navigations
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
n = int(input("Enter any number")) for i in range(1,100): if i == n: print(i) break
Following is what you need for this book: If you are completely new to Python or game programming and want to develop your programming skills, then this book is for you. The book also acts as a refresher for those who already have experience of using Python and want to learn how to build exciting games.
With the following software and hardware list you can run all code files present in the book (Chapter 1-16).
Software and Hardware List
Chapter | Software required | OS required |
---|---|---|
1 | Open Source Python installer version | Windows, Mac OS X, and Linux (Any) |
3.5+ is required | ||
1 | Open Source IDLE (Python pre-installed) | Windows, Mac OS X, and Linux (Any) |
2 | Python version 3.5+ | Windows, Mac OS X, and Linux (Any) |
3 to 4 | Python IDLE (comes preinstalled with python) | Windows, Mac OS X, and Linux (Any) |
5 | Open Source Curses Library[version 2.0+] | Windows, Mac OS X, and Linux (Any) |
6 to 7 | Python IDLE (comes preinstalled with python) | Windows, Mac OS X, and Linux (Any) |
8 | Python IDLE (comes preinstalled with python)/ | Windows, Mac OS X, and Linux (Any) |
turtle library (comes prebuilt) | ||
9 to 10 | Python IDLE (comes preinstalled with python) | Windows, Mac OS X, and Linux (Any) |
11 | Pycharm IDE Community Version 2018-2019.2+ | Windows, Mac OS X, and Linux (Any) |
11 to 13 | Pygame Library version 1.9.6[Python version 3.5+] | Windows, Mac OS X, and Linux (Any) |
14 | PyopenGL library version 3.1.0 | Windows, Mac OS X, and Linux (Any) |
15 | Pycharm IDE Community Version 2018-2019.2+ | Windows, Mac OS X, and Linux (Any) |
15 | Pymunk Library version 5.5.0 | Windows, Mac OS X, and Linux (Any) |
16 | Pygame Library version 1.9.6[Python version 3.5+] | Windows, Mac OS X, and Linux (Any) |
Click on the following link to see the Code in Action:
Sachin Kafle is a computer engineer from Tribhuvan University, Nepal, and a programming instructor currently living in Kathmandu. He is the founder of Bitfourstack Technologies, a software company that provides services including automation for real-time problems in businesses. One of his courses, named Python Game Development, is the best seller on many e-learning websites. His interests lie in software development and integration practices in the areas of computation and quantitative fields of trade. He has been utilizing his expertise in Python, C, Java, and C# by teaching since 2012. He has been a source of motivation to younger people, and even his peers, regardless of their educational background, who are embarking on their journey in programming.
Click here if you have any feedback or suggestions.
Learn Python by Building 5 Games
Many people learn programming languages best through building projects. If you want to learn Python by coding five games, check out the 7-hour video course we just released on the freeCodeCamp.org YouTube channel. We have collected together 5 great game development tutorials that will help you learn Python.
You will will build Pong, Snake, Connect Four, Tetris, and a simple multiplayer game. These are all popular games that are fun to play as well as code.
This course takes a project-based approach. If you learn best by doing, this is the course for you. You will learn from Christian Thompson, Keith Galli, and Tech with Tim. These experienced teachers will help you understand every line of code in the projects.
You don’t need prior programming experience to learn from this course. However, it is helpful if you are aware of some basic programming concepts since this course skips the basic syntax instruction and jumps right into building projects.
Build games using the command line, turtle, and Pygame
One of the games just uses the command line. Writing code for the command line is a great way to learn basic programming skills without having to worry about graphics.
Another game uses the turtle graphics module. This is a built-in module that is often used to teach beginning programming skills and can be used for simple games.
You will also learn to build games using Pygame. Pygame is a set of Python modules that is used to create all sorts of games, even advanced ones. It makes it easy to add graphics and sound to Python programs.
In the final section, you will learn how to code a scaleable multiplayer game with Python using sockets and networking. You will learn how to deploy your game so that people anywhere around the world can play against each other.
Through building a multiplayer game, you will learn about concepts such as developing clients and servers, sending encrypted data, and connecting multiple clients to a server.
You can watch the full course on the freeCodeCamp.org YouTube channel (7 hour watch).
Топ-8 игр, чтобы научиться программированию на Python
Чтобы научиться программированию, не обязательно нужно начинать со сложных учебников. Наша команда подготовила подборку игр и онлайн-платформ по программированию для детей, где можно освоить язык Python.
Ведь это здорово, когда есть игры, которые помогут обучиться любимому делу. Тем более дети любят играть, а значит, что освоение программирования для них будет проходить намного легче.
Python — это скриптовый язык, его используют для решения большого объема разноплановых проблем и задач. Python пригодится в создании мобильных и компьютерных приложений, этот язык применяют в работе с большим объемом информации, при разработке web-сайтов и других разнообразных проектов, используют в машинном обучении.
Платформа, позволяющая изучить компьютерные науки. Красочная анимация и интересный сюжет, взаимодействие с другими игроками. В игре поддерживается множество языков, в том числе и Python. Подходит для детей от 10 лет, можно увлечь даже самого неусидчивого ученика. На каждом уровне перед игроком ставится задача, например, найти гриб, который поможет одолеть противника, провести в бой солдат или выбраться из темницы. Игрок управляет начинающим волшебником, который выполняет задания с помощью команд JavaScript или Python. В процессе команды будут усложняться.
Браузерная игра в жанре «Приключения». В этой игре пользователю нужно будет в той или иной мере использовать свои знания в области программирования. На первом этапе обучения «Learning» представлена цепочка задач от легкой к сложной, в описании самой задачи есть все данные для ее решения. В начале игры откроется два острова, появится система подсказок, которая будет вести в игре. На острове Хоум Айленд задачи более сложные и комплексные, а в Лайбери 2.0 совсем простые. Но в обоих случаях нужны базовые знания в программировании. Для прохождения миссии и перехода на следующий уровень нужно написать программный код на Python, но также здесь можно усовершенствовать и JavaScript.
В этой игре вы научитесь не только кодить, но и ловить бананы. Играть придется маленькой обезьянкой, которая собирает бананы на поле. Для этого ребенку нужно составить цепочку команд в правой текстовой панели, запустить их на выполнение. Переживать не нужно, ведь перед каждым уровнем даются подсказки, справиться с игрой может даже ученик младшей школы. К тому же, сайт русифицирован, а задания постепенно увеличивают сложность. Начиная с простых действий, ребенок научится составлять сложные алгоритмы. С помощью Codemonkey ребенок сможет обучиться Python через программирование чат-бота.