You can see the code below that shows how an object can access (read and write) another object.
You just need to add a class attribute of the type Bird in all the enemies and every class that needs to access it. In the constructor you add a parameter of that type, and when you create an enemy object you pass as last argument a reference to the Bird object. Then you can simply read from or write to that variable. You don't need to pass it to the enemy class internal methods because it is a class global variable, visible in all the class. The attributes of the Bird that need to be accessed have to be public or as a property (or the way that C++ implements for a variable to be accessed outside its class). Remember that in C++ the syntax for references and pointers is a bit complicated, it's not as in C#, so the code I write here is not C++, but the idea is OK. You should just change the syntax
You also can see this mechanism in this game, my smallest one (it's written in C#, but the concept is the same)
https://www.dropbox.com/s/qf5rpk4zlid8l6d/PAC-MAN%20Folder.rar?dl=0
class Enemy
{
private Bird player;
private int x, y;
// other vars
public Enemy(int x, int y, Bird player)
{
this.x = x;
this.y = y;
this.player = player;
// other vars
}
public void Draw() // or Update()
{
if (this.y < player.y) // read from the player's reference (or address)
; // the bird is under the enemy
if (Collision()) // define Collision()
player.life = 0; // write to the player through its address (then the Bird should know that to do)
if (IsHitByBird()) // define IsHitByBird()
this.life = 0; // you killed the enemy
// do other stuff ( like move )
}
}
Please let me know if it works