Sunday, November 6, 2022
HomeGame DevelopmentStage Information Query(s) - Cocos Creator

Stage Information Query(s) – Cocos Creator


Hello there. I’m utilizing v2.x of Cocos Creator. I used to be questioning about methods to save stage knowledge (structure, x and y positions, and so on.) 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 stage however that appears very inefficient. I’m not fairly certain methods to learn textual content recordsdata on startup and whereas threaded, which was really useful 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 stated? Code examples can be appreciated.


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

You should 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 stage constructing script (containing the extent knowledge saved in a vector) can entry the nodes is the most suitable choice. Like in @slackmoehrle’s instance, every letter or quantity would characterize a unique node kind.

This may save house and is an effective alternative.

I’m nonetheless uncertain of methods to embody node place knowledge (x,y) with this strategy although, since every node’s place within the scene will probably be totally different, even when they’re the identical node kind.

Do you imply you don’t know methods to save the place of the node?

Sure, taking @slackmoehrle’s instance, I’m undecided methods to incorporate the node positions into the extent structure.

I believe you possibly can consult with the design of @slackmoehrle and add P in entrance of the place.

Okay, thanks for the assistance! I respect it so much.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments