n305
n305
CC#
Created by n305 on 2/2/2023 in #help
✅ materialDesign:Card
46 replies
CC#
Created by n305 on 2/2/2023 in #help
✅ Having trouble adding a picture to my code.
37 replies
CC#
Created by n305 on 9/25/2022 in #help
what is wrong with this code?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UkkelinLiike : MonoBehaviour
{

public float moveSpeed;

public Rigidbody2D rb;

private Vector2 moveDirection;

// Update is called once per frame
void Update()
{
ProcessInputs();
}
void FixedUpdate()
{
Move();
}

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

moveDirection = new Vector2(moveX, moveY).normalized;
}

void Move()
{
rb.velocity = new Vector2(moveDirection.x * moveSpeed, moveDirection.y * moveSpeed);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UkkelinLiike : MonoBehaviour
{

public float moveSpeed;

public Rigidbody2D rb;

private Vector2 moveDirection;

// Update is called once per frame
void Update()
{
ProcessInputs();
}
void FixedUpdate()
{
Move();
}

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

moveDirection = new Vector2(moveX, moveY).normalized;
}

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