Centering camera on mousepointer doesn't work for me.

Well, centering the camera on the mouse pointer does work but it doesn’t work with this event, which I can’t understand why.
Can someone pretty please tell me what’s wrong with this? Probably something obvious like always :stuck_out_tongue:

The variable “aim” can never have the value of 1 because in the sub events of “x key is pressed” you first check if the value is 0 if so it gets set to 1. In the second sub event you set it to 0 again.

Hi. Thanks for responding. I’m not sure I quite follow what’s happening. The variable “aim” starts out as 0 which is the camera centered on the player, when left shift key (changed it in the new event) is pressed, the aim variable is set to 1 and the camera is centered on the cursor instead of the player. How am I doing it wrong here?

The issue is still the same, “aim” will always be “0” and the camera will always be centered on the player.

Lets assume the value of “aim” is “0” when you reach the first event and the shift key is pressed.

The first event checks if the value is “0”, this is the case so “aim” get set to “1”.
In the second event it checks if the value is “1”. Since this is true the value gets set to “0” again and the camera is centered on the cursor.
Now comes event 3. Since “aim” is “0” the camera immediately centers on the player again. (So quickly that you won’t notice)

What is the goal you try to achieve?

If you want to center the camera permanently on the player and only move it to the cursor while shift is currently held down:

Event1: LShift key is pressed            ->  Center camera on cursor
Event2: LShift key is pressed (inverted) ->  Center camera on player

If you want to have a toggle (hit shift once to move the camera to the cursor, hit it again to move it back to the player):
If you don’t use 0 and 1 as values but -1 and 1 instead it would be as simple as the following

Event1: LShift key is pressed        ->    do *-1 to global variable aim
Event1: Once

Event2: global variable aim is -1    ->    center camera on player
Event3: global variable aim is  1    ->    center camera on cursor

That toggle solution is brilliant… I actually had a similar question I wanted to ask… Thank you…