Learn Python by Coding Video Games (Intermediate): Learn Python by Coding Video Games, #2
()
About this ebook
Learn Python with Pygame, and create a full pacman game without the headachess
Python is a great programming language; however, most people spend too long trying to learn how to code and create games with Python the hard way. This book is the only one that will get you to learn Python fast without wasting so much time. This book is the second book in the series "Learn Python By Coding Games" where you will learn to code fast and be able to create your own video games with Python in no time and add interesting game play including Artificial Intelligence for the NPCs.
This is the only book that you need to get started with Python and game programming fast and to enjoy the journey without frustration. This book includes six chapters that painlessly guide you through the necessary skills to master Python and Python games development, use its core features, and create interesting 2D games. It assumes no prior knowledge on your part and ensures that you have all the information and explanations that you need every step of the way.
What you will learn
After completing this book, you will be able to:
- Be comfortable with Python.
- Use common structures to create programs in Python (e.g., loops, conditional statements, etc.).
- Know and master the features that you need to create 2D games (user interface, collision and keyboard detection).
- Create and instantiate classes using Python.
- Create and manage an inventory of weapons for the player character using classes and lists.
- Create and manage weapons and ammunitions that the player character can collect and use.
- Create Artificial Intelligence for NPCs so that they can see or hear the player.
Make it possible for NPCsC to patrol, detect and follow the player
- Create a finite state machine to manage the behaviour of NPCs.
- Learn how to use the Pygame library.
What this book offers
This book includes all the features that you need to get started with Python and game development:
- Learn without the headaches: This book assumes that you can't be expected to learn everything at once; this is why you will build all your skills incrementally.
- Make your dream of creating your own games come true: This book ensures that you stay motivated by giving you the right amount of information and challenge in each chapter; we all know that it's hard to keep motivated when learning a new skill, so this book always contextualizes the knowledge with an example (so that you feel it's relevant), and also makes sure that you get to challenge yourself, if you need to, with optional challenges present at the end of each chapter.
- Progress and feel confident in your skills: You will have the opportunity to learn and to use Python at your own pace and become comfortable with its core features. This is because every single new concept introduced will be explained in great detail so that you never feel lost. All the concepts are introduced progressively so that you don't feel overwhelmed.
- Create your own games and feel awesome: With this book, you will build your own 2D games and you will spend more time creating than reading, to ensure that you can apply the concepts covered in each section. All chapters include step-by-step instructions with examples that you can use straight away.
If you want to get started with Python games today, then buy this book now.
Patrick Felicia
Patrick Felicia is a lecturer and researcher at Waterford Institute of Technology, where he teaches and supervises undergraduate and postgraduate students. He obtained his MSc in Multimedia Technology in 2003 and PhD in Computer Science in 2009 from University College Cork, Ireland. He has published several books and articles on the use of video games for educational purposes, including the Handbook of Research on Improving Learning and Motivation through Educational Games: Multidisciplinary Approaches (published by IGI), and Digital Games in Schools: a Handbook for Teachers, published by European Schoolnet. Patrick is also the Editor-in-chief of the International Journal of Game-Based Learning (IJGBL), and the Conference Director of the Irish Symposium on Game-Based Learning, a popular conference on games and learning organized throughout Ireland.
Related to Learn Python by Coding Video Games (Intermediate)
Titles in the series (2)
Learn Python by Coding Video Games (Intermediate): Learn Python by Coding Video Games, #2 Rating: 0 out of 5 stars0 ratingsLearn Python by Coding Video Games (Beginner): Learn Python by Coding Video Games Rating: 2 out of 5 stars2/5
Related ebooks
Learn Python by Coding Video Games (Beginner): Learn Python by Coding Video Games Rating: 2 out of 5 stars2/5Python Games from Zero to Proficiency (Beginner): Python Games From Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratingsPython Games from Zero to Proficiency (Intermediate): Python Games From Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratingsCode Gamers Development Essentials Rating: 0 out of 5 stars0 ratingsPython GUI Programming Cookbook - Second Edition Rating: 5 out of 5 stars5/5Python Tools for Visual Studio Rating: 0 out of 5 stars0 ratingsPython Game Programming By Example Rating: 1 out of 5 stars1/5Godot from Zero to Proficiency (Advanced): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5Godot from Zero to Proficiency (Beginner): Godot from Zero to Proficiency, #2 Rating: 5 out of 5 stars5/5Godot from Zero to Proficiency (Proficient): Godot from Zero to Proficiency, #5 Rating: 5 out of 5 stars5/5A Quick Guide to Artificial Intelligence with Unity: Quick Guides, #4 Rating: 0 out of 5 stars0 ratingsPython Projects for Kids Rating: 5 out of 5 stars5/5Kivy – Interactive Applications and Games in Python - Second Edition Rating: 0 out of 5 stars0 ratingsPython 3 Object Oriented Programming Rating: 4 out of 5 stars4/5Mastering AndEngine Game Development Rating: 0 out of 5 stars0 ratingsLearning C++ by Creating Games with UE4 Rating: 3 out of 5 stars3/5Godot from Zero to Proficiency (Intermediate): Godot from Zero to Proficiency, #3 Rating: 5 out of 5 stars5/5Getting Started with 3D Animation in Unity: Getting Started, #1 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to Puzzle Games: Beginners' Guides, #3 Rating: 0 out of 5 stars0 ratingsLÖVE for Lua Game Programming Rating: 5 out of 5 stars5/5Unity from Zero to Proficiency (Foundations) Fifth Edition: Unity from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5HTML5 Game Development with GameMaker Rating: 0 out of 5 stars0 ratingsUnity from Proficiency to Mastery (Artificial Intelligence): Unity from Proficiency to Mastery, #1 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Advanced): Unity from Zero to Proficiency, #4 Rating: 0 out of 5 stars0 ratingsGodot from Zero to Proficiency (Foundations): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5Video Game Careers - Ultimate Edition: Video Game Careers, #4 Rating: 0 out of 5 stars0 ratings
Children's Technology For You
Fallout: A Tale of Mutation Rating: 5 out of 5 stars5/5Make Your Own Amazing YouTube Videos: Learn How to Film, Edit, and Upload Quality Videos to YouTube Rating: 5 out of 5 stars5/5Spectrum Science, Grade 3 Rating: 5 out of 5 stars5/5The Everything Kids' Scratch Coding Book: Learn to Code and Create Your Own Cool Games! Rating: 4 out of 5 stars4/5Circuitry and Electronics Rating: 0 out of 5 stars0 ratingsElectricity - Your Common Sense Guide Rating: 4 out of 5 stars4/5Diary of an 8-Bit Warrior: Forging Destiny: An Unofficial Minecraft Adventure Rating: 5 out of 5 stars5/5Curious George Discovers Space Rating: 5 out of 5 stars5/5Let's Meet a Dentist Rating: 5 out of 5 stars5/5An Unofficial Joke Book for Fortniters: Sidesplitting Jokes and Shenanigans from Salty Springs Rating: 1 out of 5 stars1/5Escape from a Video Game: The Secret of Phantom Island Rating: 5 out of 5 stars5/5The Day the Screens Went Blank Rating: 5 out of 5 stars5/5Hilarious Jokes for Minecrafters: Mobs, Creepers, Skeletons, and More Rating: 1 out of 5 stars1/5Diary of an 8-Bit Warrior: Path of the Diamond: An Unofficial Minecraft Adventure Rating: 5 out of 5 stars5/5Quest for the Golden Apple: An Unofficial Graphic Novel for Minecrafters Rating: 5 out of 5 stars5/5Project Superhero Rating: 4 out of 5 stars4/5Escape from a Video Game: Mystery on the Starship Crusader Rating: 5 out of 5 stars5/5Diary of an 8-Bit Warrior: Crafting Alliances: An Unofficial Minecraft Adventure Rating: 5 out of 5 stars5/5TBH #1: TBH, This Is So Awkward Rating: 3 out of 5 stars3/5Diary of an 8-Bit Warrior: From Seeds to Swords: An Unofficial Minecraft Adventure Rating: 5 out of 5 stars5/5The Renaissance Artists: With History Projects for Kids Rating: 5 out of 5 stars5/5Minecraft: Masters of Minecraft - The Invasion Rating: 5 out of 5 stars5/5Danielle: Chronicles of a Superheroine Complete Edition Rating: 0 out of 5 stars0 ratingsHow to Survive Without Grown-Ups Rating: 4 out of 5 stars4/5The Revenge of Clayface Rating: 5 out of 5 stars5/5Waste of Space Rating: 5 out of 5 stars5/5
Reviews for Learn Python by Coding Video Games (Intermediate)
0 ratings0 reviews
Book preview
Learn Python by Coding Video Games (Intermediate) - Patrick Felicia
Learn Python By Coding Games
(intermediate)
First Edition
––––––––
A step-by-step guide to coding your first shooter game with Python and Pygame.
Patrick Felicia
Learn Python By Coding Games
(intermediate)
Copyright © 2022 Patrick Felicia
All rights reserved. No part of this book may be reproduced, stored in retrieval systems, or transmitted in any form or by any means, without the prior written permission of the publisher (Patrick Felicia), except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either expressed or implied. Neither the author and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
First published: October 2022
Published by Patrick Felicia
Credits
Author: Patrick Felicia
About the Author
Patrick Felicia is a lecturer and researcher at Waterford Institute of Technology, where he teaches and supervises undergraduate and postgraduate students. He obtained his MSc in Multimedia Technology in 2003 and PhD in Computer Science in 2009 from University College Cork, Ireland. He has published several books and articles on the use of video games for educational purposes, including the Handbook of Research on Improving Learning and Motivation through Educational Games: Multidisciplinary Approaches (published by IGI), and Digital Games in Schools: A Handbook for Teachers, published by European Schoolnet. Patrick is also the Editor-in-chief of the International Journal of Game-Based Learning (IJGBL), and the Conference Director of the Irish Symposium on Game-Based Learning, a popular conference on games and learning organized throughout Ireland.
Support and Resources for this Book
To complete the activities presented in this book you need to download the startup pack on the companion website; it consists of free resources that you will need to complete your projects. You can download it here:
http://learntocreategames.com/book_downloads/python_games/book2/
This book is dedicated to Mathis
[ ]
Table of Contents
Credits
About the Author
Support and Resources for this Book
Table of Contents
Preface
Content Covered by this Book
What you Need to Use this Book
Who this book is for
Who this book is not for
How you will learn from this book
Format of Each Chapter and Writing Conventions
Special Notes
How Can You Learn Best from this Book?
Feedback
Downloading the Solutions for the Book
Improving the Book
Supporting the Author
Chapter 1: Starting with Our Shooter Game
Moving the npc using the arrow keys
Creating a weapon for the player character
Creating a class for the targets
Level roundup
Summary
Quiz
Answers to the Quiz.
Checklist
Chapter 2: Creating an Inventory
Creating the inventory
Switching between weapons
Collecting ammunitions
Level roundup
Summary
Quiz
Answers to the Quiz
Checklist
Challenge 1
Chapter 3: Adding Collisions and Artificial Intelligence
Resources necessary for this chapter
Adding walls
Adding collision detection with the walls
Moving the npc with waypoints
Adding Hearing and vision to the npc
Level roundup
Checklist
Quiz
Answers to the quiz
Challenge 1
Chapter 4: Creating a Finite State Machine
Initializing the game
Following the player
Triggering transitions between states
Spawning NPCs
Level roundup
Checklist
Quiz
Answers to the quiz
Challenge 1
Chapter 5: Polishing our game
Changing the appearance of the enemies
Displaying dots
Detecting collision with the dots and updating the score
Displaying the score
Detecting collision with the npcs
Level roundup
Checklist
Quiz
Solutions to the Quiz
Challenge 1
Chapter 6: Frequently Asked Questions
Scripts
Interaction with assets
Using a graphical user interface
Create and use classes
Using Lists
Pictures and Audio
Detecting user inputs
Thank you
––––––––
Preface
This book will show you how you can very quickly code in Python and create games.
Python is a powerful programming language used in a wide range of industries and that you can use even if you have (or you are teaching with) computers with very low technical specifications.
This book series entitled Learn Python By Coding Games allows you to play around with Python’s core features, and essentially those that will make it possible to create interesting 2D games rapidly. After reading this book series, you should find it easier to code in Python and to create simple yet entertaining video games.
This book series assumes no prior knowledge on the part of the reader, and it will get you started on Python so that you quickly master all the wonderful features that this programming language provides by going through an easy learning curve.
By completing each chapter, and by following step-by-step instructions, you will progressively improve your skills, become more proficient in Python, and create several games.
In addition to becoming proficient with Python, you will also create games that include many of the common techniques found in video games such as: level design, object creation, textures, collision detection, lights, weapon creation, character animations, particles, artificial intelligence, and menus.
You will learn how to create customized menus and simple user interfaces using both Python and Pygame and animate and give artificial intelligence to Non-Player Characters (NPCs) that will be able to follow the player character using pathfinding.
Finally, you will also get to export your game at the different stages of the books, so that you can share it with friends and obtain some feedback as well.
[ ]
Content Covered by this Book
Chapter 1: Starting with Our Shooter Game, explains how you can create and move a 2D character; it also shows you how you can add a weapon (a gun) so that the player character can shoot. Finally, this chapter will also show you can create a class for the bullet, to keep their management smooth and easy.
Chapter 2: Creating an Inventory, explains how you can create an inventory for the weapons that the player character owns. It shows you how you can combine classes and lists so that the player can switch between weapons and collect and manage ammunitions.
Chapter 3: Adding Collisions and Artificial Intelligence, shows you how you can add challenge to your game by introducing NPCs that can patrol, but