CocosCreator achieve assimilation animals

Get the source

No micro-channel public concern "an unskilled laborer," send "Animal assimilation" for a complete game source code.

Gameplay

The goal is to play the game animals into the same area all the same animal. Game from the upper left corner from the right click on the need to become the target animal heads, if assimilated around animals include animals clicked, all the animals have become assimilated click to select the animal, once complete assimilation, and then gradually expand the upper left corner assimilation area until all the animals into the same.


 

Game results

There are two main game interface, game interface and start the game interface.

The following is the beginning of the game interface:


 

The following are the dynamic effects as displayed when the game:


 

Implementation logic introduced:

1. Initialization points

Each level beginning of the game, from the 14 animals in total 6 different animal selected, fixed in advance a total of 14 rows 14 square animals placed randomly select one of the game is placed into the box panel from 6 animals. (Specific logic, game reference source)

2. Is assimilation computing

From assimilation in animals, to detect whether the rules surrounding assimilation, if eligible, were assimilated, while continuing to detect new assimilated box around the animals, and so on, until there is no longer detect the surrounding finish can be assimilated until the animal, the number of steps minus one game, a few steps if there is a surplus or complete assimilation of all animals, the game is over. (Specific logic, game reference source)

 

Guess you like

Origin www.cnblogs.com/caizj/p/11583997.html