Quantcast
Channel: Questions in topic: "melee"
Viewing all articles
Browse latest Browse all 201

How would i go about implementing a melee system in a 2.5d game

$
0
0
So what i have in this 2.5d game is a simple movement and jump script and i would like to try and implement a melee script that can attack both left and right smoothly and make it so that it does damage but i don't know where to start. This is my script: public Transform playertrn; public Rigidbody playerRB; public int speed; private bool isFalling = false; private bool doubleJump = false; public Vector3 JumpHeight = new Vector3 (0, 8, 0); void Start () { playertrn = GetComponent (); playerRB = GetComponent (); Physics.gravity = new Vector3(0, -11.0F, 0); } void Update () { if (Input.GetKey (KeyCode.D)) { playertrn.Translate (new Vector3(speed, 0, 0) * speed * Time.deltaTime); } if (Input.GetKey (KeyCode.A)) { playertrn.Translate (new Vector3 (-speed, 0, 0) * speed * Time.deltaTime); } if (Input.GetKey (KeyCode.Space) && !isFalling) { playerRB.velocity = JumpHeight; isFalling = true; } } void OnCollisionStay () { isFalling = false; } } would i be able to get some advice on where to start with the melee system please Thanks in advance

Viewing all articles
Browse latest Browse all 201

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>