首页 > 代码库 > 2D game engine essentials
2D game engine essentials
All 2D Game Engines/Frameworks are trying to solve the same problems. Thus, the languages don‘t matter; they are simply the technologies, the bricks that make things happen. (Flash/AS, HTML5/JS, Cocos/ObjectiveC, MFC, Swift, etc.)
Display:
Stage, Canvas, RootViewController, they are essentially the same thing- the display entry point of an App.
DisplayContainer, Sprite, AnimatedSprite, MovieClip, they are just a family of displaying elements with deriviation hierarchy
DisplayContainer has child nodes, which could have children too
Animation, animations are basically a sequence of images being played at a certain speed/frame rate
Update/ticker funciton
Like in real world, things happen/progress as time elapses. In each timestep, coordinates being updated, images getting redrawed, calculation are performed, etc, etc.
Observer / Eventlisteners
They are basically function pointers, upon events being fired, program looks into the registered function list. This method is opposed to polling, which constantly checking certain conditions in each update cycle.
Physics/AI:
In this way physics is independent from the game engine it‘s self, irrelevant to 2d or 3d, only the calculation space matters.
Sound:
This is another dimension.
2D game engine essentials