It is said that in the Nintendo FC era, the role of the elves is quite huge, but at that time only know how to play Super Mary, the soul, but the elves do not know. Pygame.sprite.Sprite is a class used in Pygame to implement the wizard, when used, do not need to instantiate it, just inherit him, and then write their own class on demand, so it is very simple and practical.
First, what is a genie
Sprites can be thought of as small pictures, a graphical
Implementation of the pygame genie walking and two-step jump
I have to admit that PythonGame programmingThe translation and layout of this book is very bad, but the demo in it is still very good. I have made some adaptations here.
First, material:
Background
Genie
All materials are taken from this book
The following is how the genie class is created:
Class MySprite (pygame. sprite. sprite): def _ init _
It is said that in the Nintendo FC era, the role of elves is very large, but at that time only know how to play Super Mary, the Soul Dou Luo, but the elves do not know. Pygame.sprite.Sprite is a class that is used to implement the sprite in Pygame, and when used, it is not necessary to instantiate it, just inherit him, and write his own class on demand, so it is very simple and practical.
First, what is the Spirit
Sprites can be thought of as a smal
Next we will introduce some basic things of pygame.
Drawing Images with pygame. image. Load () and bits ()
Many games do not just use simple drawing functions, but also require a variety of images (also known as Genie). pygame can be loaded to the surface object in PNG format, JPG, GIF, and BMP. You can search for different formats on the Internet.
Next, I will i
Today, when I used pygame to play music, I encountered a strange problem. With pygame. INIT (), I couldn't hear the sound,Remove the record and try again.CodeAs follows:
1. the following code can play normally and you can hear musicImport pygame, time########## Pygame. INIT ()Pyg
This section describes how to process fonts on the game interface. The experiment uses real-time display of the current time and ball position on the interface as an example. For details, see the code.
I. Code
[Python]#-*-Coding: UTF-8 -*-Import OSImport sysImport timeImport pygameFrom pygame. locals import *From pygame. font import *Def load_image (pic_name ):'''''Function: Image Loading FunctionInput: pic
Installation Process in Linux based on pygame module in python (detailed description), pythonpygame
1. Use pip to install the Python package
Most newer Python versions have their own pip, so you can first check whether the system has installed pip. In Python3, pip is sometimes called pip3.
1. Check whether pip is installed in Linux and OS X.
Open a terminal window and run the following command:
In Python2.7:
zhuzhu@zhuzhu-K53SJ:~$ pip --versionpip 8.1
1. Movement Rate
In the previous section, a car was implemented on the road from bottom to top, and Pygame.time.delay (200) was used to delay the time. Read a lot of reference materials, basic each material will talk about the different configuration of the machine under the speed of the problem, some by setting the frequency to solve, some through the set speed to solve, their own level limited, see a few, think or "Beginning Game development with Python and
1. Motion Rate
In the previous section, a car was implemented on the road from bottom to top, and the Pygame.time.delay (200) was used for time delay. See a lot of reference material, basic each material will talk about the different configuration machine movement rate of the problem, some by setting the frequency to solve, some by setting speed to solve, their own level is limited, read a few, think or "beginning Game Development with Python and Pygame
This article mainly introduces the pygame Installation Method in Python. It analyzes and summarizes the detailed steps for downloading, installing, and debugging pygame in Python based on text instructions, for more information about how to install pygame in Python, see the following example. We will share this with you for your reference. The details are as foll
View All events
You only need to print the event.
Import pygame, sysfrom pygame. locals import * pygame. init () pygame. display. set_mode (600,480) while true: For event in pygame. event. get (): Print (event) If event. type = quit:
An error or pygameerror occurs when pygame loads an mp3 file with a Chinese name.
I haven't written anything for a while. I 've been working on a Python pygame-based music player in the last few days. I wanted to finish it and try again to write an article, but the deeper it gets, the framework is coming out, it may be due to my personal problems and slow time. let's talk about
Pygame is a Python module designed to develop the game, in fact, the same as time, OS, sys are the same stuff. Today began to formally learn pygame, download address: www.pygame.org. After downloading the installation is complete, in pygame learning, I used the SPE editor, feel good.
1. pygame window
Pygame is a Python module designed to develop the game, in fact, the white and time, OS, sys are the same stuff. Today began to formally study pygame, download address: www.pygame.org. After downloading the installation is complete, in pygame learning, I used the SPE editor, I feel good.
1. pygame window
Python and Pygame game developmentDirectory1th. Installing Python and Pygame 11. 1 Preliminary Knowledge 11. 2 Downloading and installing Python 11. 3 Installation instructions under Windows 11. 4 Installation Instructions on MAC OS x 21. 5 installation on Ubuntu and LinuxDescription 21. 6 Starting Python 21. 7 Installing Pygame 31. 8 How to read this book 41. 9
http://blog.csdn.net/qq_33166080/article/details/68928563If you already have some programming experience, the quickest way to learn a new language is to take a medium-sized project, get to know the project again, read the grammar of the new language again, aha, personal opinion.Today to formally configure the Python development game Coorg Tools PyGameintroduction of Pygame ① Pygame is a set of Python p
Python pygame module Installation Process in Linux, pythonpygame
1. Use pip to install the Python package
Most newer Python versions have their own pip, so you can first check whether the system has installed pip. In Python3, pip is sometimes called pip3.
1. Check whether pip is installed in Linux and OS X.
Open a terminal window and run the following command:
In Python2.7:
Zhuzhu @ zhuzhu-K53SJ :~ $ Pip -- versionPip 8.1.1 from/usr/lib/python2.7/dist
In the previous section, the ball is moved freely. In this section, the arrow keys are used to control the ball movement and background images are added to the game.
I. Implementation:
[Python]#-*-Coding: UTF-8 -*-Import OSImport sysImport pygameFrom pygame. locals import *Def load_image (pic_name ):'''''Function: Image Loading FunctionInput: NONEOutput: NONEAuthor: socratesBlog: http://blog.csdn.net/dyx1024Date: 2012-04-15'''# Obtain the absolute pat
Start making pygame games (1)
Start to enter the world of Python1. About this series
This will be a series of articles. It is my experience reading makeing games with Python pygame. Since the book is in English, I can organize it into an article in Chinese for your convenience. The author also wrote another book "invent your own computer games", which focuses on the game programming on the command line in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.