| With the development of China’s Internet, the PC network is increasingly saturated, while the mobile Internet is showing explosive growth trend. With the emergence of Android, iPhone mobile platform, mobile game development is becoming more and more popular. As one of the most popular mobile phone game engine, coco2d-x mobile game engine plays a vanguard role.Cocos2d-x is an open source game engine with MIT licenses. Its outsta nding characteristic is fast, simple and powerful. Cocos2d-x’s core advantage is to allow developers to cross platform deployment, including Android, Windows, iOS, blackberry and Tizen, etc., and it also supports C++, Lua,Javascript and other popular language well. Therefore, you can develop a game running everywhere. Cocos2d-x is not only welcomed by individual developers, but also by many famous Large Firm such as Zynga, KONAMI, Disney’s mobile department. By the end of September 2015, Cocos2d-x game worldwide downloads exceeded 1 billion 500 million, many of them are also popular games on AppStore and Google Play list in the long term.Based on the many advantages of Cocos2d-x, this paper chooses the simulation engine as the clustering effect.The cluster is used to simulate the movement of animal groups in the field of artificial intelligence. The normal clustering algorithm to represent the computer processing unit, only complete the simulation of the particles, such as snow, rain and so on, b ut it has limitations. In the game, characteristics of the group are often gathered together, and their behaviors are all the same, which makes the game process is too stiff. To solve this problem, this paper makes an improvement on the average moving position, the moving direction, and the collision avoidance, which makes the simulation object more flexible and realistic. |