Monday, October 24, 2022
HomeGame DevelopmentStage Knowledge Query(s) - Cocos Creator

Stage Knowledge Query(s) – Cocos Creator


Hello there. I’m utilizing v2.x of Cocos Creator. I used to be questioning about the right way to save stage information (structure, x and y positions, and so on.) with out utilizing tilemap like in this submit. For the nodes whose structure I’d be saving, I’d additionally want to connect elements to them. Initially, I created a brand new scene for each stage however that appears very inefficient. I’m not fairly certain the right way to learn textual content recordsdata on startup and whereas threaded, which was really helpful within the thread I linked. Additionally, what’s the easiest way to write down out every node and its particulars to a file as slackmoehrle mentioned? Code examples can be appreciated.


You should utilize cc.assets.load to load the textual content:
https://docs.cocos.com/creator/2.4/guide/en/asset-workflow/textual content.html

You should utilize ‘jsb.fileUtils.writeStringToFile’ to write down to a file.

I used to be questioning if writing out every node kind’s particulars to a file manually beforehand and utilizing module.exports so a stage constructing script (containing the extent information saved in a vector) can entry the nodes is the best choice. Like in @slackmoehrle’s instance, every letter or quantity would characterize a special node kind.

This may save area and is an efficient selection.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments