summaryrefslogtreecommitdiff
path: root/GameCode/VelocityStretch.cs
blob: 2875de53ae408c86ac7eabd61bd5901ed6bc6829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using UnityEngine;

public class VelocityStretch : MonoBehaviour
{
	private Rigidbody2D rig;

	public float amount = 1f;

	private void Start()
	{
		rig = GetComponentInParent<Rigidbody2D>();
	}

	private void Update()
	{
		base.transform.localScale = Vector3.one + new Vector3(Mathf.Abs(rig.velocity.x), Mathf.Abs(rig.velocity.y), 0f) * amount;
	}
}