i’m new on this comunity but is a lot of month i’m reading all the post.
I’m a 3d artist but i whant to make for training a bomberman game with Unity for understand better the scripting language.
Than my first problem is, how to make the bombs?
i’ve try to make the bomb script but it doesent work proprely.
this is the screen shot of the “game”.
i’ve think to use the green helpers for say at the code to place the bomb on it when i press the fire button. And it work but if i stay over the green helper and i press the fire button he create a lot of bomb and not only one. And also if i want to make it explode than desaper from the scene he delete the bomb in the scene and than he doesent place other bomb. this is the code of the explosion it doesent work.
[/img]
function Update () {
var posto= GameObject.FindWithTag("posto");
Instantiate(Bomb, transform.position, transform.rotation);
Destroy (bomb,3);
}
//
and this is the placing bomb code with a lot of code with comment for my debugging for see if all work… but doesent work proply
[/code]//var projectile : Rigidbody;
function OnTriggerStay (other : Collider) {
var bomba = GameObject.FindWithTag(“bomba”);
print(transform.position.x);
var x=transform.position.x;
print(transform.position.y);
var y=transform.position.y;
print(transform.position.z);
var z=transform.position.z;
// Ctrl was pressed, launch a projectile
Debug.Log(“contatto”);
var bombe=1;
if (Input.GetButtonDown(“fire1”)) {
// Instantiate the projectile at the position and rotation of this transform
// Give the cloned object an initial velocity along the current
// object’s Z axis //clone.velocity = transform.TransformDirection (Vector3.zero);
if (bombe==1){
Debug.Log(“MAramao”);
// Instantiate the projectile at the position and rotation of this transform
//Destroy (atom,10.0);
//yield WaitForSeconds(1.0);
bombe=2;
}
if (bombe==2){
// Instantiate the projectile at the position and rotation of this transform
Debug.Log(“com”);
//yield WaitForSeconds(1.0);
bombe=0;
}
if (bombe==0) {
Debug.Log(“ciao”);
var clone: bomba;
clone=Instantiate(bomba, transform.position, transform.rotation);
clone.Destroy(1);
bombe=3;
}
if (bombe==3) {
Debug.Log(“destroy”);
yield WaitForSeconds(1.0);
Destroy(bomba);
bombe=1; //Debug.Log(“destroy2”);
}
}
else {(Debug.Log(“nothing”));
}
}
[/code]
Someone can help me to understand what is wrong or what is better to do for make it work correct?
Uhm there is an other problem, in the unity viewer the rotation of the player work right but when i built it it doesent work correct. some one know why?
I’m looking into the background of bomber man and really all it is is planting the bombs and making explosions. for the explosions you could use particle system. but what i dont get is how you would make the script recognize the collision between the player and the particle system. But if you know that part your pretty much set. I suppose you could use 3d boxes if that would be simpler like the 2d versions of bomberman where the fire just poped up and you died if you had collision with it. But to be fair if your looking to make something like bomberman ACT ZERO (biggest fail ever) dont bother case nobody will play it. Unless you replaces the cyborg things with 3d versions of the ORIGINAL charictors. But hay i like new ideas.
//clone.velocity = transform.TransformDirection (Vector3.zero);
/\ look. Thea’s //. You are cloning the object when you press down fire but unity wont read that because theres a double thing there (/-one of those) It maybe a mistake but it looks like thats your problem. Sorry if its not i was just skimming and scanning the script. its too long for me sorry.
I’m trying to do a bomber_mario like game: a platformer with features of both mario and bomberman.
to set the bomb properly you have to calculate the position in the world relative to your character.
take a look at my code, this is not complete yet because it requires me to tap forward or backward to place the bom in the right spot but it a start point.
=====Place bomb script====
var myRightPos : Vector3;
var myLeftPos : Vector3;
var bomb : GameObject;
var bombInFront:boolean;
var bombDir: Vector3;
var bombPos:Vector3;
var myRightDir : Vector3;
var myLeftDir : Vector3;