📜 ⬆️ ⬇️

Development and publication of the first game for Android on Unity3D

Good day! So I finished developing my first Unity game for Android. The reason for the development of the game was the analysis of vacancies on hh. It became interesting, why game developers are willing to pay serious amounts to game developers. After all, in fact, we (the developers), ideally, can be self-sufficient, because almost every serious programmer is able to create a worthy product and sell it and promote it. It seems to me that no serious questions should arise with the creation (except for the artistic part, because I haven’t met yet a wonderful artist with excellent programming skills), but the free promotion of the product is a secret - at least for me now.



Let's move on to the game itself. I have two small children and they often play toys on the phone, such “distractions”. Naturally, they tap on advertising banners with an enviable frequency, which is not a little pleased with the developers of these games. The above circumstances prompted me to the idea of ​​creating something like this, but not at the end ... s (many children's games do not shine with accuracy), but beautiful and pleasant to the eye. When choosing a topic, the time of year dictated the decision to me. Was chosen Christmas / Christmas theme. The gameplay was supposed to be very simple, but fun and colorful. Then began the work of the head on what elements to implement in the game. As a result, it was decided to place the following elements on the stage: Christmas balls, a Christmas tree, Santa Claus flying by timer and a dancing deer with a snowman.

Each ball, when pressed, had to play a festive melody and receive a certain impulse, respectively, colliding with the other balls. The direction of the pulse depends on where the slide was taken across the screen. Each ball object consists of AudioClip, sprite, box collider, rigid body 2D, Distance Joint 2D and LineRendrer . In the screenshot of the project, you can see it well. Accordingly, a rigidbody 2D is needed to give the object a mass and implement the effects of gravity, the box collider implements collisions, Distace Joint 2D is our invisible thread on which the ball is suspended, and LineRenderer is engaged in drawing the Distace Joint 2D thread.
')


Attached to each ball is a click processing script, the processing is implemented on its own without using Unity UI.

Here is part of the implementation code for tapa processing 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 tree not simple, but interactive. When tapas on the tree, music turns on, a snowball starts pouring from the star and the tree starts to dance. The Christmas tree consists of three moving parts interconnected by Distace Joint 2D . Each element has a box collider and, accordingly, a keystroke script. As in the case of balls, the direction of the “dance” of a Christmas tree depends on the direction of the slide on the screen. To make the “dances” of the tree look softer, it was decided to place the same tree a little blurry behind the object so that the background would not be visible behind the moving elements of the tree.



Santa Claus was originally conceived of “clickable”, on the click he had to say “Ho-ho-ho,” wave his hand and shower everything with gifts. Pressings are processed on the same principle as in balls and Christmas tree. The swing of Santa Claus's hand is animation played on tapu. Santa Claus flies by the route that is known to be written in a separate animation.

Gifts that Santa Claus throws are prefabs ( I think how the coder knows how to call up prefabs reading an article, and this is not a lesson, but an overview article, if anyone needs to accomplish more details ), which are generated in a random number with Santa Claus. When creating gifts, it was necessary to somehow realize their disappearance. I realized the disappearance of the gifts as follows: the timer turns on a particle system that looks like a small firework display, then there is a clap, the gift disappears and different (random) sprites toys fly out from the place of disappearance. So that the gifts do not fall through the "ground" on the stage implemented Edge Collider .







If you read this far, you noticed two buttons in the left corner of the screen, clicking on these buttons calls the dancing snowman and deer (both are prefabs), the animations were recorded manually, each dancer has three animations, and when changing the animation, the dancers congratulate User Merry Christmas. The dance ends with a decrease in the scale of the object and the inclusion of a particle system. 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 box in the interpolation settings for the rotation animation .





Video gameplay (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 slowed down):


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

Now briefly tell you about the pitfalls of publishing, although they are not so underwater, but stones. When developing a project, the debug key is sewn into it by default, and so, you cannot publish an application on Google Play with such a key. Before publication, you need to sign the application with your release key, this is 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 an application in the market for different countries, get ready to puff at this stage, although there was nothing complicated, but this process ruined your 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. AdMob plugin when embedding began to swear at the SDK, in Java, I did not overcome his swearing, and December approached 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 you statistics and conclusions on monetization. Will wait.

Thank you all for reading the article. I hope for someone she was useful!
I will draw a link to the application in the form of a spoiler:

Source: https://habr.com/ru/post/318006/


All Articles