Stack Tower: A Thrilling Unity 2D Game with AdMob
I recently had the opportunity to test out the Stack Tower game, a complete Unity hyper-casual game with AdMob ads, optimized for play on both Android and iOS devices. In this review, I’ll dive into the game’s mechanics, visuals, and overall experience, as well as provide my thoughts on its potential and any areas for improvement.
Gameplay
In Stack Tower, the goal is to line up blocks at the top of each other to score as much as possible. To achieve this, players simply touch the screen to drop blocks onto the stack. As the stack grows, so does the challenge, requiring precision and strategy to build a stable tower. Once the stack collapses, the game is over, and players can restart to try and beat their previous score.
The gameplay is simple yet addictive, making it easy for players of all ages and skill levels to pick up and enjoy. The difficulty curve is well-balanced, gradually increasing the challenge as the game progresses.
Graphics and Sound
The game’s visuals are charming, with colorful blocks and a clean, minimalist interface. The sound effects and music are equally impressive, providing a pleasant and engaging audio experience.
AdMob Integration
One of the standout features of Stack Tower is its seamless AdMob integration. Setting up ads is a breeze, with clear instructions provided for players to follow. For those interested in monetizing their own games, Stack Tower serves as a valuable example of how to integrate AdMob ads effectively.
Conclusion
Overall, Stack Tower is a polished and engaging Unity 2D game that is well-suited for casual gaming enthusiasts. While the game may not offer groundbreaking new mechanics or innovative gameplay twists, its simplicity and charm make it an enjoyable experience for players of all ages.
Rating: 0/5 stars (Score: 0, No rating available)
If you’re interested in exploring more projects like this, I recommend checking out my profile for additional Unity hyper-casual games.
Test it here:
Test it here (WebGL)
Or download the test apk file and test it on your Android device
Note: I’ll be updating this review once I receive feedback on the game’s performance, gameplay, and overall impact.
User Reviews
Be the first to review “Stack Tower – Unity 2D Game With AdMob (Android game and iOS game)”
Introduction
Welcome to the Stack Tower - Unity 2D Game With AdMob tutorial! In this comprehensive guide, we will walk you through the process of creating a 2D game using Unity and integrating AdMob to monetize your game on both Android and iOS platforms.
Stack Tower Game Overview
The Stack Tower game is a popular mobile game where players tap on blocks to create a tower, and their goal is to stack blocks without the tower falling. The game is simple yet challenging, and its simplicity makes it an excellent candidate for monetization using AdMob.
Prerequisites
Before we begin, please ensure you have the following:
- Unity Hub installed on your computer.
- Unity 2020.3.10f1 or later installed on your computer.
- A basic understanding of Unity and C# programming language.
- An AdMob account set up.
- A device with Android or iOS operating system for testing.
Setting Up the Project
Let's start by setting up a new Unity project for the Stack Tower game.
- Open Unity Hub and create a new project.
- Choose 2D as the game type and set the resolution to 1080p (1920x1080).
- Name your project "Stack Tower" and set the location to a directory of your choice.
- Create a new folder named "Assets" and move it to the project directory.
Creating the Game Objects
In this step, we will create the necessary game objects for the Stack Tower game.
- Create a new scene by going to File > New Scene.
- In the Hierarchy panel, right-click and select "UI > Image" to create a new UI image.
- Name the image "Background" and set its size to match the resolution of your game.
- Create a new UI image for the "Block" game object.
- Set the Block image size to 50x50 pixels and its position to (0, 0).
- Create a new UI image for the "Score" text game object.
- Set the Score text size to 20 and its position to (10, 10).
- Create a new UI image for the "High Score" text game object.
- Set the High Score text size to 20 and its position to (10, 30).
Creating the Game Logic
In this step, we will create the game logic using C# scripts.
- Create a new C# script by going to Assets > Create > C# Script.
- Name the script "StackTowerGame" and attach it to the game object.
- Open the script and add the following code:
using UnityEngine; using UnityEngine.UI;
public class StackTowerGame : MonoBehaviour { public Text scoreText; public Text highScoreText; public GameObject blockPrefab; public int initialScore = 0; public int highScore = 0;
private int score = 0;
private float blockSpeed = 0.5f;
private float blockDelay = 1f;
private float blockCount = 0;
private void Start()
{
scoreText.text = "Score: " + initialScore;
highScoreText.text = "High Score: " + highScore;
}
private void Update()
{
if (blockCount > 0)
{
blockCount -= Time.deltaTime;
if (blockCount <= 0)
{
blockCount = 0;
blockSpeed += 0.1f;
}
}
}
public void AddBlock()
{
GameObject block = Instantiate(blockPrefab, transform.position, Quaternion.identity);
block.GetComponent<Rigidbody2D>().velocity = new Vector2(blockSpeed, 0);
blockCount += blockSpeed;
}
public void RemoveBlock()
{
blockCount -= blockSpeed;
}
public void UpdateScore(int newScore)
{
score += newScore;
scoreText.text = "Score: " + score;
if (score > highScore)
{
highScore = score;
highScoreText.text = "High Score: " + highScore;
}
}
}
4. Create a new C# script for the Block game object.
5. Name the script "Block" and attach it to the Block game object.
6. Open the script and add the following code:
```csharp
using UnityEngine;
public class Block : MonoBehaviour
{
public float speed = 0.5f;
private Rigidbody2D rb;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
private void Update()
{
rb.velocity = new Vector2(speed, 0);
}
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Stack"))
{
collision.gameObject.GetComponent<StackTowerGame>().AddBlock();
Destroy(gameObject);
}
}
}
Integrating AdMob
In this step, we will integrate AdMob into our game.
- Create a new C# script by going to Assets > Create > C# Script.
- Name the script "AdMob" and attach it to the game object.
- Open the script and add the following code:
using UnityEngine; using Google.MobileAds;
public class AdMob : MonoBehaviour { privateInterstitialAd interstitial;
private void Start()
{
MobileAds.Initialize(initStatus => {
if (initStatus.Status == MobileAdsInitializationStatus.OK)
{
LoadInterstitial();
}
else
{
Debug.LogError("Mobile Ads initialization failed");
}
});
}
private void LoadInterstitial()
{
InterstitialAd.Create("your_ad_unit_id", interstitial => {
interstitial.LoadAd(new AdRequest.Builder().Build());
});
}
private void ShowInterstitial()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
else
{
Debug.LogError("Interstitial is not loaded");
}
}
}
4. Replace "your_ad_unit_id" with your actual AdMob ad unit ID.
5. Add the following code to the StackTowerGame script:
```csharp
public void ShowAd()
{
AdMob adMob = GameObject.Find("AdMob").GetComponent<AdMob>();
adMob.ShowInterstitial();
}
Final Touches
In this final step, we will add the necessary code to start the game and display the AdMob ad.
- Open the StackTowerGame script and add the following code:
private void Start() { scoreText.text = "Score: " + initialScore; highScoreText.text = "High Score: " + highScore; LoadGame(); }
private void LoadGame() { // Start the game AddBlock(); }
public void TapBlock() { AddBlock(); RemoveBlock(); UpdateScore(10); ShowAd(); }
2. Create a new UI button for the game and attach it to the game object.
3. Name the button "Tap to Play" and set its text to "Tap to Play".
4. Set the button's position to (0, 0) and its size to match the resolution of your game.
5. Attach the following code to the button:
```csharp
public void TapBlock()
{
GetComponent<StackTowerGame>().TapBlock();
}
Testing the Game
Congratulations! You have now completed the Stack Tower - Unity 2D Game With AdMob tutorial.
- Build and run the game on your Android or iOS device.
- Tap on the blocks to create a tower and watch your score increase.
- When the tower falls, the AdMob ad will be displayed.
- Test the game thoroughly to ensure it is working as expected.
That's it! You have now created a 2D game using Unity and integrated AdMob to monetize your game on both Android and iOS platforms.
Google AdMob Settings
In the GoogleMobileAds
folder, create a new file named GlobalSettings.cs
. Add the following code:
using Google-Mobile-Ads-Unity;
public class GlobalSettings
{
public static string androidAppId = "your_android_app_id";
public static string iosAppId = "your_ios_app_id";
public static string androidAdUnitId = "your_android_ad_unit_id";
public static string iosAdUnitId = "your_ios_ad_unit_id";
}
Replace your_android_app_id
, your_ios_app_id
, your_android_ad_unit_id
, and your_ios_ad_unit_id
with your actual AdMob app IDs and ad unit IDs.
AndroidManifest.xml Settings
In the Assets/Plugins/Android
folder, open the AndroidManifest.xml
file. Add the following code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompanyystacktower">
<application>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
Info.plist Settings
In the Assets/Plugins/iOS
folder, open the Info.plist
file. Add the following code:
<key>LSApplicationQueriesSimulator</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb{YourAppId}</string>
</array>
</dict>
</array>
Replace YourAppId
with your actual Facebook app ID.
AdMob Plugin Settings
In the Assets/Plugins/AdMob
folder, open the AdMobSettings.cs
file. Add the following code:
using Google-Mobile-Ads-Unity;
public class AdMobSettings
{
public static string androidAppId = GlobalSettings.androidAppId;
public static string iosAppId = GlobalSettings.iosAppId;
public static string androidAdUnitId = GlobalSettings.androidAdUnitId;
public static string iosAdUnitId = GlobalSettings.iosAdUnitId;
}
This script references the GlobalSettings
class to get the AdMob app IDs and ad unit IDs.
Here are the features extracted from the content:
- Unity 2D Game: The game is built using Unity 2D.
- Hyper Casual Game: The game is a hyper casual game, designed to be easy to play and appealing to a wide audience.
- AdMob Integration: The game includes AdMob ads for monetization.
- Android and iOS Support: The game is optimized for portrait mode on Android and iOS devices.
- Gameplay: Players touch the screen to drop blocks, and must line up blocks carefully to get a high score.
- Game Over: The game ends when the stack collapses.
- Easy AdMob Setup: AdMob setup is easy, with just a few steps:
- Go to Assets -> Google Mobile Ads -> Settings and enter your app ID.
- Open the script "Menus.cs" and enter your interstitial ad ID (lines 52 for Android, 54 for iOS).
- Portfolio: The seller has a profile on CodeCanyon, where you can find more projects like this.
$19.00
There are no reviews yet.