This is an exciting summary, because in this summary you can finally see the running effect of your first demo.
1. Use the Egret tool to run the game
To run the Egret project, we need a running HTTP server. In the previous tutorial on installing Egret, we have recommended an HTTP server for you. Now let's take a look at how to run our project using the simplest HTTP server provided by our egret.
Like the previous tutorial, our Prime Minister locates our project in the terminal, using the cd command.
Then we execute a simple command to start Egret's HTTP server, the command is as follows:
egret startserver HelloWorld
In this command, egret startserver is the command to start the egret internal server, and HelloWorld is our project name.
When the command is run, you will see the effect as shown in the figure.
The egret tool will then start your browser, and the browser you start is the default browser for the current operating system. After the egret tool starts Chrome, the specified web page will be opened. The default web page is http://localhost:3000/HelloWorld/launcher/index.html
At this time, you will see a Hello World effect with simple animation in Chrome, as shown in the figure below:
Here we briefly explain the server address below. The default server address provided is http://localhost:3000/HelloWorld/launcher/index.html . The HTTP server access address that egret started for us is http://localhost:3000/ , where http://localhost is the local access address, 3000 is the port number we use, and the port number used by egret is "3000". Please make sure that port 3000 is in an unused state before starting the server.
2. Use third-party HTTP server tools to run the game
If you have other HTTP tools installed, you can now open it and run it
Copy bin-debug , launcher , and resources folders in the game project to the root directory of the HTTP server or the directory of the same level. Access your server address to run the game.
The access address rule is http://你的服务器地址/launcher/index.html