Introduction:

Hey! I am mumuzi, follow me – play games with me ~

In fact? These days, there is nothing to write about games. Many games are too difficult to copy and take too much time

Hahaha, this is a PyGame project with 4 single games! Want to play that play that ha……

Today is the game collection. This article is composed of four games combined into the project case as follows: 👇👇👇👇 port

Pygame mini game collection: tank wars, push boxes, pac-man, FlappyBird.

I hope you enjoy it:

I want to write more, more, more fun games for you.

Space is limited more game source code project remember the end of the article to find me to receive the @ all members!

The body of the

These games are a separate project source – the end of the need to find me to get it!

A brief introduction of four games

1) Tank Wars game 🌈

Tank Wars was one of the most popular games in the world.

Despite its simple graphics, the game has all the ingredients that make a classic game successful — easy to get started, improved levels, the ability to play doubles, and even a conscience

Go to blast edit mode. Although it is a low K game, but in the eyes of the People at that time, this game bought very valuable.

The gameplay of Tank Wars is simple — kill all enemies without destroying your home town. The enemies in the game are varied, and the terrain is changeable, at the time

Create a rich gameplay. But that’s not the best part of the game. Because of joining the shooting friendly forces caused hard straight rules, plus can blow up their own base strange

Set up to make Tank Wars the perfect choice for dating gay friends — you got me killed, didn’t you? This game is usually the best

Later, it became “Mortal Kombat”.

2) Box pushing game 🌈

“Push the box” before reading when I but play customs clearance, now incredibly in this pass was stumped! Do you remember how to play it? How many levels can you pass?

Emmm, the game play also need not be introduced, is the classic push box play, let the box to the specified position on the clearance, very brain-burning. Interested friends can try.

** Keywords: ** leisure, puzzle, pass, classic push box, burn brain. ** Game platform: ** wechat mini-game

** Krypton index: **0 Krypton gold. ** Recommended number of stars: **3.5 ** Difficulty number of stars: **5

Small make up brief comment: “Push box” is a puzzle push box game, copy the classic play.

3) Eat beans game 🌈

Remember the popular Pac-Man game? It was the most popular super classic game of the Red and White Machine era. Simple game method, full of unknown game world

The boundary is one of its major features.

Warning: Pac Is not an easy game to play, it is highly addictive, so be prepared to waste your time before playing. Fortunately, it won’t cost you money.

4)FlappyBird mini game 🌈

In 2014, Flappy Bird was an absolute phenomenon, ranking as the most searched game on Google in 2014.

The game has not only brought in huge revenue for its developer, Nguyen Ha-Dong, but also made countless players suffer from “abuse”.

Two, collection code demonstration

The above four games will not be covered separately, each of which has been previously written about. Here is a screenshot of the new collection project I put together as follows:

1) Code demo combination

It is mainly divided into two parts of the source code: main.py, mywindow.py.

Combination code:

# -*- coding: Utf-8 -*- # utF-8 -*- # PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import pyqtSlot from TankBattle import Game as TankBattleGame from EatBeans import Game as EatBeansGame from FlappyBird import Game as FlappyBirdGame from Sokoban import Game as SokobanGame class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) font = QtGui.QFont() font.setFamily("arial") font.setPointSize(15) MainWindow.setFont(font) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.TankBattle = QtWidgets.QPushButton(self.centralwidget) self.TankBattle.setGeometry(QtCore.QRect(200, 120, 400, 50)) self.TankBattle.setObjectName("TankBattle") self.EatBeans = QtWidgets.QPushButton(self.centralwidget) self.EatBeans.setGeometry(QtCore.QRect(200, 240, 400, 50)) self.EatBeans.setObjectName("EatBeans") self.Sokoban = QtWidgets.QPushButton(self.centralwidget) self.Sokoban.setGeometry(QtCore.QRect(200, 180, 400, 50)) self.Sokoban.setObjectName("Sokoban") self.FlappyBird = QtWidgets.QPushButton(self.centralwidget) self.FlappyBird.setGeometry(QtCore.QRect(200, 300, 400, 50)) self.FlappyBird.setObjectName("FlappyBird") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(270, 50, 241, 30)) self.label.setObjectName("label") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", Self.tankbattle. SetText (_translate("MainWindow", Self.sokoban.settext (_translate("MainWindow")) self.sokoban.settext (_translate("MainWindow")) self.sokoban.settext (_translate("MainWindow")) Self.flappybird.settext (_translate("MainWindow", "FlappyBird")) self.label.settext (_translate("MainWindow", "FlappyBird")) self.label.settext (_translate("MainWindow", "PyGame little game collection")) self. TankBattle. Clicked. Connect (self. On_click1) self. Sokoban. Clicked. Connect (self. On_click2) self.EatBeans.clicked.connect(self.on_click3) self.FlappyBird.clicked.connect(self.on_click4) @pyqtSlot() def on_click1(self): TankBattleGame.main() @pyqtSlot() def on_click2(self): SokobanGame.main() @pyqtSlot() def on_click3(self): EatBeansGame.main(EatBeansGame.initialize()) @pyqtSlot() def on_click4(self): FlappyBirdGame.main()Copy the code

Main running program:

# # CSDN account: Pyqt5. QtWidgets import QApplication, QMainWindow from MyWindow import * class MyWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(MyWindow, self).__init__(parent) self.setupUi(self) if __name__ == '__main__': app = QApplication(sys.argv) myWin = MyWindow() myWin.show() sys.exit(app.exec())Copy the code

3. Effect display

Screenshot effect display —

conclusion

So many games can be found in the game collection, there are a lot of classic games themselves to read the article summary inside a lot of fun game source – interested partners can

To find my own source code to experience a wave ~

Source base:

Private letter small make up 06 or click this line of blue font can be taken for free! The old ones are here, too

👑 Article summary —

Python 1.1-2021 | for the article summary | continuously updated, direct look at this article is enough ~

Pygame — is recommended

Item 1.0 Super Mario

Programmer homemade Game: Super Mario Bros 100% Real, will make you cry

Item 1.1 Mine Clearance

Pygame: It is said that this is the most difficult minesweeper game in history, no one, you feel……

Project 1.2 Contra

Pygame combat: After many years, “Contra” pixel style is more than classic and feelings @ all members

Item 1.3 Space Mecha game

Pygame: Thousands of lines of code to implement the Mecha Adventure Game.

Item 1.4 Fruit Ninja

【Pygame Combat 】 Popular worldwide fruit game upgrade version “fruit Ninja” online, you dare to PK?