Movement 2d unity
C#
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public float jumpHeight;
void Start()
{
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
}
if (Input.GetKey(KeyCode.D))
{
GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed, 0);
}
if (Input.GetKey(KeyCode.A))
{
GetComponent<Rigidbody2D>().velocity = new Vector2(-moveSpeed, 0);
}
}
}
Also in C#:
- Title
- random bool c#
- Category
- C#
- Title
- C# how to get public key for InternalsVisibleTo
- Category
- C#
- Title
- c# round number up
- Category
- C#
- Title
- disable a component unity
- Category
- C#
- Title
- c# replace string case insensitive
- Category
- C#
- Title
- automapper c# initialize error
- Category
- C#
- Title
- get all child gameObject of gameObject C#
- Category
- C#
- Title
- get enum value c#
- Category
- C#
- Title
- xml node update attribute value c#
- Category
- C#
- Title
- condition when a animation finishes in unity
- Category
- C#
- Title
- c# how to initialize an array
- Category
- C#
- Title
- eager loading c#
- Category
- C#
- Title
- set width of rect transform unity
- Category
- C#
- Title
- c# region tag
- Category
- C#
- Title
- internal c#
- Category
- C#
- Title
- get web config key value in c# razor view
- Category
- C#
- Title
- array copy c#
- Category
- C#
- Title
- linq c# where condition
- Category
- C#
- Title
- f string C#
- Category
- C#
- Title
- c# uppercase string
- Category
- C#
- Title
- How can you learn C# on your own
- Category
- C#
- Title
- unity getcomponent
- Category
- C#
- Title
- convert system.byte a string c#
- Category
- C#
- Title
- Unity3d GPS code
- Category
- C#
- Title
- c# remove time in datetime
- Category
- C#
- Title
- what is the namespace for textmesh pro
- Category
- C#
- Title
- countdownevent
- Category
- C#
- Title
- c# read all text from a file
- Category
- C#
- Title
- find gameobject with tag
- Category
- C#
- Title
- datatable return column names
- Category
- C#
- Title
- get out of foreach statement c#
- Category
- C#
- Title
- c# creating a data recovery software
- Category
- C#
- Title
- c# creating exceptions
- Category
- C#
- Title
- perlin noise unity
- Category
- C#
- Title
- convert base64 string to string c#
- Category
- C#
- Title
- take screenshot in c#
- Category
- C#
- Title
- c# list all files in a directory and subdirectory
- Category
- C#
- Title
- c sharp split by newline
- Category
- C#
- Title
- c# read char
- Category
- C#
- Title
- unity coroutine
- Category
- C#
- Title
- open file in explorer c#
- Category
- C#
- Title
- c# get desktop path
- Category
- C#
- Title
- xamarin hide back button
- Category
- C#
- Title
- how to disable a gameObject unity c#
- Category
- C#
- Title
- unity particle system color
- Category
- C#
- Title
- uncaught syntaxerror invalid or unexpected token unity webgl
- Category
- C#
- Title
- linq c# or
- Category
- C#
- Title
- c# replace foreach with lambda
- Category
- C#
- Title
- unity simple fps controller
- Category
- C#
- Title
- C# .NET Core linq Distinct
- Category
- C#
- Title
- c# check if string is in array
- Category
- C#
- Title
- zip file ignoring directory starting with dot
- Category
- C#
- Title
- using serial port in c#
- Category
- C#
- Title
- how to insert <input> datatype <td> in asp.net core table
- Category
- C#
- Title
- visual c#
- Category
- C#
- Title
- POST http://localhost:5001/api/v1/identity/login 500 (Internal Server Error) LoginForm.jsx:39 Error: Request failed with status code 500 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.handleLoad (xhr.js:61)
- Category
- C#
- Title
- convert int to double c#
- Category
- C#
- Title
- c# string to float
- Category
- C#
- Title
- c# inline initialize dictionary
- Category
- C#
- Title
- windows form rounded corners
- Category
- C#
- Title
- what is a return statement C#
- Category
- C#
- Title
- c# join array
- Category
- C#
- Title
- split string
- Category
- C#
- Title
- c# main method
- Category
- C#
- Title
- c# how to open file explorer
- Category
- C#
- Title
- how to spawn coins randomly around the screen unity 2d
- Category
- C#
- Title
- mouseposition unity
- Category
- C#
- Title
- transform object according to its parent unity
- Category
- C#
- Title
- unity try get component
- Category
- C#
- Title
- if entity.is Transient() Update Mvc 5 c#
- Category
- C#
- Title
- lista generica como parametro de un metodo en c#
- Category
- C#
- Title
- c# cheat sheet
- Category
- C#
- Title
- polling data source c# using threads
- Category
- C#
- Title
- jumping with character controller unity
- Category
- C#
- Title
- dto and automapper
- Category
- C#
- Title
- c# get enum in list
- Category
- C#
- Title
- add new page to site c# programmatically
- Category
- C#
- Title
- c# filesystemwatcher double events
- Category
- C#
- Title
- how does Pow work C#
- Category
- C#
- Title
- c# reverse array
- Category
- C#
- Title
- c# resize bitmap
- Category
- C#
- Title
- c# using get set methods
- Category
- C#
- Title
- fahrenheit to celsius c#
- Category
- C#
- Title
- c# filter non alphanumeric characters
- Category
- C#
- Title
- c sharp exit while loop
- Category
- C#
- Title
- bool toggle unity c#
- Category
- C#
- Title
- unity gameobject.find
- Category
- C#
- Title
- convert string to datetime c#
- Category
- C#
- Title
- c# reverse string
- Category
- C#
- Title
- c# find element in list of list
- Category
- C#
- Title
- unity find gameobject with layer
- Category
- C#
- Title
- c# mixed multidimensional array
- Category
- C#
- Title
- get first and last item list c#
- Category
- C#
- Title
- c# random number between 0 and 1
- Category
- C#
- Title
- C# function return datareader
- Category
- C#
- Title
- unity making homing missile
- Category
- C#
- Title
- c# get all class properties
- Category
- C#
- Title
- how to make a game
- Category
- C#
- Title
- parsing object from text file c#
- Category
- C#
- Title
- c# arraylist contains
- Category
- C#