Development and publication of the first Android game on Unity3D

Good day! So I finished developing my first game on Unity for Android. The reason for developing the game was the analysis of vacancies on hh. It became interesting why employers are willing to pay serious amounts to game developers. Indeed, in fact, we (developers), ideally, can be self-sufficient, because almost every serious programmer is able to create a worthy product himself and engage in its sale and promotion. It seems to me that serious issues should not arise with the creation (except for the art part, because I have not yet met a wonderful artist with excellent programming skills), but free product promotion is a secret - at least for me now.



Let's move on to the game itself. I have two young children and they often play children's toys on the phone, a kind of "distraction." Naturally, they tap on advertising banners with an enviable frequency, which is not a little pleasing to the developers of these games. The above circumstances prompted me to think of creating something similar, but not on the road ... smiling (many children's games do not shine with accuracy), but beautiful and pleasing to the eye. When choosing a topic, the time of year itself dictated to me the decision. A New Year / Christmas theme was selected. The gameplay was supposed to be very simple, but fun and colorful. Here began the work of the head on what elements to implement in the game. As a result, it was decided to put the following elements on the stage: Christmas balls, Christmas tree, Santa Claus flying over the timer and a dancing deer with a snowman.

Each ball, when pressed, was supposed to reproduce a festive melody and receive a certain impulse, correspondingly colliding with the other balls. The direction of the pulse depends on where the slide was made on the screen. Each ball object consists of AudioClip, sprite, box collider, rigidbody 2D, Distance Joint 2D and LineRendrer . You can clearly see this in the screenshot of the project. Accordingly, rigidbody 2D is needed to give the object mass and realize the effect of gravity, box collider implements collisions, Distace Joint 2D is our invisible thread on which the ball is suspended, and LineRenderer is engaged in rendering the Distace Joint 2D thread.



A click processing script is attached to each ball; processing is implemented on its own without using Unity UI.

Here is part of the tapa processing implementation code on the screen:

 if (Input.touchCount > 0)
        {
           if (Input.GetTouch(0).phase == TouchPhase.Moved)
            {
            Vector3 tmp = Camera.main.ScreenToWorldPoint(new  Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y, 0));
                hit = Physics2D.Raycast(tmp, tmp);
                if (hit.collider.gameObject == gameObject && hit.distance < 0.1)
                {
                    if (Input.GetTouch(0).deltaPosition.x>0)
                        rb2D.velocity += new Vector2(dspeed, 0f);
                    else
                        rb2D.velocity += new Vector2(-dspeed, 0f);
                    if (Asrc.isPlaying)
                        Asrc.Stop();
                    Asrc.PlayOneShot(aclip);
                 }
            }
        }

It was decided to make the Christmas tree not simple, but interactive. When you tap on the Christmas tree, music turns on, the snow begins to pour from the star, and the tree begins to dance. The Christmas tree consists of three moving elements, interconnected Distace Joint 2D . Each element has a box collider and, accordingly, a click processing script. As in the case of balls, the direction of the "dance" of the Christmas tree depends on the direction of the slide on the screen. To make the “dancing” of the Christmas tree look softer, it was decided to place the same Christmas tree a little blurry behind the object, so that the background does not glance behind the moving elements of the Christmas tree.



Santa Clauswas originally thought to be “clickable”, on a click, he had to say “Ho-ho-ho”, wave his hand and shower with gifts. Presses are processed according to the same principle as in balls and a Christmas tree. Hand swings of Santa Claus - this is a tap-play animation. Santa Claus flies along a route known in a separate animation.

Gifts that Santa Claus throws are prefabs ( I think how to bring to life prefabs, the coder reading the article knows, and this is not a lesson, but a review article, if anyone needs to, unsubscribe), which are generated in a random amount with tap on Santa Claus. When creating gifts, it was necessary to somehow realize their disappearance. I implemented the disappearance of gifts as follows: according to the timer, a particle system similar to a small firework is turned on, then cotton pops up, the gift disappears and various (random) toy sprites fly out of the place of disappearance. So that gifts do not fall through the "ground" on the stage, Edge Collider is implemented .







If you read up to this place, you noticed two buttons in the left corner of the screen, clicking on these buttons causes a dancing snowman and a deer (both are prefabs), animations were manually registered, each dancer has three animations, when changing animations, the dancers congratulate User Merry Christmas. The dance ends with a reduction in the scale of the object and the inclusion of a system of particles. There is nothing special in the implementation of the dancers, the only thing I would like to note: always when creating an animation, check the Quaternion checkbox in the interpolation settings for rotation animation .





Gameplay video (I apologize for the quality, in fact the game does not slow down, but with the running utility from Google games for recording gameplay everything was slowed down):


Images and music under the CC license can be found here: openclipart.org (images) and incompetech.com (music from Kevin MacLeod, CC attribution 3.0 license).

Now briefly tell you about the pitfalls of publishing, although they are not so pitfalls, but stones. When developing a project, a default key is sewn into it, so you cannot publish an application to Google Play with such a key. The application must be signed with your release key before publication, this is all done using standard Unity tools.There are articles in which this action is described in great detail, so I will not dwell on this in detail. Another scary stone is the indication of prices for the application in the market for different countries, get ready to puff at this stage, although there was nothing complicated, but this process was patted by nerves. The most important thing: do not be lazy to write a large adequate description of your product, this is the key to success at the initial stage, if you do not use any promotion methods. I decided to monetize the game using Unity Ads, it is very easy to integrate and works well. When embedding the AdMob plugin, I started swearing on the SDK, on ​​Java, I never beat it, and December came up very quickly, as a result I stayed on UnityAds. At the moment there are views and completed views, but there are no charges yet. So I can’t give statistics and conclusions on monetization yet.

Thank you all for reading the article. I hope it was useful to someone!
I’ll issue a link to the application in the form of a spoiler:

Also popular now: