Hacklink panel

Eros Maç Tv

kavbet

หวยออนไลน์

holiganbet giriş

holiganbet güncel giriş

pinco

betcio

betcio

avrupabet

betplay

romabet

ultrabet

teosbet

rinabet

interbahis

enjoybet

bahiscasino

hiltonbet

kulisbet

dinamobet güncel giriş

Elbet Bir Gün

jojobet

Nakitbahis

sekabet güncel giriş

เว็บหวยออนไลน์

telegram grupları

primebahis

casinofast giriş

kareasbet

mavibet

sloto

marsbahis güncel giriş

betasus

ankara escort

ankara escort

new unblocked games 76

kavbet

jojobet

sekabet

Hacklink Panel

Hacklink panel

Hacklink

Hacklink panel

Backlink paketleri

Hacklink Panel

Hacklink

Hacklink

Hacklink

Hacklink panel

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink satın al

Hacklink satın al

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Illuminati

Hacklink

Hacklink Panel

Hacklink

Hacklink Panel

Hacklink panel

Hacklink Panel

Hacklink

Masal oku

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink panel

Postegro

Masal Oku

Hacklink

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink

Hacklink

Hacklink Panel

Hacklink

Hacklink

Hacklink

Buy Hacklink

Hacklink

Hacklink

Hacklink

Hacklink

Hacklink satın al

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink panel

Hacklink

Masal Oku

Hacklink panel

Hacklink

Hacklink

Hacklink

Hacklink satın al

Hacklink Panel

betsmove

casibom

pusulabet

betsmove

piabellacasino

tophillbet güncel

porno

kulisbet

pulibet güncel giriş

pulibet giriş

bahsegel giriş

alobet

ultrabet giriş adresi

bahiscasino

deneme bonusu veren siteler

kingroyal

sahabet

ikimisli giriş

casibom

sohobet

pusulabet

pusulabet

pusulabet

betebet

casibom giriş

betnano giriş

deneme bonusu veren siteler

happy ending massage Istanbul

film izle

Holiganbet Giriş

tophillbet giriş

istanbul escort

avansbet

justin tv

ekrem abi

tophillbet giriş

tophillbet

Galabet

Galabet giriş

holiganbet telegram

yabancı dizi izle

vdcasino

betasus giriş

romabet

betra

หวยออนไลน์

marsbahis

casibom

casibom

kalebet

venusbet.org

lotobet için kullanıyorum lotobet burada

lotobet

EniyiSunucum

tophillbet

padişahbet

sakarya escort

holiganbet resmi giriş

tophillbet giriş

antalya dedektör

jojobet

jojobet giriş

casibom

casibom

casibom

casibom

pusulabet

pusulabet

padişahbet

escort istanbul

deneme bonus veren siteler

deneme bonusu veren siteler

deneme bonusu veren siteler

deneme bonusu veren siteler

tophillbet

casibom

enbet

ataşehir escort

the hidden wiki

saha casino

sekabet

Lanet OLSUN

casibom

farmasi

deneme bonus veren siteler

den3me b0nusu ver3n yeni sit3ler

jojobet

tarabet

aresbet, aresbet giriş

netbahis

bahiscasino, bahiscasino giriş

xslot giriş

xslot

xslot

betkom giriş

matadorbet

Tuzla Escort

supertotobet

betzula

betgar

betnano

safirbet

abebet giriş

betcio

dedebet giriş

interbahis

betloves

maritbet

jojobet

jojobet giris

setrabet

deneme bonusu veren siteler

alanya escort

1xbet

winxbet, winxbet giriş

aresbet, aresbet giriş

winxbet, winxbet giriş

bahiscasino

netbahis, netbahis giriş

kıbrıs escort

masterbetting

deneme bonusu veren siteler

kargabet

istanbul escort

mavibet giriş

mavibet

stonebahis

interbahis

sekabet giriş

piabellacasino

jojobet giriş

casinofast

jojobet

casinofast

betlike

limanbet

meybet

nerobet

Jojobet

casinolevant

casinolevant

betebet

jojobet

safirbet

betnano

casibom

casibom giriş

marsbahis

tubidy

Grandpashabet

marsbahis

casibom giriş

interbahis

betturkey

betturkey giriş

den3me b0nusu ver3n yeni sit3ler

1xbet

casibom

robinbet

deneme bonusu veren siteler

padişahbet

bahiscasino

den3me b0nusu ver3n yeni sit3ler

taraftarium24

alobet

alobet giriş

xslot

xslot giriş

1xbet

1xbet

1xbet giriş

meritking

meritking giriş

bettilt

bettilt giriş

bettilt

bettilt giriş

kingroyal

interbahis

interbahis giriş

betlike

xslot

xslot giriş

galabet

galabet giriş

bets10

betbey

betgaranti

casinolevant

casinolevant giriş

perabet

pulibet

vidobet

meritking

meritking

meritking

betpas

kavbet

piabet

vdcasino

portobet

betpas

betcup

queenbet

galabet

galabet giriş

grandpashabet giriş

jojobet güncel giriş

casibom güncel giriş

meritking

meritking giriş

meriking güncel giriş

meritking mobil

meritking ios

perabet

vidobet

vidobet giriş

vidobet güncel giriş

casinolevant

betvole

pulibet

pulibet giriş

pulibet güncel giriş

ultrabet

betcio

deneme bonusu veren siteler

ultrabet

ultrabet

vaycasino

kavbet

lunabet

casinoroyal

betebet

meritking

meritking giriş

kulisbet

kulisbet giriş

ikimisli

ikimisli

pulibet

betgar

betgar

romabet

kulisbet

kulisbet

bahiscasino

bahiscasino

betplay

betplay

betzula

betzula

ultrabet

ultrabet

interbahis

interbahis

hilbet

hilbet giriş

casinoroyal

teosbet

mercurecasino

grandpashabet

1win

palacebet

cashwin

betgaranti

medusabahis

medusabahis giriş

grandpashabet

pusulabet

marsbahis

palacebet

vdcasino

matbet

hiltonbet

alobet

enjoybet

betcio

hiltonbet

alobet

enjoybet

betcio

meritking

meritking giriş

avrupabet

avrupabet giriş

romabet

perabet

madridbet

kingroyal

1win

palacebet

betgaranti

Steps to Make a Simple Game in Unity

Steps to Make a Simple Game in Unity

 

Ah, Flappy Bird – the game that had us all glued to our screens, guiding that little bird through pipes, only to see it hilariously face-plant “BoNk” one second later. Good times, right?

Now, if you’re diving into game development, Flappy Bird is basically the ‘hello world‘ of the gaming universe. It is the ultimate beginner’s project that every aspiring developer tackles at some point. So, in this post, we’re going to build our own Flappy Bird game using C# and Unity. Let’s not let our bird crash before it even takes off – time to start our game, let us get into the MISSION!

MISSION “CREATE FLAPPY BIRD

STEP 1: To create this project, you will need 2 things installed properly.

  1. Unity
  2. Unity Hub

You can download them from here as well.

STEP 2: Now, we will open the Unity Hub that we told you to install and then create a 2D Project.

STEP 3: Then we need to create a “Sprites folder” which you can find in the game directory and we will be importing all the images that we need for the game.

 

 

STEP 4: Now coming to downloading assets. What game assets will you need? We will need:

  1. The Bird
  2. The Pipes
  3. The Interfaces, etc.

Now, once you have completed the “download assets file“, go back to Unity and import the image.

Once you have imported, select the sprite and make sure you set its sprite mode to Multiple and Filter mode to Point and Compression to None. This will also make your sprite sharp and high quality.

And then click Apply to save changes.

STEP 5: Now as you have already noticed, our assets are compiled into a PNG file that is converted into a sprite, once imported in Unity.

Then, we need to slice this sprite using Sprite Editor so that we can easily use the objects such as the pipes, the bird, etc.

Now, select the sprite again, and right under the Generate Physics checkbox, click the Sprite Editor button.

This will open the following window.

STEP 6: Now to create a new sprite, select the objects just by dragging inside the Sprite Editor. Once you are done slicing the sprite, click Apply.

Once you are done, you will be able to see all the sprites sliced inside your Flappy Bird sprite asset.

Setting the Game Setup

STEP 7: As we are done with our assets, let us start adjusting our game aspect ratio to 9:16.

Now we will drop our game background into the hierarchy.

STEP 8: Now, move to the Scene window (CTRL + 1) and just click on the Main Camera inside the hierarchy and drag the white dot down until it matches the size of our background.

Then, go to the Inspector window and set ‘Order in Layer value to -1.

This should make your game preview ready for the player.

STEP 9: Now, as we are done with the background, the next thing we will be going to work on is the bird or our Player.

Let’s go back to our Project files and then we will have to open our Flappy bird sprite once again and then drag the bird sprite with its wing raised up into our hierarchy.

Rename the game object to Player. 

STEP 10: This time we are going to create a new animation. Go to your project window ‘click right’ select create then choose Animation. (P.s: You can name this project whatever you want)

     

Now drag the animation to the Player game object. This will automatically generate a new Animator component for our Player.

STEP 11: Next,  Press (CTRL + 6) an animation window will open. With your selected player, just go to your project window, then open the Flappy Bird sprite, and drag all the 3 bird sprites which you have in the animation window.

For making our animation look better, we will need to adjust the animation just by dragging the last keyframe to 0:10 and the second keyframe to 0:05 and leave the first keyframe to its original place.

STEP 12: The next game object that we need is the platform.

Now, go to your Project window once again and drag and drop the platform in the hierarchy.

STEP 13: Now, we need to drag this platform down at the very bottom of the screen.

So go to your scene window again and just drag the platform down.

And we will also rename this game object to Platform.

Now do the same with the background, let’s just rename it to Background.

And then select your Platform game object and change its Draw Mode to Tiled. We will also change its Order in Layer to 1.

STEP 14: This will make our platform smooth and be displayed at the top of everything.

Next, we’ll add a box collider to this game object just by clicking the Add Component button and searching Box Collider 2D.

Make sure you set its Auto Tiling to true.

STEP 15: To make the game work correctly, we need to apply physics to the player.

  1. Select the player object in your game.
    2. In the Inspector window, click on Add Component, and search for Rigidbody 2Dto add it.
    3. Next, we need to add another component. Click Add Componentagain, and this time, search for Capsule Collider 2D.
    4. After adding the Capsule Collider, change its direction to Horizontal.
    5. Finally, click the Edit Collider button and adjust the size of the capsule collider to fit your player.

STEP 16: Now we are going to create a new script so that we can make our player jump as soon as we tap our screen.

So now, you will have to go to your Project window, right-click, select Create, then choose C# Script.

Now let us name our script Player.cs

Once you have created the script, drag the script to the player game object and then open that script with Visual Studio.

——————————————————————————————————-using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float velocity = 2.4f;
private Rigidbody2D rigidbody;
// Start is called before the first frame update
void Start()
{
rigidbody = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
if(Input.GetMouseButtonDown(0))
{
rigidbody.velocity = Vector2.up * velocity;
}
}
}
Code language: C# (cs)

 

STEP 17: Now that our player, platform, and background are ready, it’s time to create the obstacles (also known as warp pipes).

  1. Open your sprites and drag the two warp pipes into the scene.
  2. Select the warp pipes, then click Add Componentand search for Box Collider 2D to add it to them.
  3. Align the two pipes vertically, similar to how they appear in the game.
  4. Create an Empty Game Objectand name it Obstacle Pipes.
  5. Drag the two warp pipes into this empty object. This means the empty game object will become the “parent” of the two warp pipes.
  6. Make sure the empty game object is placed between the two warp pipes.

Next, we’ll create a new C# script but this time it’s obstacle.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class obstacle : MonoBehaviour
{
public float speed;
// Update is called once per frame
void Update()
{
transform.position += ((Vector3.left * speed) * Time.deltaTime);
}
}
Code language: C# (cs)

Make sure to drag this script to the Obstacle Pipes game object.

STEP 18: Now that our obstacle is ready, we can create an obstacle spawner so the obstacles keep appearing continuously.

  1. First, create another Empty Game Objectand name it Obstacle Spawner.
  2. Reset its Transformposition, and then move its X position to the far right of the screen.
  3. Next, create a new C# script and name it cs.
  4. Finally, assign this script to the Obstacle Spawnergame object.

———————————————————————

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class spawner : MonoBehaviour
{
public float queueTime = 1.5;
private float time = 0;
public GameObject obstacle;
public float height;
// Update is called once per frame
void Update()
{
if(time > queueTime)
{
GameObject go = Instantiate(obstacle);
go.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
time = 0;
Destroy(go, 10);
}
time += Time.deltaTime;
}
}
Code language: C# (cs)

———————————————————————

Make sure to save all of your scripts and your scene.

STEP 19: Now, go back to Unity, and let’s save the Obstacle Pipes as a Prefab. To do this, drag the Obstacle Pipes into the Assets folder.

Next, select the Obstacle Spawner game object, and drag the Obstacle Pipes prefab into the Obstacle variable.

Finally, you will get the following results…

We’re almost done! But if you notice, the platform isn’t scrolling horizontally with the warp pipes, which looks strange.

To fix this:

  1. Create a new animation and name it platform.
  2. Drag this animation onto the platformgame object.
  3. Increase the horizontal scale of your platform.
  4. Open the Animationwindow by pressing CTRL + 6.
  5. With the platform game object selected, click the Add Propertybutton in the Animation window, and select Transform, then choose Position.
  6. To create a keyframe, click the button next to the number input.
  7. At around 3:00 seconds, create another keyframe, but this time, adjust the X

STEP 20: The game is almost done, but we still need to set up the player’s death and the user interface that appears when the player dies.

Here’s how to do it:

  • First, create a new Canvas: Go to the Hierarchy, right-click, select UI, and then click Canvas.
  • Now, right-click on the Canvasgame object you just created
  • Select UIand then Image.
  • Rename this Image game object to Restart Button.
  • Open your Flappy Bird Spriteasset, find the play button image, and drag it into the Source Image field of the Restart Button game object.
  • After applying the image, click the Set Native Sizebutton to fit the image.
  • If needed, you can scale up the image to your desired size. In this case, scale it by 85on the X, Y, and Z axes.

   

STEP 21: Next, we need to create a game manager that will handle freezing the game and unfreezing it when the player clicks the start button. It will also freeze the game and initiate a countdown when the player dies.

Here’s how to do it:

  1. Create a new Empty Game Objectand name it GameManager.
  2. Create a new C# script and name it cs.
  3. Once the script is created, assign it to the GameManagergame object.

This script will control the game’s pause and restart functionality based on player actions like starting the game or dying.

——————————————————————————————————-

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor.SceneManagement;
public class GameManager : MonoBehaviour
{
public GameObject startButton;
public Player player;
public Text gameOverCountdown;
public float countTimer = 5;
// Start is called before the first frame update
void Start()
{
gameOverCountdown.gameObject.SetActive(false);
Time.timeScale = 0;
}
private void Update()
{
if( player.isDead )
{
gameOverCountdown.gameObject.SetActive(true);
countTimer -= Time.unscaledDeltaTime;
}
gameOverCountdown.text = “Restarting in ” + (countTimer).ToString(“0”);
if(countTimer < 0)
{
RestartGame();
}
}
public void StartGame()
{
startButton.SetActive(false);
Time.timeScale = 1;
}
public void GameOver()
{
Time.timeScale = 0;
}
public void RestartGame()
{
EditorSceneManager.LoadScene(0);
}
}
Code language: C# (cs)

———————————————————————

To ensure everything works smoothly, make sure your scene is added to the Build Settings; otherwise, you’ll get an error when starting the game.

Now, let’s set up the Play button:

  1. Select the Play Buttonimage in the scene.
  2. Click Add Component, then search for Buttonand add it.
  3. In the Buttoncomponent, find the On Click()
  4. Click the small plusbutton in the bottom-right corner to add a new list item.
  5. Drag the GameManagergame object into the box under the Runtime Only
  6. In the No Functiondropdown, select GameManager, then choose StartGame().
  7. Select the GameManagergame object and drag the Play Button image into the Start Button field in the script.

Finally, don’t forget to save your scene!

STEP 22:  To make the player die when it hits the floor or warp pipes, you need to add collision detection to the Player.cs script. Here’s how to do it:

  1. Open the csscript.
  2. Add the following code to detect collisions:

——————————————————————————————————-

public GameManager gameManager;
public bool isDead = false;
private void OnCollisionEnter2D(Collision2D collision)
{
isDead = true;
gameManager.GameOver();
}Code language: C# (cs)

——————————————————————————————————-

  1. Make sure that the floor and warp pipes have the correct tags: “Ground”for the floor and “Obstacle” for the warp pipes.

This code will trigger the Die() function whenever the player collides with the ground or warp pipes, and you can link this function to the game manager to handle game over logic.

 

To finish setting up the game, start by creating a Text UI object. Right-click in the Hierarchy, select UI, and then choose Text. This will be used to display game-related information like the score or game over message. Once created, adjust the text’s properties by setting the alignment to center, checking the Best Fit option, and changing the Font Size to 25 with the Font Style set to Bold. Then, move the text object upward by adjusting its Y-axis position to 125.65.

Next, for better visual design, add a Shadow component to the text. To do this, with the text object selected, click Add Component, search for Shadow, and apply it. This will give the text a nice shadow effect, enhancing its appearance on the screen.

Finally, connect the GameManager script to the necessary objects. Select the GameManager game object in the Hierarchy and drag both the Player game object and the Text UI object into their respective fields in the GameManager script. This step ensures the script can control both the player and display text during gameplay.

Once all these steps are completed, save all your scripts and your scene. You’re now ready to play your Flappy Bird game!

Wait, hold on a second!  

Do you know?

Game development is in huge demand among employers and the job market as well. Many companies are looking for developers who are skilled in game development and can use it to create engaging and complex games. According to industry reports, game development is one of the most sought-after skills, and its popularity is expected to grow in the future. So, strike while the iron is hot and step into the industry as a fully trained professional with our game development course!

download unity game development ebook

Leave a comment

Your email address will not be published. Required fields are marked *

Red Apple Learning
DN 51 Merlin Infinite
9th Floor, Unit No: 909,
Sector-V, Salt Lake
Kolkata-700091, West Bengal
View on map
+91 6289690050
+91 6291698908

GSTIN 19AAKCR6271M1ZM