Added randomized sprite flipping to instantiation of objects and dirt/fluid sprites

This commit is contained in:
Gregory Campbell
2020-06-06 19:44:55 -04:00
parent 7b24642fe4
commit 48509a8626
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ public class DirtScript : MonoBehaviour
if(other.gameObject.name == "SprayBottle" && !sprayed)
{
sprayed = true;
Instantiate(Spray, new Vector2(this.transform.position.x, this.transform.position.y), Quaternion.identity);
Instantiate(Spray, new Vector2(this.transform.position.x, this.transform.position.y), Quaternion.Euler(Random.Range(0, 2)*180, Random.Range(0, 2)*180, 0));
}
}
+3 -2
View File
@@ -106,10 +106,11 @@ public class GameScript : MonoBehaviour
pickedUpItem = null;
float sizeChange = Random.Range(0.75f, 1.5f);
float sizeChange = Random.Range(0.9f, 1.25f);
Object.GetComponent<SpriteRenderer>().sprite =
ObjectSprites[Random.Range(0, ObjectSprites.Length)];
Object.transform.localRotation = Quaternion.Euler(Random.Range(0, 2)*180, Random.Range(0, 2)*180, 0);
Object.transform.localScale *= sizeChange;
Object.AddComponent<BoxCollider2D>();
@@ -138,7 +139,7 @@ public class GameScript : MonoBehaviour
}while(placement.collider == null || placement.collider.gameObject.tag != "Object");
Instantiate(Dirt, new Vector2(xBound, yBound), Quaternion.identity);
Instantiate(Dirt, new Vector2(xBound, yBound), Quaternion.Euler(Random.Range(0, 2)*180, Random.Range(0, 2)*180, 0));
}
}