01219245/cocos2d-js/getting started

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
This is part of 01219245.

This document describes steps to start game programming on Cocos2d-JS.

A note on a standard installation: Cocos2d-JS is a part of the Cocos2d-x game framework that supports C++, Lua, and JavaScript. Clearly, JS denotes that it is a framework for "JavaScript". Previously, you can install the Cocos2d-JS framework separately. The whole Cocos2d-x framework gets re-organized and to use Cocos2d-JS you have download the whole framework which is pretty huge (405MB). To save you time, I have provided an empty project template for you to download. This document shows how to begin coding from that template.

Required software

The template that you will download contains all the Cocos2d-JS framework. But since your games will run in a browser, you need a way to provide game source codes and resources to the browser. Therefore, you need to run a web server on your laptop. The easiest way is to use a simple web server (HTTP server) provided by Python.

If you are using Ubuntu or Mac OS, you do not have to install python as it is already installed in your OS.

Installation for Windows users

Download Python: here. There are two versions Python 3.5.1 and Python 2.7.11. Both versions work, but I recommend Python 3.5.1.

After the installation, make sure you can call the Python interpreter. Test it by calling

python --version

It would replies with the version of Python you are running. You may have to add paths to Python when you call it, or you can add the path to bin/python.exe to your environment.

The template