Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class player : MonoBehaviour
- {
- Animator anim;
- Rigidbody2D rb;
- public float speed;
- float thisSpeed;
- bool fright;
- void Start ()
- {
- anim = GetComponent<Animator>();
- rb = GetComponent<Rigidbody2D>();
- }
- void Update ()
- {
- }
- void FixedUpdate()
- {
- if (Input.GetKey(KeyCode.A))
- {
- thisSpeed = -speed;
- anim.SetInteger("penis",2);
- }
- else if (Input.GetKey(KeyCode.D))
- {
- thisSpeed = +speed;
- anim.SetInteger("penis", 2);
- }
- else
- {
- anim.SetInteger("penis", 4);
- }
- if (Input.GetKey(KeyCode.R))
- {
- }
- transform.Translate(thisSpeed, 0, 0);
- thisSpeed = 0;
- if (thisSpeed < 0 && fright)
- {
- Flip();
- }
- if (thisSpeed > 0 && !fright)
- {
- Flip();
- }
- }
- void Flip()
- {
- fright = !fright;
- transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement