C
C#2mo ago
Izsák

hello everyone im trying to make a 2d topdown game in unity and the script i wrote isn't working

if you can help pls help i really want to make this game
37 Replies
Izsák
IzsákOP2mo ago
I can send the code I wrote if that helps
Nasdack
Nasdack2mo ago
how else would we help you without looking at the code
Izsák
IzsákOP2mo ago
ok ima send the code now
Izsák
IzsákOP2mo ago
Game Dev with JacquelynneHei
YouTube
4. How to make a 2D RPG in Unity - Character Movement - Code
In this video, we will use the logic from the previous video to code the character movement. We will be creating the movement component, getting input from the keyboard, and using physics to move our character in the world. Support me on Patreon: https://www.patreon.com/jacquelynneHei Follow me on Twitter: https://twitter.com/JacquelynneHei2 Jo...
Izsák
IzsákOP2mo ago
this is the video i used and ima send the code in a sec
Izsák
IzsákOP2mo ago
Izsák
IzsákOP2mo ago
this is the code if you could modify it so its good i would be very thankful
ero
ero2mo ago
Dude you're not even explaining what isn't working
Archion
Archion2mo ago
what is even AD and WS?
Izsák
IzsákOP2mo ago
movement
ero
ero2mo ago
What about it
Izsák
IzsákOP2mo ago
the keys i want the character to move with
Archion
Archion2mo ago
AD and WS should be in comment probably?
Izsák
IzsákOP2mo ago
idk what that means im pretty new to coding
ero
ero2mo ago
What about them
cathei
cathei2mo ago
Learn C# first
Archion
Archion2mo ago
👍
Izsák
IzsákOP2mo ago
how where
cathei
cathei2mo ago
Before following Unity tutorial $helloworld
Archion
Archion2mo ago
microsoft
Izsák
IzsákOP2mo ago
ok
Archion
Archion2mo ago
or be an old man like me and play with w3school
using UnityEngine;

public class TopDownPlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f;

private Vector2 moveInput;
private Vector2 movement;

void Update()
{
moveInput.x = Input.GetAxisRaw("Horizontal");
moveInput.y = Input.GetAxisRaw("Vertical");
if (moveInput.magnitude > 1)
{
moveInput.Normalize();
}

movement = moveInput * moveSpeed;

transform.Translate(movement * Time.deltaTime, Space.World);
}
}
using UnityEngine;

public class TopDownPlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f;

private Vector2 moveInput;
private Vector2 movement;

void Update()
{
moveInput.x = Input.GetAxisRaw("Horizontal");
moveInput.y = Input.GetAxisRaw("Vertical");
if (moveInput.magnitude > 1)
{
moveInput.Normalize();
}

movement = moveInput * moveSpeed;

transform.Translate(movement * Time.deltaTime, Space.World);
}
}
also duh this probably better
Izsák
IzsákOP2mo ago
what do i put here?
No description
Archion
Archion2mo ago
just learn c# firstttttt and i may help
Izsák
IzsákOP2mo ago
can u atleast send me a video about c# that i can learn
ero
ero2mo ago
It literally says there are videos here...
Izsák
IzsákOP2mo ago
oh ok thx i did the training now can u please help
ero
ero2mo ago
Surely you watched multiple hours worth of courses in less than an hour :Clueless:
Izsák
IzsákOP2mo ago
MULTIPLE HOURS?? JUST pls help me i really need this script
ero
ero2mo ago
You have not explained what's wrong with it
Izsák
IzsákOP2mo ago
so basically i need a movement script and i wrote the thing but when i press the wasd keys it does nothing
Izsák
IzsákOP2mo ago
Izsák
IzsákOP2mo ago
so?? ??? pls respond
FusedQyou
FusedQyou2mo ago
Debug the value of movement and movement * Time.deltaTime There's about a million things that could be wrong so I suggest you gather information about the issue, starting with this
Anton
Anton2mo ago
@Izsák Currently this seems to be above your skill level. Start with something simpler, learn to solve problems first.
Nasdack
Nasdack2mo ago
There's no taking shortcuts in programming If you are not able to understand the code you are copying from a tutorial, you need to take things down a notch and start with the basics

Did you find this page helpful?