Posted By: sadsack
speed problem - 11/03/09 19:45
Hello,
What I am trying to do, is when you press a key, lets say w, the
ship stars moving forward very slowly, every cycle the speed keep going faster. then when you press key s you start slowying slow down.
here my code:
I should be going up in speed when I press "w". But I am going the same speed all the time.
Thank you
renny
What I am trying to do, is when you press a key, lets say w, the
ship stars moving forward very slowly, every cycle the speed keep going faster. then when you press key s you start slowying slow down.
here my code:
Code:
#include <acknex.h> #include <default.c> //////////////////////////////////////////////////////////////////// ENTITY* player1; var h_speed = 0; function act_player1() { while(!me){wait(1);} player1 = me; me.ambient = 10; while(me) { if (key_w) h_speed = .01 + .01; {c_move (me,vecto(h_speed,0,0),nullvector,GLIDE);} my.pan += 3 * (key_z-key_x) * time_step; my.tilt += 3 * (key_c-key_v) * time_step; my.roll += 3 * (key_r-key_t) * time_step; c_move (me,my.skill1,nullvector,GLIDE); vec_set(camera.x, vector(player1.x, player1.y, player1.z + 25)); vec_set(camera.pan, player1.pan); wait(1); } } function main() { level_load ("platform.wmb"); wait(2); // wait until the level is loaded ent_create("ship.mdl",vector(-900,0,150),act_player1); wait(2); // wait until the level is loaded }
I should be going up in speed when I press "w". But I am going the same speed all the time.
Thank you
renny