design of 'game engine' for small javascript games?

Posted by Matt Ball on Programmers See other posts from Programmers or by Matt Ball
Published on 2011-11-08T04:18:20Z Indexed on 2011/11/16 18:12 UTC
Read the original article Hit count: 478

I'm making a group of two or three simple javascript games for fun. After someone finishes one game, they'll be presented with a harder or easier version of another game depending on whether the original game was won or lost. I have a high-level question about the design of things:

So far I've created a class for one game type that manages the interaction with the UI and the state of the game itself. But for tracking how many of the subgames have been won, or for understanding whether the next game presented should be more or less difficult, are there arguments to be made for making a 'game engine' class? How does the engine communicate to the games? For instance, when a game is won, how is that information relayed to the engine? Is there a better or more common design?

(If you want to see what I have so far, the games are slowly taking shape here: https://github.com/yosemitebandit/candela and can be viewed at http://yosemitebandit.com/candela)

© Programmers or respective owner

Related posts about JavaScript

Related posts about object-oriented