Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17076

Run parts of Cocos from Node.js

$
0
0

@Howrad wrote:

I'm building a game in Cocos Creator, and also a server. I would like to be able to do some server-side checks in Node.js by re-using a few of the JavaScript objects I wrote for the game. These are not Components, but plain vanilla JavaScript objects.

It works a little bit, until I try to use any cc functions. So I tried including the Cocos2D JavaScript library like this:

if(typeof cc === 'undefined')
    require("../../build/web-desktop/cocos2d-js-min");

This fails with the error:

ReferenceError: window is not defined

Which is understandable, as Node.js doesn't have a window object. Is there a better way to do this, to include cc functions in a Node.js project?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>