The Daily Click ::. Forums ::. Klik Coding Help ::. Mouse Positioning
 

Post Reply  Post Oekaki 
 

Posted By Message

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
29th January, 2007 at 19:12:46 -

I'm trying to find the best way to make the mouse move to the center of a particular active object on start of frame.

My frame size is 640x480 and the full screen resolution is 1024x768, because I don't want to have to set players' screens to a resolution of 640x480... if their computer even can :\ The object (that the mouse cursor should go to the center of) is placed at different places in each frame so a formula of some sort would be best...

I've tried the mouse object etc. but it doesn't let you set the position in comparison to the objects' location... I'm sure there's an easy calculation to solve this but my mind has just gone blank!! I think I need sleep

Anyway, any ideas? Thanks guys

 
http://www.SilverNova.co.uk


axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
30th January, 2007 at 10:12:09 -

You can use the Window Control object to get the X and Y position of the game window, and then just add the object's X or Y position to that:

(Event)
- Mouse object: Set actual mouse X to (Window X position( "Window Control" ) + X( "Active" ))
- Mouse object: Set actual mouse Y to (Window Y position( "Window Control" ) + Y( "Active" ))

 
n/a

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
30th January, 2007 at 10:19:03 -

It should be noted that when using Axel's method, you'll also have to remove the window border of your game, because Window X position( "Window Control" ) is the X position of the window, not your the X of the game screen. If your game is in full screen, it won't be much of a problem then.

 
This space is for rent

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
30th January, 2007 at 11:29:41 -

I knew there was an easy calculation Legends, thanks!

 
http://www.SilverNova.co.uk


Werbad



Registered
  18/09/2002
Points
  235
30th January, 2007 at 12:37:41 -

There is no need for the window control object...
MouseX( "Mouse object" ) - XMouse will retrieve the X coordinate of the Client Area.

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
30th January, 2007 at 14:02:05 -

XMouse is just the position of the mouse though, not where an object's center is in its distance from the game window edge, which was basically what I wanted. It's sorted now anyways

 
http://www.SilverNova.co.uk

   

Post Reply



 



Advertisement

Worth A Click