Okay, so I am working on a tank game and I want my turret (a different class) to follow my tank. I would like to have my Turret class follow my Tank class with something like a getX() and getY() and getRotation() kind of thing. Right now I just apply the same "if key is pressed" function with both classes, but they sometimes get out of sync. Here's my sample code: http://www.greenfoot.org/scenarios/9727. I would appreciate any help. I can bypass this and have the tank and turret be fixed to each other -- but I would kind of like to move my tank around and rotate the turret separately. And now that I think of it, I'll need to do the getX(), get(Y), and getRotation() to launch a bullet as well. Maybe this is beyond my skills at this point? LOL
I'm teaching a brand new programming class at our high school and I'm wanting it to be JAVA -- so I am doing my best to stay a week or two ahead of the students at this point. I can use ANY and all help. :)
Thanks everybody!