Mouse position with camera centered in wide screens
Hunnenkoenig
Member Posts: 1,173
My game is in Portrait mode, but one of my levels need to be about 500 wide to have space for actors coming into the scene.
I have an actor, which should follow the mouse coursor and it does in other levels, but in this particular level it is strange.
My camera and tracking area and game and everything is set to 320, only my "scene - size" is set to 520 wide and the "scene - camera - origin - X" is set to 100 to push the game area to the center (I hope, that is the right method...I didn't find another solution).
Now my actor follows the mouse, but it is always on the left side. My mouse is always on the right of the actor and it seems, it is exactly that 100.
What can I do to get the actor's center to the mouse coursor?
I have an actor, which should follow the mouse coursor and it does in other levels, but in this particular level it is strange.
My camera and tracking area and game and everything is set to 320, only my "scene - size" is set to 520 wide and the "scene - camera - origin - X" is set to 100 to push the game area to the center (I hope, that is the right method...I didn't find another solution).
Now my actor follows the mouse, but it is always on the left side. My mouse is always on the right of the actor and it seems, it is exactly that 100.
What can I do to get the actor's center to the mouse coursor?
Comments
If you camera doesn't move, simply add 100.
so, in the actor:
Constrain Attribute
self.Position.X = (game.Mouse.X + 100)
I tried something like that, but It didn't do the trick first.
My positionX is calculated so:
Constrain Attribute
self.Position.X to max(min(game.Mouse.Position.X,366),151)
That prevented my actor to go outside of the screen.
Now that my camera is moved to the right by 100, I had to change this so:
self.Position.X to max(min((game.Mouse.Position.X+100),366),151)
Now it's working.