Posted By: V_Sola
problem with entity movement - 02/06/09 22:55
Hi guys,
I want my model to move on an certain key. But up until now after i pressed for example Z the model continues moving.
So how could I tell the engine: when I am holding W - Move the model with a regular speed until I stop holding ? that's my Code:
till now
////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
ENTITY* wizard;
////////////////////////////////////////////////////////////////////
function move_up()
{
wizard.z += 5; // addiere jedes mal, wenn diese Funktion aufgerufen wird 5 Quants auf die Höhe von wizard
}
function move_down()
{
wizard.z -= 5;
}
function move_ahead()
{
while(1)
{
wizard.x += 5*time_step*;
wait(1);
}
}
function move_back()
{
while(1)
{
wizard.x += -5* time_step;
wait(1);
}
}
function main()
{
//video_mode = 7; // 800x600 pixels
video_switch (8,32,1);
level_load ("Drohne_Levelc.wmb");
on_u = move_up;
on_i = move_down;
on_z = move_ahead;
on_y = move_back;
}
action wizard_with_pointer()
{
wizard = my;
my.ambient = 100;
}
action wizard_simple()
{
my.ambient = 100;
}
P.S does it gave any value for a model's speed?
I want my model to move on an certain key. But up until now after i pressed for example Z the model continues moving.
So how could I tell the engine: when I am holding W - Move the model with a regular speed until I stop holding ? that's my Code:
till now
////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
ENTITY* wizard;
////////////////////////////////////////////////////////////////////
function move_up()
{
wizard.z += 5; // addiere jedes mal, wenn diese Funktion aufgerufen wird 5 Quants auf die Höhe von wizard
}
function move_down()
{
wizard.z -= 5;
}
function move_ahead()
{
while(1)
{
wizard.x += 5*time_step*;
wait(1);
}
}
function move_back()
{
while(1)
{
wizard.x += -5* time_step;
wait(1);
}
}
function main()
{
//video_mode = 7; // 800x600 pixels
video_switch (8,32,1);
level_load ("Drohne_Levelc.wmb");
on_u = move_up;
on_i = move_down;
on_z = move_ahead;
on_y = move_back;
}
action wizard_with_pointer()
{
wizard = my;
my.ambient = 100;
}
action wizard_simple()
{
my.ambient = 100;
}
P.S does it gave any value for a model's speed?