I hoped to make an actor communicate to another actor using the getOneIntersectingObject method.
For example, if 'projectile' collides with a 'ship' then it will 'inflict(damage);' on the ship based on the projectiles value for damage.
What I've gone with is as follows:
(This is in the class 'thing', it's my main parent class)
So then presumably I could tell projectile (which extends thing)
But the problem is that in the 'hit' method, it complains that getOneIntersectingObject applies to Actor.
If I change it from 'thing' to 'Actor' then when I try to use 'inflict' it says it cannot find the 'inflict' method.
Any ideas?
public thing hitThing; public boolean hit(Class clss) { hitThing = getOneIntersectingObject(clss); return hitThing != null; }
if (hit(ship.class)) { hitThing.inflict(damage); //damage being a pre-defined variable getWorld.removeObject(this); }