Using python + pygame to develop Xiaoxiaole game with complete source code I believe everyone has played the Xiaoxiaole mini game. It is a mini game that both adults and children like to play. So how is it implemented based on the program? Today I will show you how to use python + pygame to […]
Tag: pygame
[OpenCV-PyQt5-PyGame-imutils] Exploring image and video capture in Python: Performance Analysis and Selection Guide
Foreword As computer vision and multimedia applications continue to evolve, image and video capture is becoming increasingly important. In Python, there are a variety of libraries and tools to choose from for opening cameras, capturing images, and processing video streams. This article aims to provide readers with a comprehensive understanding of these capture methods and […]
Python Game Development: Explore the Wonderful World of the Pygame Library
In the field of Python game development, the Pygame library is a popular game development tool. It provides a series of easy-to-use interfaces based on the SDL library (Simple DirectMedia Layer), allowing developers to Create 2D games easily. This blog will deeply explore the basic knowledge of the Pygame library, including the creation of game […]
python&pygame Snake source code
caidan_youxi.py import sys import pygame from PyQt5.QtWidgets import QApplication, QMainWindow import login if __name__ == ‘__main__’: pygame.init() pygame.mixer.init() pygame.mixer.music.load(‘C:/Users/ShiWe/Desktop/Computer Software Technology Internship/tanchishe/bgm.mp3′) # Load songs pygame.mixer.music.play() # Play app = QApplication(sys.argv) win = QMainWindow() loginUi = login.Ui_MainWindow() loginUi.setupUi(win) win.show() sys.exit(app.exec_()) youxi.py f = open(“speed.txt”, mode=’r’) speed = f.read() f.close() score = 0 import pygame as […]
python&pygame random maze automatic path finding based on A* algorithm
caidan_youxi.py import sys import pygame from PyQt5.QtWidgets import QApplication, QMainWindow import login if __name__ == ‘__main__’: pygame.init() pygame.mixer.init() pygame.mixer.music.load(‘bgm.mp3’) # Load songs pygame.mixer.music.play() # Play app = QApplication(sys.argv) win = QMainWindow() loginUi = login.Ui_MainWindow() loginUi.setupUi(win) win.show() sys.exit(app.exec_()) my_migong.py import pygame import random import numpy as np import time class point: def __init__(self, row=0, col=0): self.row […]
We thoughtfully provide you with games made by the pygame library!
We thoughtfully provide you with games made by the pygame library! If you are tired of writing, you can play and relax, and beginners can study it. Just save the following code as Two-player Casual Shooting Game.py’. If you are interested, you can also package it~ No thanks~ First run the following command in cmd […]
Pygame Lesson 3: Moving Loaded Images
Table of Contents 1. Load pictures 1.1 pygame.image.load() 1.2 Surface.blit() 1.3 Sample program 2. Mobile pictures 2.1 How to move 2.2 Eliminate traces 2.3 Control frame rate 3. Solve exceptions 3.1 FileNotFoundError: No file ‘xxx’ found in working directory ‘C:\Users\lion\AppData\Local\Programs\Python\Python38’. 3.1.1 Path problem 3.1.2 PATH environment variable problem 3.2 SyntaxError: (unicode error) ‘unicodeescape’ codec can’t […]
[pygame] Python creates backgammon human-machine battle
The code in this article is based on python3.6 and pygame1.9.4. Compared with the previous games I wrote, Gomoku is much more difficult. If it is a human versus human battle, then the computer only needs to determine whether it has won. If it’s a human-machine battle, then you have to let the computer know […]
[pygame] Python makes XP classic minesweeper game (with source code)
This time we will do a minesweeper based on pygame. Last time, a gardener asked me about the python version of the code. Let me explain that all my codes are based on python 3.6. Let’s take a look at the screenshot first, which is modeled after Minesweeper on XP. I feel that the style […]
pygame module – semi-finished Tetris
main.py import random from pygame.locals import * importsys from shapes7 import * import threading import time pygame.init() lock = threading.Lock() mutex = threading.Lock() global tsid, speed, pps, pvs, tsnb # Set screen size screen = pygame.display.set_mode((600, 600)) # Color information # forum_gold = 255, 227, 132 light_yellow = 255, 222, 179 deep_dark = 41, 36, […]