How to implement the setup rules like Clash of Clan?

Posted by user25959 on Game Development See other posts from Game Development or by user25959
Published on 2013-10-29T02:49:31Z Indexed on 2013/10/29 4:18 UTC
Read the original article Hit count: 230

Filed under:
|

Now I'm already implement the setup build rules which the building could move by unit grid width and height. But the validation detection is poor efficiency. The algorithm cost me 10~12(ms) in average when I move the building.

Here is my approach to that: 1.Basic Grid, it is a two dimensional array. Grid[row][column], so that I can save info for each grid. Like whether is it in occupied or excluded.

2.Exclude Space, this is a space which limit same building numbers in space.

© Game Development or respective owner

Related posts about cocos2d

Related posts about cocos2d-x