![]() Make sure you assign this script to Obstacle Spawner game object. We’ll create another C# script and we’ll name it spawner.cs. Then make sure you reset its Transform position and drag it’s X position all the way to the right of the screen. To do that, we’ll create another empty game object and we’ll name it Obstacle Spawner. Now that our obstacle is ready, we can now then create an obstacle spawner so our obstacle will keep on coming endlessly. Make sure to drag this script to the Obstacle Pipes game object. Once the script is created, drag the script to the player game object and then open that script with Visual Studio. So go to your Project window, right-click, select Create, then choose C# Script. We’re going to create a new script to make our player jump as soon as we tap our screen. Next, click the edit collider button and adjust the size of the capsule collider that will fit your player. Then we’ll set Capsule Collider 2D‘s direction to Horizontal. So with your Player game object selected, go to your inspector window and click Add Component and search for Rigidbody 2D.Īnd after that, we’ll add another component which is the capsule collider so click Add Component button once again and search for Capsule Collider 2D. Player Physicsįor this game to work properly, we need to apply physics to our player. Make sure you set its Auto Tiling to true. Next, we’ll add a box collider to this game object by clicking the Add Component button and searching Box Collider 2D. This will make our platform seamless and be displayed at the top of everything. We’ll also change its Order in Layer to 1. Now, select your Platform game object and change its Draw Mode to Tiled. Same with the background, let’s rename it to Background. Let’s also rename this game object to Platform. Now, obviously we need to drag this platform down at the bottom of the screen so go to your scene window once again and just drag the platform down. Go to your Project window once again and drag and drop the platform in the hierarchy. The next game object that we need is the platform. To make your animation look better, adjust your animation by dragging the last keyframe to 0:10 and the second keyframe to 0:05 and leave the first keyframe to its original place. With your Player selected, go to your project window, open Flappy Bird sprite, and drag all the three bird sprites in the animation window. Next, open the Animation window by pressing CTRL + 6. That will generate a new Animator component for our Player. Then drag the animation to the Player game object. You can name the animation whatever you want. Next, we’re going to create a new animation- so go to your project window and right-click- select Create then choose Animation. Let’s go back to our Project files and open our Flappy bird sprite once again and drag the bird sprite with its wing raised up into our hierarchy. Now that we’re done with the background, the next thing we’re going to work on is the bird or our Player. That should make your game preview ready for the player. Next, go to Inspector window and set its Order in Layer value to -1. ![]() Next, go to your Scene window ( CTRL + 1) and click on the Main Camera inside the hierarchy and drag the white dot down until it matches the size of our background. Then we’ll drop our game background in the hierarchy. Now that we’re done with our assets, let’s start this tutorial by adjusting our game aspect ratio to 9:16. Once successful, you should see all the sprites sliced inside your Flappy Bird sprite asset. Once you’re done slicing the sprite, click apply. ( Just imagine you’re using Photoshop and you’re select an image) Now to create new sprites, select the objects by dragging inside the Sprite Editor. Go ahead and select the sprite once again, and right under the Generate Physics checkbox, click the Sprite Editor button. We need to slice this sprite using Sprite Editor so we can use the objects such as the bird, the pipes, and etc. Now, if you have noticed already, our assets are compiled into a PNG file which is then converted into a sprite, once imported in Unity. This will make your sprite sharp and high quality.ĭon’t forget to click Apply to save changes. Once imported, select the sprite and make sure you set its sprite mode to Multiple and Filter mode to Point and Compression to None. Once you have downloaded the file, go back to Unity and import the image. Downloading Assetsīefore we can start creating the game, obviously we need the assets such as the bird, the pipes, the interfaces, and etc. To start, create a new Unity project and make sure that you set its template to 2D. ![]()
0 Comments
Leave a Reply. |