M
M
mad_god2016-12-05 20:06:33
HTML
mad_god, 2016-12-05 20:06:33

How to separate data from code in js games?

I'm trying to write a game in cocos2d-js. Read books, tried examples. There is not enough understanding of how to properly plan the architecture of the project, so that it would be convenient to expand it and add code in the right places.
For example, you can make a separate script for each layer, place the necessary objects, sprites, buttons, text labels, etc. on this layer. They must have their own attributes: position, color, text, etc. Or, for example, a game level that the rest of the world has stored in a resource binary and deployed into memory by some kind of resource manager.
How to separate data from code and load data at the moment when it is necessary, for example, when loading a new level, make the project dependent not on a bunch of scripts, but on data?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2016-12-05
@xmoonlight

This is a question of the task of building an architecture.
The correct creation of architecture is 1/5 of the project.
Would you like help for free? Hardly anyone will agree...
I can give you a couple of links:
1. largescalejs.ru
2. https://addyosmani.com/resources/essentialjsdesign...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question