3 replies [Last post]
User offline. Last seen 1 week 2 days ago. Offline
Joined: 08/14/2015

Hello !

This tutorial will explain in detail how to create a smart bomb such as :
- Pressing a dedicated button will activate the bomb
- The bomb will clear all designated group (NPCs, bullets, neutral objects)
- The bomb can be limited by number of use or a timer
- The number of bombs left can be tracked on the HUD

Step 1 : Collision group
Create a collision group for your bomb. It will set who will de affected by it

- In the "level setting", set a collision group so as the player will not be destroyed by it's own bomb
- Select each group you want the bomb to destroy : NPC, bullets, Objects, etc
- Un-select each group you want to let live : bonus, background, allied NPCs, Player's bullets

Step 2 : Particule effect
Create a particle effect. It will set the visual and collision aspect of the bomb.

- In the particle editor, create a new particule.
- You can use a sprite like the white circle in the kit as a base for a 2D effect. You can use a 3D one as well if you do a 3D game.
- You have to set all speed and direction to 0. If you want it to be static. Set a matching speed if your game's screen is scrolling.
- Select "single shot" or it will activate to many time when pressing a button
- To animate it, you can use the scaling option to make it small at start, grow to full size and then retract.
- Be sure to activate collision on particule so it can destroy anything.
- In the collision tab, set the damage to high value for instant kill or one for a Damage over time effect.
- Set the collision sphere to be a little smaller than the size of the max range of the sprite.
- Associate a specific collision group so as not to destroy the player.

Step 3 : Weapon
Create a weapon to hold the bomb. It will set the number of bomb and the time between each activation

- In the weapon tab, create a new weapon
- add the bomb particule in the "muzzle flash effect"
- You must use a working bullet definition if not the bomb will not be fired.
- Set the speed to 100, range to 1 and damage to 0 (the bullet will not be seen and have no effect)
- Set the rate of fire to determine the seconds between each activation of a bomb
- Set "max active bullets" and "num bullets to fire" to "1" so you won't fire 2 bombs at once"
- Activate the reload option and set "clip ammo" to "3" if you want your player to have 3 bombs.
- Set "Max ammo" to 1. (if "0" the bomb will not work)
- Add a bad ass sound to fire the bombs

Step 4 : Player
Create a weapon slot. It will allow the player to fire the bomb

-Inside the level editor, select the player entity
- In the main tab, select the "weapon1" (it has to be the first slot for HUD to work)
- Associate the bomb weapon to the weapon 1 slot
- Be sure that your "player definition" has a button set to fire the bomb.

Step 5 : HUD
Create an icon. It will track the number of bombs left

- In the HUD editor, add a new sprite (i use a small red circle)
- In the sprite properties go to "value" and select "current ammo clip" in the "weapon1" list.
- In "Format" select "horizontal" to display as much icon as there is bomb left.
- You can position other sprites behind the bomb's indicator. They will be revealed after a bomb has been used to show the empty slot.

Step 6 : PLAY

The smart bomb should be working now. Fire away and watch them all disappear !

I will stay in touch. If something is not clear, please tell me so i can update this tutorial.
Have fun and drop the bomb !

06/04-Update : Since i wrote this tutorial from work, i forgot some details and steps. I checked proof tonight and now it's all good !

Tall Karen
User offline. Last seen 17 weeks 4 days ago. Offline
Joined: 02/26/2011
Tutorial : How to create a smart bomb

Thank you for posting this - it is very interesting to see how you did it, and a nice feature to add to a game.


User offline. Last seen 3 days 11 hours ago. Offline
Joined: 11/05/2016
Thank you Djio!

Thank you Djio!

User offline. Last seen 1 week 2 days ago. Offline
Joined: 08/14/2015
You're welcome !

You're welcome !