Issue with working out distance between player position and mouse position.
Guardian
Member Posts: 54
Hi guys,
I am using the following to work out the distance between player position and mouse position.
sqrt((pow(( game.Mouse.Position.X - self.Position.X ), 2))+ (pow(( game.Mouse.Position.Y - self.Position.Y ),2)))
However, I have notice that as the player moves to the other side of the scene (two screen lengths) the resulting distance is also increased when relatively the positions are the same. So I have come to the conclusion that player position is relative to the scene while mouse position is relative to the screen (maybe this an incorrect assumption that needs to be corrected)
Therefore, is there anyway to work out the player position relative to the screen?
Kind regards,
Guardian
I am using the following to work out the distance between player position and mouse position.
sqrt((pow(( game.Mouse.Position.X - self.Position.X ), 2))+ (pow(( game.Mouse.Position.Y - self.Position.Y ),2)))
However, I have notice that as the player moves to the other side of the scene (two screen lengths) the resulting distance is also increased when relatively the positions are the same. So I have come to the conclusion that player position is relative to the scene while mouse position is relative to the screen (maybe this an incorrect assumption that needs to be corrected)
Therefore, is there anyway to work out the player position relative to the screen?
Kind regards,
Guardian
Comments
This tutorial is not done by me, by the way
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks guys
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User