using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public float movespeed 10f;
public Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = getComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
}
}
well i did it and now
Assets\movement.cs(17,14): error CS0103: The name ‘getComponent’ does not exist in the current context
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public float movespeed = 10f;
public Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = getComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
}
}
Assets\movement.cs(25,63): error CS1003: Syntax error, ‘,’ expected new code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public float movespeed = 10f;
public Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb =GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
//"a" = "-1"
//"d" = "1"
Vector3 movement = new Vector3(input.GetAxis("horizontal") 0f 0f );
transform.position += movement * Time.deltaTime * movespeed;
}
}
Assets\movement.cs(25,35): error CS0103: The name ‘input’ does not exist in the current context
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public float movespeed = 10f;
public Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb =GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
//"a" = "-1"
//"d" = "1"
Vector3 movement = new Vector3(input.GetAxis("horizontal"), 0f, 0f );
transform.position += movement * Time.deltaTime * movespeed;
}
}