Today I'll bring you a childhood fun game , tetris , This is also one of Lao yuan's games of fishing at work , But I suggest you still keep a love of work , Don't be ashamed of your boss's cultivation and employment , Cough cough cough ！！ Get down to business , Let's see the steps and code Just follow the knock ！！
python edition ：3.6.4
relevant pygame Built in modules .
install Python And add to environment variable ,pip Install the relevant modules required
The rules of the game :
Plates of different shapes, made up of small squares, are falling from the top of the screen , Players adjust the position and direction of the plate , Make them one or more complete lines at the bottom of the screen . These complete bars will disappear , Make room for the newly fallen plates , meanwhile , Players get bonus points . The squares that have not been eliminated keep piling up , Once it's piled up to the top of the screen , The player loses , Game over .
The control mode :
—→ Key control position ,1 Key to control the direction , The space bar makes the plate fall to the bottom quickly ,P Key to pause the game .
I won't reveal more details Everyone just taps the code and it's done , Put the picture ：
The renderings are as follows ：
If you want to play, remember to try , You can have plenty of food and clothing by doing it , I don't know. You're welcome to write to me at any time , You can also leave a message in the comments section , I will answer the questions you don't understand one by one ！！ Little friends who love learning, remember to praise the collection , This is convenient for learning , Keep an eye on my updates , New learning content will be updated every day