Hi there
How can I access a variable of an Object from an Actor if several of these Objects exist and they are'nt named. Is that even possible without a name?
When a MiniDot is hit by a bullet, I need to check whether the bullet is from the enemy team or not, so I have to check the "team" variable from the bullet that hit the minidot in the MiniDot class.
Here's my code:
in the MiniDot class:
so I'm trying to pass the found bullet to the World where it should have access to the Bullet class.
in the Battlefield(that's my world) class:
Of course there's a method called getTeam() in the Bullet class but it says it can't find the getTeam method.
Can anyone help me to understand why?
Battlefield welt = (Battlefield) getWorld();
if(isTouching(Bullet.class))
{
Actor bullet = getOneIntersectingObject(Bullet.class);
boolean bt = welt.getBulletTeam(bullet);
if(bt != team) beHit();
getWorld().removeObject(bullet);
}public boolean getBulletTeam(Actor bullet){return bullet.getTeam();}
