[RELEASED] Forest Defense Game Template

Forest Defense Game Template
Asset Store Link
[WEBPLAYER DEMO] [DOCUMENTATION]



Forest Defense is an action packed game full of challenge and fun. The game is ready to release straight out of the box, and it can also be easily customized to make even more engaging to your players. The game supports PC/Mac, iOS, Android, and WinPhone. It can be played with the mouse, keyboard, gamepad, or touch controls!

How to Play?

Move with the arrow keys (or A/D) across the lanes and shoot (Mouse buttons) the correct color at the enemy to kill it. Shoot without missing to get a streak bonus.

Features:

  • Game ready for release straight out of the box, just build and play!
  • Works on all platforms, PC, Mac, iOS, Android, etc
  • Supports multiple resolutions and aspect ratios, automatically.
  • Supports Mouse, Keyboard, Gamepad, and Touch controls.
  • Easily customizable with lots of options to control game difficulty.
  • Great learning resource with commented scripts and documentation.
  • If you need help with anything, contact me, I’ll do my best :slight_smile:

This thread will be for updates, FAQ, and any question or feedback you may have.

1 Like

Working on my next update for FDG, will be adding in-game tips that trigger the first time you play. You can set how many times tips repeat, or reset them, or not show them at all.
I’ll also append documentation with more info about customizing parts of the game, and improving performance.
Might also add transition effects between scenes :smile:

1 Like

The next update for Forest Defense has been submitted!

1.03 (03.11.2015)

  • Added in-game tips which appear once you do various actions ( start game, shoot enemy, miss enemy, lose the game). You can also toggle tips on/off.
  • Added an option to assign scene transitions when loading scenes. These connect between levels with an animated effect.
  • Minor changes.

The next update for Forest Defense is submitted, should be online in a few days.

1.07 (11.11.2015)

  • Added end of level bosses. These guys are bigger, have more health, and have a tiny cute crown!
  • Added spawn sound effects, low health effect.
  • You can now only hit enemies once they land on the lane.
  • Minor changes and fixes:
  • Fixed a bug where the mobile shoot buttons got lost when upgrading from unity 4 to 5.
  • Also made sure the tips show correctly and respond correctly to the toggle button in the pause menu.
  • The enemy spawn points are random but take into account not to repeat the same lane more than once. When all lanes have been used, we can spawn on the same lanes again. This worked correctly, but whenever we used all the lanes there would be a slight delay before starting to spawn the units again. Now I fixed it so that the units are spawned continuously without interruption.

Will upload a video later.

great game!! how to change enemy and the hero?

1 Like

how to export to android? any change ?

1 Like

Is changing enemies and hero easy?

1 Like

Hi, this depends on what you want to do exactly. If you just want to replace the player/enemy prefab with another prefab you can just drag&drop the new prefab you want into the correct GameController slot, like this:

2508215--173525--FDGAssignEnemy.png

Notice you can also set an enemy boss to appear at the end of a level.

If on the other hand you want to create a whole new enemy/player from a model you have, you can simply duplicate the player for example, and then drag the 3D model into this new prefab before assigning it in the gamecontroller. You can also edit the attributes of the player/enemy in the script attached to it, and assign your custom animations to it.

Read in the documentation more about editing the player/enemy component:
http://puppeteerinteractive.com/Documentation/FDG/documentation.pdf

If you just want to change the colors of the player/enemy you can just edit the texture of the player/enemy using any graphics program.

If you have your Android SDK set up on your computer, you can build to android straight out of the box. Just switch to android platform, insert you keystore key and build. You should then get an APK file for android.

If you’re not sure about the SDK or the keystore you can read more about it here:
http://docs.unity3d.com/Manual/android-GettingStarted.html

It is similar to how my other packages work. If you have a 3D model you can drag it to the base object of my model. If you assign the parts of the model similar to how the robot is setup and you’ll get the default animations to work with your new model, or you can just assign your own animations in the player/enemy component.

Here are a few videos showing how I work with my packages, creating new enemies and replacing existing ones. The process is similar across most my packages:

https://www.youtube.com/watch?v=fM3dWFoQ8p0

https://www.youtube.com/watch?v=X2S-_0yop40

Great game! I’ll be releasing it prety soon.
One question, I’m planning to add AdMob to it; where is the transition scene script so I can add it.
Thanks again for a great template.

This looks great! I am new to this so be gentle -

How would a player on a mobile device play this game without a controller to choose the color?

I know it’s a bit late so you probably already got it sorted out, but you did you want to add the AdMob script to the transition?

There are mobile controls in the package too. When the code detects the game is working on a mobile device it switches them on.

I have not yet. Still working on the graphics. Wating for your help.

Wonderful!

Which version of Unity are you working with? I have a new implementation for UnityAds ( unity 5.2 and above ) if you want that, it’s really easy to use and shows the video after you restart X amount of times.

About the transition. The code that handles that is inside FDGLoadLevel.cs. Here you can find all the code related to restarting and loading new levels, loading url, etc. So if you potentially want to put the ad code you can put it here.

When using my UnityAds code I actually use the OnLevelWasLoaded built-in function, which triggers every time a new level is loaded, so it’s easy to put some ad code here when the player starts the game for example.

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnLevelWasLoaded.html

That sounds great. How do I get that?

@musikito

This UnityAds integration is intended for Unity 5.2 and above, and refers to another package, but the process is the same for all my games:

UnityAds Integration

Before starting download this updated UnityAds script:
puppeteerinteractive.com/assets/PUPUnityAds.cs

Since Unity 5.2 UnityAds integration has been simplified, here’s how you can have fullscreen video ads in your game:

Activating UnityAds service
From the top menu choose Window > Unity Services.

In the new window that appears, choose your organization so that an ID will be generated. A list of services appears, choose the Ads service and turn it on. Then choose the age group this game will be targeted towards, and save the changes.

Once you save the changes, a new screen appears. Here you can set which platform the ads are targeted to, Android or iOS. It’s advised that you Enable Test Mode while working on your game to avoid any potential problems. At the bottom of the screen you can see the IDs for the iOS platform and the Android platform.

Showing ads in your game
Before testing out the ads, make sure you are in a compatible platform in the editor, such as Android or iOS.

Import the UnityAds script you downloaded into your project. If you haven’t done so already, download it from here:
puppeteerinteractive.com/assets/PUPUnityAds.cs

Drag the script into an empty object in the game scene you want to show ads in.

Click on the UnityAds object you have in the scene, here you can set the number of times the level needs to be loaded before showing an ad. By default it loads 3 times before showing an ad.

That’s all, if you test the game now in the editor and restart the level several times you will be presented with a blue test ad screen.

In the actual game released on Android/iOS the game would pause and present you with a full screen video advertisement.

Before releasing a game, make sure you uncheck Enable Test Mode.

For more info about integrating UnityAds read this:

http://unityads.unity3d.com/help/monetization/integration-guide-unity

Hope that helps.

1 Like

It help a lot, thank you.

I love this game! It’s exactly the base script I needed for my next game.

That said, I can’t seem to figure out how to change the projectile’s (Player Shot) range - it still dies at a count of ten, and I’ve doubled the length of the road since then.

Where would I alter this? I don’t mind having to dig into the scripts!

Hi, glad you like the game!

If you look at the shot prefabs in the project window, the last component attached to a shot sets how long it takes before being removed. Here’s a screenshot:

2810784--204273--FDGShotTime.png

I’m intrigued to see what you’re making, so don’t forget to share a link to your game.

No dice - still getting shots that die at the ‘10’ lane size mark.

2810974--204289--Screen Shot 2016-10-04 at 4.20.10 PM.png