- Published on
Developing Flappy Fusion - A Collaborative Unity Game Project
Developing "Flappy Fusion" - A Collaborative Unity Game Project
Welcome to our blog post documenting the development journey of "Flappy Fusion", a modern twist on the classic Flappy Bird game. Our team, consisting of Bharath, Thanush, and Dinesh, embarked on this collaborative project with the objective of merging teamwork, creativity, and technical skills in game development.
Project Overview
"Flappy Fusion" offers players an engaging gaming experience set in a colorful world filled with obstacles and unique characters. Each team member contributed their expertise to bring this game to life.
Flappy Bird
Folder Structure
Fonts
This is where we put all the fonts
Materials
If there are any looping background we use materials and add the texture to the material object. e.g. In Flappy Bird Background and ground image
Prefabs
This is where we integrate the pipe obstacle and its functionalities.
Scenes
In this case, Flappy Bird has 1 level so if we want to create multiple levels we need to create scenes for every level.
Scripts
In this folder where all the project scripts are kept. e.g. gameManager, parallax, pipes, player, and spawner
Sprites
In this folder, we have all the assets like images and videos.
Scripts
- gameManager
using UnityEngine;
using UnityEngine.UI;
public class gameManager : MonoBehaviour
{
public player player;
public Text scoreText;
public GameObject playButton;
public GameObject gameOver;
private int score;
private void Awake() {
Application.targetFrameRate = 60;
Pause();
}
public void Play() {
score = 0;
scoreText.text = score.ToString();
playButton.SetActive(false);
gameOver.SetActive(false);
Time.timeScale = 1f;
player.enabled = true;
pipes[] pipes = FindObjectsOfType<pipes>();
for (int i = 0; i < pipes.Length; i++) {
Destroy(pipes[i].gameObject);
}
}
public void Pause() {
Time.timeScale = 0f;
player.enabled = false;
}
public void GameOver() {
gameOver.SetActive(true);
playButton.SetActive(true);
Pause();
}
public void IncreaseScore() {
score++;
scoreText.text = score.ToString();
}
}
- parallax
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private MeshRenderer meshRenderer;
public float animateSpeed = 1f;
private void Awake() {
meshRenderer = GetComponent<MeshRenderer>();
}
private void Update() {
meshRenderer.material.mainTextureOffset += new Vector2(animateSpeed * Time.deltaTime, 0);
}
}
- pipes
using UnityEngine;
public class pipes : MonoBehaviour
{
public float speed = 5f;
private float leftEdge;
private void Start() {
leftEdge = Camera.main.ScreenToWorldPoint(Vector3.zero).x - 8f;
}
private void Update() {
transform.position += Vector3.left * speed * Time.deltaTime;
if( transform.position.x < leftEdge) {
Destroy(gameObject);
}
}
}
- player
using UnityEngine;
public class player : MonoBehaviour
{
private SpriteRenderer spriteRenderer;
public Sprite[] sprites;
private int spriteIndex;
private Vector3 direction;
public float gravity = -9.8f;
public float strength = 5f;
private void Awake() {
spriteRenderer = GetComponent<SpriteRenderer>();
}
private void Start () {
InvokeRepeating(nameof(AnimateSprite), 0.15f, 0.15f);
}
private void OnEnable () {
Vector3 position = transform.position;
position.y = 0f;
transform.position = position;
direction = Vector3.zero;
}
private void Update() {
if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) {
direction = Vector3.up * strength;
}
if (Input.touchCount > 0 ) {
Touch touch = Input.GetTouch(0);
if ( touch.phase == TouchPhase.Began ) {
direction = Vector3.up * strength;
}
}
direction.y += gravity * Time.deltaTime;
transform.position += direction * Time.deltaTime;
}
private void AnimateSprite() {
spriteIndex++;
if (spriteIndex >= sprites.Length) {
spriteIndex = 0;
}
spriteRenderer.sprite = sprites[spriteIndex];
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.tag == "Obstacle") {
FindObjectOfType<gameManager>().GameOver();
} else if (other.gameObject.tag == "Score") {
FindObjectOfType<gameManager>().IncreaseScore();
}
}
}
- spawner
using UnityEngine;
public class spawner : MonoBehaviour
{
public GameObject prefab;
public float spawnRate = 1f;
public float minHeight = -1f;
public float maxHeight = 1f;
private void OnEnable() {
InvokeRepeating(nameof(Spawn), spawnRate, spawnRate);
}
private void OnDisable() {
CancelInvoke(nameof(Spawn));
}
private void Spawn() {
GameObject pipes = Instantiate(prefab, transform.position, Quaternion.identity);
pipes.transform.position += Vector3.up * Random.Range(minHeight, maxHeight);
}
}
Demo Video
Check out the demo of "Flappy Fusion" below:
Download Links
- Windows (exe): Download Now
- Android (APK): Download Now
Conclusion
"Flappy Fusion" is a testament to our teamwork, creativity, and technical proficiency. By following the tutorial and incorporating our own original elements, we created a game that stands out in the competitive gaming landscape.
That concludes our blog post on the development of "Flappy Fusion". We hope you enjoyed reading about our collaborative Unity game project. Stay tuned for more updates and future projects from Team Phoenix!