Hey all, kinda new to Greenfoot, but have been programming Java for about a year. I have two classes, Person and Animal, and I'm trying to get Animal to follow Person. I have absolutely no idea how to send the coordinates of Person to the Animal class.
I think I need to make the instance of the Person an Actor, and then just use actor.getX(), but I'm not sure how to make the instance of the Person an Actor. I tried something like...
but I couldn't get that to work, so I'm not entirely sure what to do. I get an incompatible types error when I try that, so I'm not entirely sure what I'm doing wrong. I feel like I have my parameters right for getObjectsInRange, but apparently not. Any help would be appreciated!
1 2 | int range = 600 ; Actor actor = getObjectsInRange(range, Person. class ); |