Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# top down view player movement script

//Simple top down view player movement ( ̄︶ ̄)↗ 
//src-Brackeys(yt)

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

public class Player : MonoBehaviour
	{
		public float speed = 10f;
		public Rigidbody2D rb;
		Vector2 movement;
        
		void Update() 
	{
    	//Input
    	movement.x = Input.GetAxisRaw("Horizontal");
    	movement.y = Input.GetAxisRaw("Vertical");
	}

void FixedUpdate() 
	{
    	//Movement
    	rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime);
	}

}
Comment

PREVIOUS NEXT
Code Example
Csharp :: top down view movement script 
Csharp :: binding on button c# 
Csharp :: C# order a sorted list by key 
Csharp :: unity apply bloom of a different color 
Csharp :: dynamic add event control c# 
Csharp :: c# remove xml invalid characters 
Csharp :: c sharp system pause equivelent 
Csharp :: how to parse mongo db json in c# 
Csharp :: administration 
Csharp :: guicontrol text ahk 
Csharp :: cant find desktop and documents folder macOs 
Csharp :: remove empty strings from list c# 
Csharp :: c# clear linkList 
Csharp :: Get location in Xamarin - NAYCode.com 
Csharp :: unity for loop array 
Csharp :: Get logged in user in ASP.Net 
Csharp :: Non-Serialized Fields in unity inspector 
Csharp :: c# decimal to fixed 2 
Csharp :: c# get all occurrences of a string 
Csharp :: Save variable unity 
Csharp :: wpf databinding 
Csharp :: how to convert int to string c# 
Csharp :: list to ilist c# 
Csharp :: c# getting response content from post 
Csharp :: c# extension 
Csharp :: c# sort llist 
Csharp :: exception 
Csharp :: concurrent post request c# 
Csharp :: atan2 speed unity 
Csharp :: c# list find null 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =