- Home /
Question by
georgiatolotti · Aug 21, 2017 at 04:11 PM ·
c#gameprogrammingcatch
Catch Game like Kaboom from Atari - Help Please!
I'm having a problem with this game. I don't know how to make the "Mad Bomber" move with the bombs, making an effect like he is dropping them. Anyone can help please? I need this done by thursday 08/24/2017! Thanks anyone that's willing to help.
this is the script of the game control (camera control and the spawn of the bombs)
public class GameControle : MonoBehaviour {
public Camera cam;
public GameObject bomba;
public GameObject Chao;
public static float speed;
public static float difficulty;
public static Vector3 spawnPosition;
private float maxWidth;
void Start () {
if (cam == null) {
cam = Camera.main;
}
speed = difficulty;
Vector3 upperCorner = new Vector3 (Screen.width, Screen.height, 0.0f);
Vector3 targetWidth = cam.ScreenToWorldPoint (upperCorner);
float bombaWidth = bomba.GetComponent <Renderer>().bounds.extents.x;
maxWidth = targetWidth.x - bombaWidth;
StartCoroutine (Spawn ());
}
//chao = floor / bomba = bomb
void OnTriggerEnter2D (Collider2D Chao){
Destroy (bomba.gameObject);
}
IEnumerator Spawn(){
yield return new WaitForSeconds (2.0f);
while (speed > 0.40) {
Vector3 spawnPosition = new Vector3 (Random.Range (-maxWidth, maxWidth), 4.1f, 0.0f);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (bomba, spawnPosition, spawnRotation);
yield return new WaitForSeconds (speed);
speed -= 0.01f;
}
while (speed <= 0.25) {
Vector3 spawnPosition = new Vector3 (Random.Range (-maxWidth, maxWidth), 4.1f, 0.0f);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (bomba, spawnPosition, spawnRotation);
yield return new WaitForSeconds (0.32f);
}
}
}
and do i have to create a script for the mad bomber?
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Need help in typing project 0 Answers
Make a game in C# 0 Answers
Distribute terrain in zones 3 Answers