Skip to main content
Known Participant
February 17, 2011
Question

game question

  • February 17, 2011
  • 1 reply
  • 404 views

I have an interesting question.  I'm trying to make a game and I have the game class and then I have a class called Turret, where the turret fires missiles up towards the flying player spaceship. I call turret.updateTurret();  from the game class and that calls the updateTurret function in the Turret class. I put the player ship x and y coordinates in as the arguments for the parameters in the function so the turret will know where to aim the missiles. But I've found that those numbers are in reference to the stage in the game class and when they are in the Turret class they are in reference to the Turret class. There is scrolling going on in the game so the turret doesn't stay in one place it goes along with the background in a background container. Anyway I don't know how to get the right numbers to put in for the parameters for the updateTurret function in the Turret class so it will aim properly at the player ship flying around. Anyone know what I need to do?

This topic has been closed for replies.

1 reply

Inspiring
February 17, 2011
Known Participant
February 17, 2011

Thanks, I just also figured if I want more than one turret I'm going to need to aim them seperately so I can do that in the game class, so I guess I don't need anymore help with this question thanks