Hello. I want to increate player's speed using velocity.
I have two directions so far: forwards, backwards.
I need six of them: upwards, downwards, left, right.
PHP Code:
#define GOING_SPEED 320
enum
{
GO_UP,
GO_DOWN,
GO_LEFT,
GO_RIGHT,
GO_FORWARD,
GO_BACK
};
public client_PostThink(Client)
{
if (!is_user_alive(Client))
return;
static Float:s_Velocity[3];
entity_get_vector(Client, EV_VEC_velocity, s_Velocity);
velocity_by_aim(Client, GOING_SPEED, s_Velocity);
switch (GetDirection(Client)) // Returns one of the enumerated directions
{
case GO_FORWARD:
{
// velocity_by_aim() already gave the needed velocity, do nothing
}
case GO_BACK:
{
s_Velocity[0] = -s_Velocity[0];
s_Velocity[1] = -s_Velocity[1];
s_Velocity[2] = -s_Velocity[2];
}
}
entity_set_vector(Client, EV_VEC_velocity, s_Velocity);
}
So, how do I calculate the other directions? And is there a better way to do this?
__________________