Windows Make mouse using object

N

NoCodeMonkey

Guest
I'm making a co-op game and each player will have a mouse object to help them press other objects and upgrade their stats on an upgrade screen. Can someone show me the best way to do movements for the mouse objects and best way to do a mouse click for the mouse objects like a real mouse would? The mouse object would be moved with the Arrow keys (player 1) and ASWD keys (player 2).
 
P

Paolo Mazzon

Guest
Anyway, I'd reccomend having 8 global variables for this:
Code:
global.p1MouseX
global.p1MouseY
global.p1MousePressed
global.p1MousePressedLast
// and for player 2
The mouse coordinates are obvious, and MousePressed is simply weather or not the mouse is currently pressed. MousePressedLast is weather or not the mouse was pressed last frame. This is useful for telling if it is the initial press or release of the button. If it is pressed this frame, but not last frame, then it was just pressed (keyboard_check_pressed), if it was pressed last frame but not now, then it was released.

I wouldn't use objects because once you add objects to the mix, you bring the stuff that comes along with it like depth and mass object management. You can just draw some mouse sprites at their coordinates instead.
 
Top