C# script to controll object movement in top down shooter like games.

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

// © 2017 TheFlyingKeyboard
// theflyingkeyboard.net

public class TopDownCharacterMovement : MonoBehaviour {
    private Rigidbody2D myRigidbody;

    [SerializeField] private float moveSpeed;

    // Use this for initialization
    void Start () {
        myRigidbody = GetComponent<Rigidbody2D>();
  // Update is called once per frame
 void FixedUpdate () {
     myRigidbody.addForce(Input.GetAxis("Horizontal") * moveSpeed);
     myRigidbody.addForce(Input.GetAxis("Vertical") * moveSpeed);
Script to make object rotate to mouse cursor
Unity C# 2D Top Down Shooter Movement
Tagged on:         

2 thoughts on “Unity C# 2D Top Down Shooter Movement

  • August 15, 2017 at 10:50 am

    Update this code plz

    • August 19, 2017 at 7:14 pm

      What is wrong with it?


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.