How to control an animated 2D helicopter sprite with the mouse (Unity C# tutorial for beginners)

Опубликовано: 10 Март 2025
на канале: OXMOND Tech
2,481
33

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

····················································································

♥ Subscribe to Oxmond Tutorials:
https://bit.ly/SubscribeOxmondTutorials

● Get the Helicopter Script here:
https://oxmond.com/how-to-control-an-...

● Download free helicopter animation sprites here:
http://paulmakegames.blogspot.com/201...
(by Paul Chin)

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

😷👕 Need a face mask / developer T-shirt? Drop by our merchandise shop and get a 20% DISCOUNT on your first purchase by using the discount code YOUTUBE. Just follow this link:
https://shop.oxmond.com/discount/YOUTUBE

● Music by:
Max McFerren

#Unity3d #UnityTutorial #UnityTutorialBeginner

····················································································

● The Helicopter Script:

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

public class Copter : MonoBehaviour {

void Update () {

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

}
}

····················································································

Try our free Bumperball game:

iOS:
https://apple.co/2CGNr7F

Android: https://play.google.com/store/apps/de...

····················································································