The Daily Click ::. Forums ::. Klik Coding Help ::. Mouse centered scrolling
 

Post Reply  Post Oekaki 
 

Posted By Message

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th February, 2006 at 06:04:37 -

Does anyone know how to scrolling where the mouse is in the center of the screen and the screen moves along with the mouse movements?

Seems like it should be easy but it isn't mainly because the mouse scrolls along with the screen. Because of this, each time the screen is centered on the mouse, the mouse moves as well and then the screen never stops scrolling.

I've also tried alwas centering the mouse to the screen every time but for some reason, the Y axis movement is messed up.... To try this method, you'll need an extension to retrieve the resolution of the user's screen and the mouse object.

Anyways, any info would be helpful

thanks

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
12th February, 2006 at 07:05:52 -

I know I've done it, but I don't really remember how. Actives with mouse movement should work, though.

 
n/a

Teapot

Does he even go here

Registered
  02/10/2003
Points
  2631

VIP Member
12th February, 2006 at 07:15:38 -

I just tried it, you've obviously been thinking too complicatedly. An active with mouse movement and a 'always-centre window on active object' does the trick nicely.

 
n/a

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th February, 2006 at 21:57:10 -

But if I use the mouse movement, any condition with "user click" in it won't register...

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
12th February, 2006 at 22:31:28 -

You'll just have to replace each "user clicks" with "Fire key 1 pressed".

 
n/a

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th February, 2006 at 22:33:48 -

> You'll just have to replace each "user clicks" with "Fire key 1 pressed".

I was hoping for a more elegant interface...

Anyone else have any ideas? I'm gonna look for extensions that read mouse clicks.

 
n/a

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
13th February, 2006 at 02:18:16 -

Nevermind, I figured it out. As a freebie for everyone else:

You'll need
- mouse object
- any object that lets you retrieve the screen resolution, or an object that can change the resolution

It's only one line:
Always
- set actual mouse to Xres of screen/2
- set actual mouse to Yres of screen/2
- center X screen to X of mouse
- center Y screen to Y of mouse + 24

Thats it! I have no idea where + 24 came from .... seems like a number mmf pulled out of its ass. Anyways, hope this helps other people who are trying to get this effect in the future. BTW, if there's a problem or limitation of this method, let me know.

 
n/a

Kalle T



Registered
  18/09/2004
Points
  362
14th February, 2006 at 18:53:27 -

this works in TGF so MMF should work to!

with a custom made mouse cursor like, example: a sword
I just turn off "follow playfield" for this active object
and put cursor in top left game field, cursor should have same moving size as screen in game like 800x600 now it will always follow the screen not moving anywhere.



Image Edited by the Author.

 
Image
Image
Image
   

Post Reply



 



Advertisement

Worth A Click