A much more concise method would be using the key_XX variables (where XX is the key being pressed). These variables are 0 if not pressed, 1 if pressed and can be used in any equation. They are also predefined.

So we can take move_up, move_down, move_ahead and move_back and condense them into shorter lines of code:
Code:
action wizard_with_pointer()
{
   my.ambient = 100;
   while(1)
   {
      my.x = 5 * (key_z - key_y) * time_step;
      my.z = 5 * (key_i - key_u) * time_step;
      wait(1);
   }
}


The way it works is this:

Key Z is pressed, Key Y is not pressed:
my.x = 5 * (1 - 0) * time_step = 5 * 1 * time_step = 5 * time_step
Key Y is pressed, Key Z is not pressed:
my.x = 5 * (0 - 1) * time_step = 5 * -1 * time_step = -5 * time_step
Both are pressed:
my.x = 5 * (1 - 1) * time_step = 5 * 0 * time_step = 0
Neither are pressed
my.x = 5 * (0 - 0) * time_step = 5 * 0 * time_step = 0

This removes the need for those 4 functions and the four on_key commands in function main.


I was once Anonymous_Alcoholic.

Code Breakpoint;