Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
7.5.4 Game
The Raspberry Pi system offers a number of games by default, meaning that it not only allows users to play games simply on the Raspberry Pi system, but also gives users an opportunity to develop their ability to develop programs through games with Python. It allows users to interact with the game using Python, and provides an environment in which users can change and execute the contents of the program source code of the game.
How to communicate with Game with Python is described again in detail in [23.5.6 Learning Python through Game].
7.5.4.1 Minecraft PI
Minecraft is a popular sandbox open world-building game, and provides a version that users can enjoy at Raspberry Pi. Users can easily learn Python in this game, modifying the contents of the game and enjoying them by writing commands or simple scripts with Python code.
When you run the game by Application Menu Menu → Games → Minecraft Pi, the game starts with the following screen. Note that the program does not run on the remote connection. "Start Game" is a game for one player, and "Join Game" is a game that many people play together on the network.
|
Figure 7‑30 Minecraft
When you start the game with the "Start Game", the game starts with the following screen.
|
7.5.4.2 Python Games
Raspberry Pi allows you to run many games developed with Python. At the same time, the program source for these game programs can be confirmed, and the user can modify and execute them as desired.
If you to run the program by Application Menu Menu → Games → Python Games, the audio output selection screen displays, and then the following game list screen appears. When you select the desired game and press the [OK] button, the game is executed.
|
Figure 7‑31 Python Games
The source code of the program is provided for all the games provided here. If you look in the /home/pi/python_games folder, you will see the source code and related files.
|