Hello there. I’m utilizing v2.x of Cocos Creator. I used to be questioning about easy methods to save degree knowledge (structure, x and y positions, and many others.) with out utilizing tilemap like in this publish. For the nodes whose structure I’d be saving, I’d additionally want to connect parts to them. Initially, I created a brand new scene for each degree however that appears very inefficient. I’m not fairly certain easy methods to learn textual content information on startup and whereas threaded, which was advisable 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 need to use cc.assets.load to load the textual content:
https://docs.cocos.com/creator/2.4/handbook/en/asset-workflow/textual content.html
You need to use ‘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 degree constructing script (containing the extent knowledge saved in a vector) can entry the nodes is the best choice. Like in @slackmoehrle’s instance, every letter or quantity would symbolize a special node kind.
This may save house and is an effective alternative.
I’m nonetheless not sure of easy methods to embrace node place knowledge (x,y) with this method although, since every node’s place within the scene will likely be completely different, even when they’re the identical node kind.
Do you imply you don’t know easy methods to save the place of the node?
Sure, taking @slackmoehrle’s instance, I’m undecided easy methods to incorporate the node positions into the extent structure.
I feel you’ll be able to confer with the design of @slackmoehrle and add P in entrance of the place.