How to make a bomb?

Hello, this is my first post, I have searched for almost a week now and yet it seems that I either dont know how to search for tutorial effectively, or there is not much that could help me. I really hope there is someone that can help me or point me at the right direction. I believe you had similar moments where you wished someone gave you a hand. Any help will be appreciated.

I am a Computer Science student, I have 3 years experience with Java, C++ and some other languages such as JavaScript and Lisp etc.

The problem:
I would like to recreate the game Bomberman in blender. For those who know what Bomberman is, skip the following short paragraph.

Bomberman:
Players compete with each other in a maze-like arena filled with blocks. Players can plant bombs to blow up obstacles and also defeat other players. There are obstacles that can and cannot be blew up. The bomb, once set, will explode after a certain time, and the “flame” of the explosion is shaped like a cross. Anything that is affected (touched) by this cross-shaped flame will be affected. (Except walls that are indestructable)

My problem is mainly about the bomb, at least at the moment. I am wondering how do I make the player character to plant a bomb that will do something automatically after a time period, and also, when it explodes, how should i remove the bomb?

I have currently implemented the maze and the player character, which is just a cylinder, and the player can plant bomb by pressing space. That will trigger an “Edit Object” Actuator which place an object OB:Bomb into the current location.

I have searched in the game logic and Python API for classes that support timing of events, I have also went through the short list of BGE tutorials in Blender wiki. However no luck.

I would greatly appreciate it if someone can suggest me a way of implementing it. It will also be very helpful to kindly point me to the correct materials that I can study.

Thankyou for you time, hope you guys can help me out on this one.

Well, its seems like you may need to know the Blender Game engine a little better. Once you learn about properties and stuff like that it wouldn’t be that hard to piece together. Check ace24ace1224 for some good tuts.

basic outline:

There is a timer property (I don’t know much about) that might work and have it when it reaches 0 end object bomb and add object explosion which also gets deleted after the explosion animation happens. Logic setup:

Timer prop counts down

Timer = 0 >>AND>> add object explosion (set the number on the actuator to set the amount of time it lives) >> End object Bomb.

on the explosion animation have it play when it gets added (I think that is a little more complicated, but no to much)

That should pretty much get it, just post a more specific question and I should be able to answer in greater detail.

Well… In my experience, the timer property counts up, but its really not that difficult to work with.Under the edit object actuator, there is a remove object option. Use this to get rid of the bomb when it explodes.

Yes, the timer counts up, and it doesn’t reliably hit an exact value (like 1.0), so don’t use the Property: Equal To sensor to check to see if it’s counted high enough (five seconds or whatever…). Instead, use the Property: Range and set it to a range around the number you want (like 4.9 to 5.1 seconds).

Thanks for the info guys. My knowledge in the Blender Game Engine is quite limited because I have not studied the Game Logic before. I have tried to implement few games according to some, in my opinion, poorly written tutorials, and learned little about the engine.

I have learned the basics of creating sensor controller and actuator and how to link them to create more sophisticated behavior, however how do Python Scripting relates to the Blender Game Engine and the sensors controller actuators is still very blurry to me.

I know how to get the current controller and hence its owner and so on, how to add a Python Script to a controller, and how to invoke the actuator from Python code etc. But I feel that I am missing scattered pieces of information.

I have no problem with Python itself due to my experience in OO programming, however I need some clarification on how do Blender Game Engine links to and interact with it.

One of the best tuts i’ve seen to get someone started in Blender, but you probably already know this stuff as you said. http://theboomshelter.com/hss.html

“Beginning BGE Python”:

http://www.blendenzo.com/tutBeginningBGEPython.html

The site is a great resource in general. I recommend you look at all tutorials hosted there.

Hi guys, I have checked some tutorials and so on, things have gone okay. I have only spent like 2-3 hours reading the stuff you guys posted and it helped a lot.

I have implemented the bomb timer as a property, and it worked very well.

however i have a rather weird problem, it is when “add object” is used (Edit Object actuator), the new object that i have added to the scene is distorted, and i am not sure why and how can i fix this.

you can download my .blend file:
http://www.gapton.com/gapton/cw3.blend

play with it a bit, and you shall see that when the bomb explode, a cross shaped fire came up and disappear after a while again, however the cross is not in the right size, i wonder why? could it be that the cross uses the player character’s (the gray cylinder named OB:Bomber) dimxyz and scalexyz properties and carry these dimensions onto itself?

Go to layer 2 (where the cross and bomb are). Select the bomb. See it’s scale values of .7? When the cross is added by the bomb, it inherits the bomb’s scale. This is the way all added objects work. Simply select the bomb and press Ctrl + A to apply the scale to fix the problem.

Also, if you understand Python already, then you will want this website link:
http://www.tutorialsforblender3d.com/GameFunctions/GameLogicPage1.html
Here you will find a very complete listing of all the Python functions that the Game Engine provides.

Edit: BTW, I like what you’ve made so far. Looking forward to seeing it completed!

lookin’ good, but one crit so far:
instead of making the cross be a single object, you should have primary and secondary “explosion blocks” so if the primary explosion dissolves an obstacle, the explosion stops there, or the primary adds the secondary if there’s no collision (jeez, my explanations seem to get worse and worse…)

Firstly thanks for the replies from all of you guys :smiley:
The Ctrl + A method worked, I have no idea that after scaling the object, you still need to press Ctrl + A to “apply” the scalling/transformation again. I thought pressing enter after adjusting it will do the job lol

about the secondary explosion block thing… If i was to code this in other languages i wouldnt be so lost lol. if i need to do this in the Blender + Python combination, as i am not used to implementing half of the functionalities in BGE using logic blocks and finishing the second half using a programming language, i am as good as a headless chicken lol