Coderock

--------------------------------
link hover image

Unity 2D how to create a magnet

Frontpage calendar image January 1, 2017

Make your coin a Rigidbody and try velocit to the coin.  The idea is that you have a trigger circle around the coin. Also change the tag of the magnet gameobject to “magnet”. Then set the code inside the class of coin you want pulled in. bool inside; public Transform magnet; private CircleCollider2D circleCollider; void Start […]

link hover image

Unity 2D countdown timer (Clock ) script

Frontpage calendar image September 17, 2016

Create an object hierarchy; Create a script and attach it to an object; Access namespaces; Use the Update method; Rotate stuff based on time. Add script on clock: And clockAnimator script content: public Transform hours; private const float hoursToDegrees = 360f / 60f; float timeLeft = 45.0f; // Use this for initialization void Start () […]