-
Object trails
I am doing a revision of a game with a mouse-controlled object, and one thing I am revising is the graphics. I want the graphics to be smoother with better special effects. I would like the mouse-controlled object to leave a quick, temporary trail of color behind it when it moves. I would also want the trail to increase in translucency from the object to the end of the trail. How can this be done?
-
Re: Object trails
maybe create some active objects as trails and increase the transparency a few times each second until the object becomes invisible. Then destroy the object once it in transparent.
This will of course depend on the number of objects which you want the trail effect to apply to because too many actives at once can slow the program down or eat a lot of memory
-
Re: Object trails
Well I am looking to make the trail basically a blur of color. If I used that method, the game would have to be rapidly creating new objects, many per second, which would undoubtedly cause a major slowdown. Thanks for your help though. I'm sure there must be a feasible way to do this, as I think MMF does have the potential. Does anyone have any other suggestions?
-
Re: Object trails
The easiest way to do this is to create an Active Object and set its Fade-out transition to Fade (set fade speed to 0.22 seconds). Then have an event to always create this AO at 0,0 from the mouse object. Then destroy the object in the same event.
This method will generate about 13 extra objects and shouldn't give you any slowdown.
-
Re: Object trails
This method does work kind of well, except there are gaps between the clones of the active object causing it to look more like the Windows mouse trail feature rather than a blur of color as I had hoped for.
I mean instead of looking like:
(((((((x)
it looks more like:
(x)(x)(x(x(((x)
Are there no options left? I noticed you said "easiest way." I don't really care if I have to do something complicated, as long as it looks good.
-
Re: Object trails
Ok, if you insist, here's a more complicated way of doing it :)
The problem is that the mouse position is not updated fast enough, so we have to make our own mouse object using fastloops.
Make a new AO called M.
* Always
- Start loop "mouse" 30 times
* On loop "mouse"
+ Xpos of M < Xmouse
- M: set xpos to xpos+1
* On loop "mouse"
+ Xpos of M > Xmouse
- M: set xpos to xpos-1
* On loop "mouse"
+ Ypos of M < Ymouse
- M: set ypos to ypos+1
* On loop "mouse"
+ Ypos of M > Ymouse
- M: set ypos to ypos-1
Create an AO (name it C) with the color you want, and also like in the last example give it a fade-out transition that fades out in 0.22 secs or faster.
* On loop "mouse"
+ LoopIndex("mouse") mod 4 = 0
- Create C at 0,0 from M
- C: destroy
This method will generate about 100 extra objects and will be alot smoother. You can alter this ammount by changing mod 4 to something else. Mod 4 = 0 means it does the action on every 4th loop. Mod 8 = 0 would make it do the action every 8th loop.
-
Re: Object trails
Yes, this works really good. I had to tweak with it a bit, but this is exactly what I was looking for. Thank you.