You must be familiar with flappy-bird, and that’s the same as clumsy-bird, try to fly the bird and make bird alive as long as you can.
Games are more complex than normal web applications, and need more about modular codes to make it simple and maintainable.
melonjs provides a lot of useful base class for developers to use, in
melonjs the codes will mostly like this
extend a base class which
melonjs provides, overrides the part you needed. Although codes are written in sperate files,
actually they are in the
same file. All variables are global, you need to take care of all of these. Besides, edit and debug is not quite attractive because you have to bundle files up whenever source codes changed…
What about coding with bearcat ? Then you can write modular codes in
actual sperate files and do not need to bundle up a file, bearcat will asynchronously load scirpt files for you …
To use bearcat, you can wrap the above code with a factory bean, whenever someone else need this
PipeEntity, just get the instance through the factory contrustor. Factory beans are connected with bearcat’s powerfull dependency injection.
then you want to create a pipe instance ? just inject the pipe factory into it