Need help to move player

Hi i have tried many codings and can’t seem to move my player in a 2 up and down game!
Here is my code script for moving

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

public class PlayerMovement : MonoBehaviour
{

public float moveSpeed = 5f;

public Rigidbody2D rb;

Vector2 moveDirection;

void Update()
{
ProcessInputs();
}

void FixedUpdae()
{
Move();
}

void ProcessInputs()
{
float moveX = Input.GetAxisRaw(“Horizontal”);
float moveY = Input.GetAxisRaw(“Vertical”);

moveDirection = new Vector2(moveX, moveY);
}

void Move()
{
rb.velocity = new Vector2(moveDirection.x * moveSpeed, moveDirection.y * moveSpeed);
}

}

Im using Visual studio 2017

Please use code tags: Using code tags properly

Recommend you put Debug.Log() calls into the code to determine if any of it is running.

Also, print the value of moveSpeed because it may be serialized as 0 in the scene, which would override your 5f initializer.

1 Like

Hi, and thanks for replying I’m really new to this so i don’t know what u mean by print the value of movespeed
and i with the Debug.log() where should i put that, does that matter ? Thanks again for replying

i also got these 3 Error´s

Assets/PlayerMovement.cs(38,16): error CS1519: Invalid token ‘;’ in class, struct, or interface member declaration

Assets/PlayerMovement.cs(38,15): error CS8124: Tuple must contain at least two elements.

Assets/PlayerMovement.cs(38,14): error CS1519: Invalid token ‘(’ in class, struct, or interface member declaration

and know only this

Assets/PlayerMovement.cs(40,1): error CS1519: Invalid token ‘}’ in class, struct, or interface member declaration

I can see that you use a mix of FixedUpdate and Update I would recommend to use Update for the Inputs and LateUpdate to move if you want them to be in two seperate functions. Sadly I can not help you with your errors because you did not post the script. If you don’t mind doing that I maybe able to help you