Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write the code for Mini Program game development?

Shulou Source: shulou.com Published: 2022-06-01 06:58:58 10月01日 Update

Today, Xiaobian will share with you the relevant knowledge points on how to write the code of Mini programs game development. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you will gain something after reading this article. Let's find out together.

Install development tools

Go to the developer tools download page and download the corresponding installation package according to your operating system.

New Project Select Mini programs project, select the hard disk path where the code is stored. At present, Mini games do not provide public registration. Click to experience Mini games using AppID-free mode. Give your project a nice name. Finally, check "Create a quick game launch template"(note: you have to select an empty directory to have this option), click OK, and you have your first Mini games.

Click on the compile menu at the top to preview your first Mini games in the IDE.

Real Machine Preview

Click on the compile button on the tool to see the performance of this Mini games on the simulator interface on the left side of the tool. Click the preview button to experience your first Mini games on your phone by sweeping WeChat.

file structure

Mini games have only the following two required files:

├── game.js

└── game.json

game.js Mini games entry file

game.json Profile

configured

Mini games developers configure by writing a game.json file in the root directory. Developer tools and clients need to read this configuration to complete relevant interface rendering and attribute setting.

deviceOrientation Supported screen orientations

showStatusBar Whether to display status bar

networkTimeout Time out for network requests in milliseconds

networkTimeout.requestwx.request timeout in milliseconds

networkTimeout.connectSocketwx.connectSocket timeout in milliseconds

networkTimeout.uploadFilewx.uploadFile timeout in milliseconds

networkTimeout.downloadFilewx.downloadFile timeout in milliseconds

workers Multithreaded Worker configuration item, please refer to Worker documentation for details

deviceOrientation

value description

portrait

landscape

Example configuration {"deviceOrientation": "portrait","networkTimeout": {"request": 5000,"connectSocket": 5000,"uploadFile": 5000,"downloadFile": 5000}} The above is "How to write the code of Mini programs game development". Thank you for reading all the contents of this article! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Mini Game development configuration units tools files time knowledge articles code programs developers projects selection content buttons interface experience reference compilation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Linux Apple Docker