Posted By
|
Message
|
Dave S.
Registered 26/09/2003
Points 924
|
2nd March, 2007 at 11:50:32 -
All I want to do is... left click with the mouse somewhere on the screen. An active object will then whizz off (more than speed 100) to the exact direction and location of the mouse click co-ordinates then slow down just before it arrives at it's destination... that's it!
Tried using the advanced direction object extension as this seemed the most logical but couldn't get it to do what I wanted it to do. The anoying thing is that I have seen a demo of something like this on the 'click site' somewhere (although there was no deceleration) but can't find it anymore.
n/a
|
blanco
Registered 08/10/2003
Points 66
|
2nd March, 2007 at 13:18:35 -
A simple way:
User clicks
-Set CROSSHAIR to Xmouse, Ymouse
CHARS is not overlapping CROSSHAIR
-Set dir(0,0 CROSSHAIR)
-Set Speed(Distance)
Always
-Set Distance ( Sqr( ( X( "CROSSHAIR" ) - X( "CHARS" ) ) pow 2 + ( Y( "CROSSHAIR" ) - Y( "CHAR" ) ) pow 2 ))
I realize it uses builtin movements (so naturally it will max-out at 100), but it's a quick and simple way.
n/a
|
axel Crazy?
Registered 05/02/2005
Points 4766
|
2nd March, 2007 at 13:21:36 -
It's actually "cheating", but you can get just that effect by using the MoveIt object, with this code:
* Always
- Add Active1 to queue
- Move all objects to (X;Y) over 10 event loops
You can find the MoveIt object for MMF 1.5 on www.clickteam.info/extensions. I'm not sure if it's been ported to MMF2 yet though.
Or, you could do it with trigonometry and stuff. I can't really be bothered to figure it out right now, but I guess you just do a normal 360 deg movement using sin and cos, and then you get the distance between the object's coordinates and the target coordinates (Pythagorean theorem), and when the object's close enough, you start decreasing its speed (which you'd store in an alterable value). Or you could just always set the object's speed to the distance between the object and its target coordinates.
n/a
|
Dave S.
Registered 26/09/2003
Points 924
|
2nd March, 2007 at 13:34:07 -
I was never any good at trigonometry so I was hoping to use an extension. I really need the object to fly across the screen faster than speed 100 so I'll try axels 'MoveIt' suggestion first... cheers.
n/a
|
Dave S.
Registered 26/09/2003
Points 924
|
3rd March, 2007 at 08:56:36 -
I tried the 'MoveIt' extension... it's great. I don't even have to use fastloops for massive speeds, thanks.
n/a
|
Bibin At least 9001
Registered 01/07/2005
Points 308
|
3rd March, 2007 at 18:44:47 -
Yes, there is MoveIt for MMF2.
n/a
|
|
|