How to use cocos creator to develop cross-platform games

**

How to use cocos creator to develop cross-platform games

**
Three years ago, WeChat officially released the mini program development framework, which opened a new era of traffic. Two years ago, the first WeChat mini game was officially released, and it spread to hundreds of millions of users overnight. .
Insert picture description here

As a lightweight game, coupled with the huge user base of WeChat backed by WeChat, Jump One Jump wins a huge amount of traffic in an instant. Many businesses have begun to discover the market for mini games, including later Douyin mini games, which contain a lot of content. Traffic and business opportunities.

As a veteran cross-platform game development engine, cocos can automatically generate Android, iOS, H5 games with a set of codes, which is very convenient. Soon it was also adapted to WeChat mini-games. That is to say, after the developers have developed the game, they only need to choose to generate the WeChat mini-game when it is released. The code of the WeChat mini-game can be generated in 1 second and it can be run immediately. This greatly reduced the developer's development cost. Later, Douyin became popular. Douyin launched the Douyin applet, and cocos also adapted the Douyin applet to achieve a set of codes and run everywhere.

cocos creator is the latest development platform launched by cocos company. The entire development adopts js development language, which is much simpler than the previous C++ and lua scripts. Many original h5 front-end developers can get started quickly, so we use cocos creator to develop game.

The first step is to download and install the creator development kit on the cocos official website https://www.cocos.com/products#CocosCreator,

After installation, open cocos creator and create a new empty project
Insert picture description here

The game in cocos creator is based on scenes. Each scene is a picture, and a canvas is covered on the scene. We put all the materials and controls on the canvas by creating a new node, and right-click to select canvas -> Create node -> Then select the corresponding node according to the material type.

We can add corresponding components to the nodes. Cocos provides us with many collision components, UI components, physical components, etc. to achieve various effects.

We can also right click -> New -> javascript, create our own script, and then drag the script to the node, and then we can use JavaScript to control various elements in the game.

Establish multiple scenes and connect them to form a complete game.

Take the following star-eliminating game as an example, a total of three scenes, LoadingScene, MenuUI, and GameScene have been established.
Insert picture description here

After the game is developed, we need to package and publish it. At this time, we can choose to package it into different packages according to which platform we need to publish on. (If you need to package the iOS package, you must be on the mac to see the iOS options).

Select the project -> build release -> release platform to drop down to see a variety of release platforms, select the release platform you want to package.
Insert picture description here

Some platforms have their own exclusive functions, such as WeChat app login, mini program login, app payment, and mini program payment. They are all different and require separate access to the platform's SDK.

Guess you like

Origin blog.csdn.net/weixin_36520502/article/details/108664424