Project training--Unity multiplayer game development--Part 2

Project scenario:

Simple realization of tasks
I haven't written a blog for a long time, and I plan to record the development process from the beginning. It
is currently the first game. I am making a small mobile game that can realize multiplayer online. The first realization is the stand-alone version. The video of Maikou was referenced at that time. His video inspired us to create, so we enriched his gameplay and realized multiplayer. Increase the richness of the board. At the same time, more detailed processing has been done for board generation and other operations.

insert image description here


Problem Description

Currently implements random generation of boards and increased difficulty.
The target effect is to generate boards through randomization, and then generate boards while ensuring that the boards do not overlap. At the same time, it must be solvable, that is, players must be able to pass through. This requires code to ensure that the board generation will not collide, and a collision detection onCollisionfunction is required to ensure that there are no colliders around.


Cause Analysis:

Tip: For the current game, the most important thing is to ensure the playability, increase the playability of the game, and increase the richness of the game. It is necessary to confirm the generation of the game board by code


solution:

For the generation of boards, a list is maintained, and randomization is achieved by randomly taking out one or more boards each time. Put all the boards we have made into this list, and then randomize the position and number of boards generated.

    public List<GameObject> platforms = new List<GameObject>();
    public List<GameObject> menacePlatforms = new List<GameObject>();

Random position, maintain a time, after a certain time, replace a more difficult board list to generate more boards, which can increase the difficulty, and teammates also realize the generation of missiles, which increases playability sex.

spawnPosition.x = Random.Range(-3.5f, 3.5f);//水平位置要随机一下
        if (countTime >= spwanTime)//到了时间就生成一个平台
        {
            CreatePlatform();
            countTime = 0;//置0
        }
        if (countTime2 >= spwanTime+1)
        {
            CreateMenacePlatform();
            countTime2 = 0;
        }

Next time I will talk about character movement and animation operations.

Guess you like

Origin blog.csdn.net/qq_53259920/article/details/124398000