1. Qt mini game --- Sokoban

1. Description

This small game mainly uses the drawing event function **paintEvent()** in Qt to draw graphics on the canvas continuously, and uses the timer to do time-triggered processing. This small game only does simple logic processing, specifically Readers can play complex functions by themselves, and the effect is shown as follows:

Qt makes a small game of Sokoban

2. Related code

The "Sokoban" mini-game project file mainly includes three classes: the gamemap class is used to draw maps, the gameplayer class is used to control game players, and the widget class is used to organize codes. The overall structure of the project is as follows: when drawing maps, you need to
insert image description here
use A map logo file, used to create different images based on different markers to populate the map interface, this logo file is a simple
.txt
text, placed in the project folder, as shown in the following figure:
insert image description here

2.1 map drawing class gamemap

In this class, a two-dimensional array needs to be created to store the content in the above map identification file

Guess you like

Origin blog.csdn.net/FY_13781298928/article/details/131063915