Zooming and launch angles
I'm not sure how the math is supposed to work on this, but I have a game with a full size at 960T x 640W. You can press a button to zoom out then back in, but I want the main actor to be able to still move while zoomed out. When you click the main actor, an arrow points in the direction of the mouse indicating where the actor will go. Sort of like the tiny balls game. But when zoomed out to the full size of the scene, the arrow acts very wrong. I got the code working for the arrow with the large size of the scene by using a camera offset attribute, but when you zoom out, things go wrong again. The position of the arrow itself is fine, it's just not pointing to the mouse position. And the arrow seems to think that the main actor's position is twice the X and Y it's at currently (if it's outside the 480 x 320 area).
This is the code for the arrow.
When mouse clicks actor -
Constrain self.Position.X to ( game.Player1PositionX + game.Mouse.Position.X + game.CameraOffsetX )/2
Constrain self.Position.Y to ( game.Player1PositionY + game.Mouse.Position.Y + game.CameraOffsetY )/2
Constrain self.Rotation to vectorToAngle( game.Player1PositionX - game.CameraOffsetX - game.Mouse.Position.X, game.Player1PositionY - game.CameraOffsetY - game.Mouse.Position.Y )
Constrain self.Width to magnitude( game.Player1PositionX - game.CameraOffsetX- game.Mouse.Position.X , game.Player1PositionY - game.CameraOffsetY - game.Mouse.Position.Y)
Any ideas on where this is going wrong?
This is the code for the arrow.
When mouse clicks actor -
Constrain self.Position.X to ( game.Player1PositionX + game.Mouse.Position.X + game.CameraOffsetX )/2
Constrain self.Position.Y to ( game.Player1PositionY + game.Mouse.Position.Y + game.CameraOffsetY )/2
Constrain self.Rotation to vectorToAngle( game.Player1PositionX - game.CameraOffsetX - game.Mouse.Position.X, game.Player1PositionY - game.CameraOffsetY - game.Mouse.Position.Y )
Constrain self.Width to magnitude( game.Player1PositionX - game.CameraOffsetX- game.Mouse.Position.X , game.Player1PositionY - game.CameraOffsetY - game.Mouse.Position.Y)
Any ideas on where this is going wrong?
Comments
If I can't figure it out, I'll just have to make do with constraining the game size to 480 X 320.