Unity beginner tutorial. Learn how to animate and control a 2D sprite using only mouse input.


❤️ Subscribe to Oxmond Tutorials. Stay ahead of the game:
https://bit.ly/SubscribeOxmondTutorials

Download free helicopter animation sprites here:
http://paulmakegames.blogspot.com/2017/04/attack-helicopter-animated-sprite.html (by Paul Chin)

Download Unity here:
https://unity3d.com/get-unity/download

🎵 Music by:
Max McFerren

😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:
https://shop.oxmond.com/discount/OXMONDSALE


Helicopter script:

/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Helicopter : MonoBehaviour {

	void Update () {

        if (Input.GetMouseButton(0))
        {
            transform.Translate(0f, 0.1f, 0f);
        }
        else {
            transform.Translate(0f, -0.1f, 0f);
        }
		
	}
}