Advertisement
Atomic_Violetta

Boo Ghost Code

Mar 9th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // Boo Ghost Script
  2. // name
  3.  
  4. using UnityEngine;
  5.  
  6. class BooGhostScript : MonoBehaviour
  7. {
  8. // Start is called before the first frame update
  9. protected void Start()
  10. {
  11. {
  12. Private SpriteRenderer memberSpriteRenderer = null;
  13. }
  14.  
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. // Create a color variable.
  19.  
  20. Color localColor;
  21. localColor = Color.black;
  22.  
  23. // Get the sprite color.
  24.  
  25. localColor = memberSpritRenderer.color;
  26.  
  27. // Change a color.
  28.  
  29. localColor.r = 1.0f; // 0.0 is no red, 1.0 is max red.
  30. localColor.g = 0.5f; // 0.0 is no green, 1.0 is max green.
  31. localColor.b = 0.0f; // 0.0 is no blue, 1.0 is max blue.
  32. localColor.a = 0.5f; // 0.0 is completely invisible, 1.0f is completely visible.
  33.  
  34. // You have to change the sprite renderer color
  35. // to actually change the color.
  36.  
  37. memberSpriteRenderer.color = localColor;
  38.  
  39. }
  40. }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement