O'Reilly logo

Program Arcade Games: With Python and Pygame, Fourth Edition by Paul Vincent Craven

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 13

image

Introduction to Classes

Classes and objects are very powerful programming tools. They make programming easier. In fact, you are already familiar with the concept of classes and objects. A class is a classification of an object. Like person or image. An object is a particular instance of a class. Like Mary is an instance of Person.

Objects have attributes, such as a person’s name, height, and age. Objects also have methods. Methods define what an object can do: like run, jump, or sit.

Why Learn About Classes?

Each character in an adventure game needs data: a name, location, strength; are they raising their arm; what direction they ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required