Question by
ger122 · Jul 21, 2017 at 03:16 PM ·
scripting problem2d game
my game wont end when no enemy is killed
I have a code set so if no enemy is killed within a few seconds the game is over it works at first bit after a few sec0nds it doesn't ,, so if you don't kill a enemy the game wont end. I want it set so that if no enemy is killed after few seconds the game will end but its not
I cant find why ... so again it works at first but after a few seconds or a few kills it stops working
What I want= I want throughout the entire game setup so that if no enemy is killed and dragged to top of screen every few seconds the game will end
heres code
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class fishdedd : MonoBehaviour {
public AudioClip pop1;
public AudioClip boing;
AudioSource audio;
Animator anim; //reference to the animator component
void Start()
{
audio = GetComponent<AudioSource>();
//get reference to the animator component
anim = GetComponent<Animator> ();
}
void OnCollisionEnter2D(Collision2D other)
//void OnTriggerEnter2D(Collider2D other)
{
*/
if (other.gameObject.tag == "topy" || other.gameObject.tag == "Wall" )
{
// do something when we collide with "enemy1" OR "enemy2"
anim.Play("fishded");
anim.SetTrigger("Die");
GetComponent<AudioSource> ().Play ();
audio.PlayOneShot(pop1, 0.7F);
DeathWatch.ReportDeath ();
//ScoreManager.score += scoreValue;
}
else if (other.gameObject.tag == "shark" || other.gameObject.tag == "shark" )
{
// do something else when we collide with "enemy3" OR "enemy4"
anim.Play("fishded");
anim.SetTrigger("Die");
GetComponent<AudioSource> ().Play ();
audio.PlayOneShot(boing, 0.7F);
DeathWatch.ReportDeath ();
}
}
}
}
}
}
*/
Comment
Your answer
Follow this Question
Related Questions
Tooltip doesn't work 0 Answers
2d rigibody error? 1 Answer
No overload for method. 1 Answer
How to make movement speed decrease for 2D Top-down shooting game? 0 Answers
Jump Script 2 Answers