Posted By
|
Message
|
markno2
Registered 06/06/2006
Points 865
|
11th August, 2010 at 11:05:03 -
Heya peepz.
Have a look at the "Legend of Nawak" game in the arcade, and you can see the the little orange pointer follows the mouse, even when the mouse is outside the playing area. How can I replicate this? Preferably without any extensions, as I'd like to use flash.
Thank ahead.
Discarded pizza boxes are an indispensable source of cheese.
|
nim
Registered 17/05/2002
Points 7234
|
11th August, 2010 at 14:49:35 -
It looks like Legend of Nawak sets the pointer X and Y to the mouse pointer's X and Y, with a few conditions after that to set the pointer's X or Y to the window edge if it goes outside.
Try this.The order of events is important, below:
1. Always | Set X("Active") to XMouse, Set Y("Active") to YMouse
2. X("Active") > 640 | Set X("Active") to 640
3. X("Active") < 0 | Set X("Active") to 0
4. Y("Active") > 480 | Set Y("Active") to 480
5. Y("Active") < 0 | Set Y("Active") to 0
//
|
markno2
Registered 06/06/2006
Points 865
|
11th August, 2010 at 15:27:47 -
Hehe, that works. Thanks.
Discarded pizza boxes are an indispensable source of cheese.
|
Rob Westbrook
Registered 25/05/2007
Points 193
|
16th August, 2010 at 16:03:48 -
You can do this slightly neater in one event with by always setting the X of the active to:
max(X left frame,min(Xmouse,X right frame)) and the y to max(Y top frame,min(YMouse,Y bottom frame))
This means that it'll stay in the bounds of the visible screen area even with large scrollable levels
There are 10 types of people in the world: Those who understand binary and those who don't.
|
nim
Registered 17/05/2002
Points 7234
|
18th August, 2010 at 04:34:21 -
That's a great solution! Thanks very much for that Rob
//
|
|
|