C
C#7d 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ákOP7d ago
I can send the code I wrote if that helps
Nasdack
Nasdack7d ago
how else would we help you without looking at the code
Izsák
IzsákOP7d ago
ok ima send the code now
Izsák
IzsákOP7d 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ákOP7d ago
this is the video i used and ima send the code in a sec
Izsák
IzsákOP7d ago
this is the code if you could modify it so its good i would be very thankful
ero
ero7d ago
Dude you're not even explaining what isn't working
Archion
Archion7d ago
what is even AD and WS?
Izsák
IzsákOP7d ago
movement
ero
ero7d ago
What about it
Izsák
IzsákOP7d ago
the keys i want the character to move with
Archion
Archion7d ago
AD and WS should be in comment probably?
Izsák
IzsákOP7d ago
idk what that means im pretty new to coding
ero
ero7d ago
What about them
cathei
cathei7d ago
Learn C# first
Archion
Archion7d ago
👍
Izsák
IzsákOP7d ago
how where
cathei
cathei7d ago
Before following Unity tutorial $helloworld
Archion
Archion7d ago
microsoft
Izsák
IzsákOP7d ago
ok
Archion
Archion7d 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ákOP7d ago
what do i put here?
No description
Archion
Archion7d ago
just learn c# firstttttt and i may help
Izsák
IzsákOP7d ago
can u atleast send me a video about c# that i can learn
ero
ero7d ago
It literally says there are videos here...
Izsák
IzsákOP7d ago
oh ok thx i did the training now can u please help
ero
ero7d ago
Surely you watched multiple hours worth of courses in less than an hour :Clueless:
Izsák
IzsákOP7d ago
MULTIPLE HOURS?? JUST pls help me i really need this script
ero
ero7d ago
You have not explained what's wrong with it
Izsák
IzsákOP7d 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ákOP7d ago
so?? ??? pls respond
FusedQyou
FusedQyou7d 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
Anton7d ago
@Izsák Currently this seems to be above your skill level. Start with something simpler, learn to solve problems first.
Nasdack
Nasdack7d 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
Want results from more Discord servers?
Add your server