This article shows how to get started with custom movements with only one detector, a platform one in this example. Note that this is the basic way I do them. There's loads of other ways, but this seems easy and logical to me.

Before we start, let's recap some important MMF mechanics.

A. MMF Mechanics

1. MMF executes the code from the top to the bottom.
Assuming you have an event setting a value to 2 and another one below it setting it to 1, the alterable value will be 1 in the end. But if you check the value before the second event, it will return 2.

2. When placing actions, they will execute in the order they've been placed in.

B. The Movement

Okay, let's get started on the movement now!

First, let's create a square active object. Let's call it 'move'. Add the following code in the Event Editor (altval B is Alterable Value B of 'move'):

*while right arrow is pressed & altval B < 2 --> add 1 to altval B
*while left arrow is pressed & altval B > -2 --> sub 1 to altval B

*while right arrow isnt pressed & left arrow isn't pressed & altval B > 0 --> Sub 1 to altval B
*while right arrow isnt pressed & left arrow isn't pressed & altval B < 0 --> Add 1 to altval B

if altval A < 6 --> Add 1 to altval A
Upon pressing shift --> Set altval A to -12 (or something)

The code above turns altval B into a speed indicator, and altval A becomes the gravity indicator.

//moving right
*always --> set X pos 'move' to x pos 'move' + 1
*if 'move' not overlapping obstacle + altval B >= 1 --> Set x pos 'move' to x pos 'move' + 1
*if 'move' not overlapping obstacle + altval B >= 2 --> Set x pos 'move' to x pos 'move' + 1
*always --> set X pos 'move' to x pos 'move' - 1

This piece of code isn't as obvious. It moves 'move' to the right, and while it's there, we check if the area to the right is free. If it is, we move it. The two checks for altval B being greater than 1 and 2 allows for two different speeds; one pixel per loop and two pixels per loop. We could use fastloops to make it simpler, but this way it's more logical and easier to explain.

Let's add the same for the other direction:

//moving left
*always --> set X pos 'move' to x pos 'move' - 1
*if 'move' not overlapping obstacle + altval B <= -1 --> Set x pos 'move' to x pos 'move' - 1
*if 'move' not overlapping obstacle + altval B <= -2 --> Set x pos 'move' to x pos 'move' - 1
*always --> set X pos 'move' to x pos 'move' + 1

Put some obstacles into your game and run it. You now can move the object to the left and right with pixel perfect collision detection. Let's add the code for up and down now! We'll use altval A of 'move' for that.

//moving up
*always --> set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -1 --> Set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -2 --> Set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -3 --> Set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -4 --> Set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -5 --> Set y pos 'move' to y pos 'move' - 1
*if 'move' not overlapping obstacle + altval A <= -6 --> Set y pos 'move' to y pos 'move' - 1
*always --> set y pos 'move' to y pos 'move' + 1

We need more speed for jumping - with the code above we can move our object 6 pixels to the top per loop. You can do the same for left and right.

//moving down
*always --> set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 1 --> Set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 2 --> Set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 3 --> Set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 4 --> Set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 5 --> Set y pos 'move' to y pos 'move' + 1
*if 'move' not overlapping obstacle + altval A >= 6 --> Set y pos 'move' to y pos 'move' + 1
*always --> set y pos 'move' to y pos 'move' - 1

Okay, now we've covered all 4 directions. Place a bunch of obstacle backgrounds into your level and run it. It's easy to convert this so it uses fastloop. That would get rid of having to make 'is greater or equal than' checks, making it use even less events.

C. End of Article

Once you understand the logic behind this, you'll be able to code advanced movements with it.

You could also run checks like x + 30 to detect enemies or similar. That would be helpful for enemy AI. This code is also suitable for enemy movements.

Good luck! If you have any questions, just ask.

You can download an example for MMF 1.5 at http://www.zodm.com/images/fyK03158.zip during the next few days.