01219245/cocos2d-js/Sprites/old getting started

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา

Make sure you get the framework installed properly. Follow instructions here.

In the steps that follow, we will create a new Cocos2d-JS application. These are the steps that you have to do when you want to start a new project.

First, find a location in your file system to keep your work. We will name our first project as tutorial1. We will create our first project by calling

cocos new tutorial1 --no-native -l js
Notes: The options --no-native is important because it tells Cocos2d-JS not to try to compile our program for other platforms (e.g., for Android or iOS).

The script will create a directory tutorial1 for your project with a sample HelloWorld code, for which we shall delete later, but for now let's make sure it is runnable.

cd tutorial1
cocos run -p web

You will see a web page with spanning image. If this is working, hit ctrl-c in the console to stop the web server.