Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

doom player script

Discussion in 'Scripting' started by ZekHold, Sep 25, 2020.

  1. ZekHold

    ZekHold

    Joined:
    Jun 28, 2019
    Posts:
    4
    Code (CSharp):
    1. using System.Collections;
    2. using System.Security.Cryptography;
    3. using UnityEngine;
    4.  
    5.  
    6. public class numb : MonoBehaviour
    7. {
    8.     private float kende = 114;
    9.     public Rigidbody jkloce;
    10.     public bool charge;
    11.  
    12.     void fixedUpdate()
    13.     {
    14.         if (charge) { jkloce.velocity = new Vector3 (7,kende,7); }
    15.     }
    16.     // Start is called before the first frame update
    17.     void Start()
    18.     {
    19.         jkloce = GetComponent<Rigidbody>();
    20.     }
    21.  
    22.  
    23.     // Update is called once per frame
    24.     void Update()
    25.     {
    26.         float mood = Input.GetAxis("Vertical") * kende;
    27.         float doom = Input.GetAxis("Horizontal") * kende;
    28.  
    29.         doom *= Time.deltaTime;
    30.         mood *= Time.deltaTime;
    31.  
    32.         charge = Input.GetButtonDown("Jump");
    33.  
    34.         transform.Translate(0, 0, mood);
    35.         transform.Rotate (doom,0,0);
    36.     }
    37. }
    I have compiled a simple doom-like player script maybe free somewhere down the thought pipeline, needs jump. Whatever maybe some experienced coders would come up with a free one with foreshadow thought. heres to the future, better luck next time.

    on a happy note ive managed to copy writ the watch dogs symbol trying to make a man symbol for man kind.
     
  2. ZekHold

    ZekHold

    Joined:
    Jun 28, 2019
    Posts:
    4
  3. ZekHold

    ZekHold

    Joined:
    Jun 28, 2019
    Posts:
    4
    using System.Collections;
    using System.Collections.Specialized;
    using System.Security.Cryptography;
    using UnityEngine;
    public class numb : MonoBehaviour
    {
    float kende = 114.411f;
    Rigidbody jkloce;
    // Start is called before the first frame update
    void Start()
    {
    jkloce = gameObject.AddComponent<Rigidbody>();
    }
    void Awake()
    {
    }
    // Update is called once per frame
    void Update()
    {
    float mood = Input.GetAxis("Vertical") * kende;
    bool charge;
    float doom = Input.GetAxis("Horizontal") * kende;
    doom *= Time.deltaTime;
    mood *= Time.deltaTime;
    charge = Input.GetButtonDown("Jump");
    if (charge) { jkloce.velocity = new Vector3(0, kende, 0); } else jkloce.velocity = new Vector3(0, 0, 0);
    transform.Translate(0, 0, mood);
    transform.Rotate (0,doom, 0);
    }
    void fixedUpdate()
    {
    }
    }
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,447
    This tutorial should help you...