2023 Mobile Software Development Experiment 6

2023 Summer "Mobile Software Development" Experiment Report

Name and student number?
Which course does this experiment belong to? Ocean University of China 23rd Summer "Mobile Software Development"
Experiment name? Experiment 6: Push the box
blog address? XXXXXX
Github warehouse address? https://github.com/enfantsRichesDeprimes/Mobile-Software-Development-Experiment-6

(Note: Publishing the experiment report on the blog and publishing the code to github is a bonus but not mandatory)

1. Experimental goals

1. Learn how to create a mini program using a quick start template; 2. Learn how to create a mini program manually without using a template.

2. Experimental steps

The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly.

front page

  1. chooseLevelThe function is a click event processing function, used to select levels. It obtains the currently selected level level (i.e. level), then jumps to the game page by calling the wx.navigateTo method, and passes the selected level level through the URL parameter. Give the game page.

The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly.

Specific game interface

Canvas drawing technology is used to draw game maps and objects. Among them, the initMap function is used to initialize the map and box data based on the level data; the drawCanvas function is used to draw the map, boxes and birds; the up, down, left and right functions respectively correspond to the up, down, left and right movement operations of the direction keys; the isWin function is used to determine Whether the game is successful or not, the checkWin function handles it when the game is successful; the restartGame function is used to restart the game.

List the key steps of the experiment, code analysis, and screenshots.

3. Program running results

The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly.

Select page

The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly.

Specific game interface

List the final running results of the program and screenshots.

4. Problem summary and experience

When doing the up, down, left and right movement operations of the direction keys:

  1. Boundary judgment: It is necessary to judge whether the bird has reached the map boundary to prevent it from moving beyond the map range.
  2. Collision detection: It is necessary to detect whether the bird collides with objects such as boxes or walls. If a collision occurs, the bird should not continue to move.
  3. Movement logic: It is necessary to update the position of the bird according to the movement direction, as well as update the status of the game map and boxes.

Describe the problems encountered during the experiment and how they were solved. What are your gains and experiences, and what suggestions do you have for course arrangements?

Guess you like

Origin blog.csdn.net/qq_61786525/article/details/132699589