Hey
I’m new to Unity and need to get a game done ASAP so I haven’t much time to learn about C# properly. But I want to make the player move up as long as they are in contact with a specific game object.
I know enough about Unity to program the collision detection and stuff. I just need to know how to get the player to move upwards.
public class PlayerMagnet : MonoBehaviour {
private bool isGrounded = Player_Move.isGrounded;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Magnet")
{
isGrounded = false;
}
}
}