Bien lo que vamos a intentar hacer es un juego de Android de Policías y ladrones.algo que vamos a intentar terminar y subir a internet para que la gente pueda disfrutar de dicho juego bien. Lo primero que vamos hacer va ser poner el movimiento a nuestro policía
aquí tenemos las flechas para mover nuestro personaje
a nuestro personaje vamos a ir a la derecha y vamos asignarle un Box Collider 2D y un Rigibody2D y un Script, abrimos el visual studio y comenzamos a programar
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MOVIMIENTOPERSONAJE : MonoBehaviour { public float speed; private Rigidbody2D rb; private Vector2 moveVelocity; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update() { Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); moveVelocity = moveInput.normalized * speed; } void FixedUpdate() { rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime); } }
Y ya tendriamos nuestro Script, ahora si nuestro personaje se nos cae hacemos lo siguiente
En Gravity Scale esta a 1 y le pondríamos a 1. Ahora le pondriamos un box colider a cada objeto
genial me encanto