Tell me how can I use this code to train a Ml Agent of the bird.
this is my FlappyBird.cs file->
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class FlappyBird : MonoBehaviour
{
public float speed;
Rigidbody2D rb;
public Score scoreText;
void Start()
{
rb=GetComponent<Rigidbody2D>();
}
void Update()
{
if(Input.GetMouseButtonDown(0)){
//flap
rb.velocity=Vector2.up *speed;
}
}
private void OnTriggerEnter2D(Collider2D other) {
if(other.CompareTag("Column")){
print("ScoreUp");
scoreText.ScoreUp();
}
}
private void OnCollisionEnter2D(Collision2D other) {
if(other.gameObject.CompareTag("Ground")|| other.gameObject.CompareTag("Pipe")){
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
}
I have added mlagent to my project but i can’t get the idea of how can i use him in this senario.
New contributor
Lihaj Wickramasinghe is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.