goeddeninfo

movePlayer

Nov 2nd, 2020
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class movePlayer : MonoBehaviour
  6. {
  7.     // Start is called before the first frame update
  8.     void Start()
  9.     {
  10.         anim = GetComponent<Animator>();
  11.     }
  12.  
  13.     // Update is called once per frame
  14.     void Update()
  15.     {        
  16.         if (Input.GetKeyDown("right"))
  17.         {
  18.             if (anim != null)
  19.             {
  20.                 anim.ResetTrigger("Idle");
  21.                 anim.SetTrigger("Activ");
  22.  
  23.             }
  24.         }
  25.         if (Input.GetKeyUp("right"))
  26.         {
  27.             if (anim != null)
  28.             {
  29.                 anim.ResetTrigger("Activ");
  30.                 anim.SetTrigger("Idle");
  31.  
  32.             }
  33.         }
  34.     }
  35. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×