Simple Smooth Movement
Author: | curly
|
Submitted: | 19th May, 2008
|
Views: | 5222
| Rated: |
|
|
Masking your movement is one of the most effective ways of hiding smaller glitches and making your game feel more profesional. It's also ridiculously easy so I figured I'd share my technique, and hopefully you'll find it as useful as I have.
To start with you obviously need a moving object.
We'll call this 'TARGET'.
Then you need a mask to smoothly cover up the target.
This will be called 'MASK'
Basically you want MASK to find how far it is from TARGET and move a set percentage of the distance towards TARGET. Instead of using trig, simple XY events do the trick here.
Set MASK Xposition to...
( MASK_Xpos + ( ( TARGET_Xpos - MASK_Xpos ) / 10 ) )
The number 10 can be changed to whatever suits the purpose (The larger the number the more smoothing). For the Y position just change all the X's into Y's and thats about it. Because MMF doesn't support decimals the MASK may be a little off in the higher levels of smoothing but there are easy ways arount this. If you need to know just shout out and I'll be glad to explain.
http://amatter.sitesled.com/smooth.zip
This is a little demonstration of what I'm talking about.
It doesn't just apply to mouse controlled movement however, I've used this to clean up anything from platformers to racing games. I also had to make it in Construct because MMF wont run on my computer.
|
|
curly
Registered 19/05/2008
Points 136
|