Skip to content

Instantly share code, notes, and snippets.

View snarlynarwhal's full-sized avatar

PJ Legendre snarlynarwhal

View GitHub Profile
@snarlynarwhal
snarlynarwhal / SpriteAlphaFlicker.cs
Last active September 11, 2020 23:10
Makes the sprite alpha flicker.
using UnityEngine;
public class SpriteAlphaFlicker : MonoBehaviour
{
public float flickersPerSecond = 15f;
public float flickerRangeMin = -0.1f;
public float flickerRangeMax = 0.1f;
private SpriteRenderer spriteRenderer;
private float alpha;
@snarlynarwhal
snarlynarwhal / FollowMouse.cs
Created September 12, 2020 14:20
FollowMouse.cs
using UnityEngine;
public class FollowMouse : MonoBehaviour
{
public float positionZ = 0;
private void Update()
{
Vector3 mouseWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mouseWorldPosition.z = positionZ;