I am developing this faller platformer where the player is to reach the bottom while picking the right platforms to land on. There are also pickups for the player on the way down. When my player lands on the the blue plartforms they are meant to change color and the pickups and meant to deactivate when the player collides with them.
This does not work all the time. Sometimes the player will collide with the plartform or pickup and nothing will happen. Could anyone help me with this.
Here is the Trigger code below.
void OnTriggerEnter2D(Collider2D target)
{
if (target.tag =="Door")
{
cameraScript.moveCamera = false;
DoorUI.SetActive (true);
// Door open and stop the camera.
}
if (target.tag == "Coins")
{
coinCount++;
scoreCount += 200;
AudioSource.PlayClipAtPoint(coinSound, target.transform.position);
target.gameObject.SetActive (false);
}
if (target.tag == "Life")
{
lifeCount++;
scoreCount += 300;
AudioSource.PlayClipAtPoint(lifeSound, target.transform.position);
target.gameObject.SetActive (false);
}
if (target.tag == "Boundary")
{
cameraScript.moveCamera = false;
countPoints = false;
CheckGameStatus();
}
if (target.tag == "Deadly")
{
cameraScript.moveCamera = false;
countPoints = false;
CheckGameStatus();
}
for(int i = 0; i < listener1.Length; i++)
{
if (target.gameObject == listener1 *)*
-
{*
musicBoostCount++;
-
Debug.Log ("IT HAPPEND");*
-
}*
-
}*
-
for(int i = 0; i < listener2.Length; i++)*
{
_ if (target.gameObject == listener2*)_
_ {*_
musicBoostCount++;
* Debug.Log (“IT HAPPEND2”);*
* }*
* }*
* if (target.tag == “Clouds”)*
* {*
* grounded = true;*
* }*
}`
Here is a Link to My Dev Blog with Gifs of the game in case anyone needs more info :
[1]
_*[1]: https://mzitodevblog.wordpress.com/2016/05/09/gameplay-gif-monday/*_