Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

RileyT33

3
Posts
1
Topics
A member registered Dec 23, 2020

Recent community posts

Okay, so the first solution works, now the only problem is that now it will only do it each time I press A. Is it the if statement, or the code itself?

How would I implement it in my code, it keeps saying that I can't add a Vector3 to a float. This is my new code.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    private Rigidbody2D rb2D;
    private float thrust = 10f;
    // Start is called before the first frame update
    void Start()
    {
        transform.position = new Vector3(0f, 0f, 0f);
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("w"))
        {
          print("Test");
        }
        if (Input.GetKeyDown("a")){
          transform.eulerAngles = new Vector3 (0f, 0f, +10f);
        }
    }
}

So I don't know if I could ask questions about code, but I am trying to make it so my character could rotate. I tried everything I could think of and still couldn't get it too work. If anyone is reading this, do you know what's wrong? 

The Code:

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

public class PlayerMovement : MonoBehaviour
{
    private Rigidbody2D rb2D;
    private float thrust = 10f;
    // Start is called before the first frame update
    void Start()
    {
        transform.position = new Vector3(0f, 0f, 0f);
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("w"))
        {
          print("Test");
        }
        if (Input.GetKeyDown("a")){
          transform.rotation = Quaternion.Lerp(0f, 0f, transform.rotation * 10);
        }
    }
}