2 registered members (RealSerious3D, rvl),
1,187
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: action player
[Re: Superku]
#385743
10/23/11 05:47
10/23/11 05:47
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
User
|
User
Joined: Oct 2008
Posts: 513
|
EDIT: nevermind...
Last edited by Carlos3DGS; 10/23/11 05:48.
|
|
|
Re: action player
[Re: Funeral]
#385852
10/25/11 08:12
10/25/11 08:12
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
action a_player(){
while(me){
if(key_space){
//Superku's code here
}
wait(1);
}
}
|
|
|
Re: action player
[Re: MrGuest]
#385950
10/26/11 00:16
10/26/11 00:16
|
Joined: Dec 2008
Posts: 83 Buenos Aires, Argentina
Funeral
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
|
action a_player(){
while(me){
if(key_space){
//Superku's code here
}
wait(1);
}
}
yeah that's exactly what i have but after doing the action once it just doesnt wanna do it again when i press the key again CODE if(key_space) { while(counter > 0) { c_move(me,vector(10*time_step, 0, 0),vector(0, 0, 0), GLIDE); counter -= time_step; wait(1); } }
|
|
|
Re: action player
[Re: Funeral]
#385951
10/26/11 00:26
10/26/11 00:26
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
action a_player(){
while(me){
if(key_space){
//Superku's code here
}
wait(1);
}
}
yeah that's exactly what i have but after doing the action once it just doesnt wanna do it again when i press the key again CODE if(key_space) { while(counter > 0) { c_move(me,vector(10*time_step, 0, 0),vector(0, 0, 0), GLIDE); counter -= time_step; wait(1); } } That's obviously not exactly what you have otherwise it'd be working
#include <acknex.h>
#include <default.c>
action a_player(){
my.pan = 45;
while(me){
if(key_space){
//Superku's code here
var counter = 48; // 16ticks * 3 = 3 seconds
while(counter > 0){
c_move(me, vector(10*time_step, 0, 0), nullvector, NULL);
counter -= time_step;
wait(1);
}
}
wait(1);
}
}
void main(){
level_load(NULL);
ent_create(CUBE_MDL, vector(250, -150, 0), a_player);
}
Where's while(me)?
|
|
|
Re: action player
[Re: MrGuest]
#385952
10/26/11 00:42
10/26/11 00:42
|
Joined: Dec 2008
Posts: 83 Buenos Aires, Argentina
Funeral
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
|
while its on top of the player code but its "while(1)" ahyway i changed it by (me) but its the same. the whole its long becaus eit has a some other movements is this
var floor; var gm_percentage; var stand_percentage; var jump = 0; var SJ = 0; var Q = 0; var J = 0; var js = 0; var rt = 0; var s = 0; var z = 0; var counter = 10; var peeking = 0; var air = 0;
function main() { level_load("prog.wmb"); } function still() { c_move(me,nullvector,vector(0, 0, 0), GLIDE); }
action player_script() { player = my; var distance, angle;
VECTOR temp; distance = 100; angle =0; while(me) { if(player) { camera.x = player.x-distance*cos(angle); camera.y = player.y-distance*sin(angle); camera.z = player.z+20;
vec_set(temp,player.x); vec_sub(temp,camera.x); vec_to_angle(camera.pan,temp);
angle -= (joy_5-joy_6)*4*time_step; angle %= 360;
ent_animate(me,"stand",stand_percentage, ANM_CYCLE); // "walk" animation loop stand_percentage += 4* time_step; if(joy_force.x) ent_animate(me,"gm",gm_percentage, ANM_CYCLE); // "walk" animation loop gm_percentage += 10* time_step; if(joy_force.y) ent_animate(me,"gm",gm_percentage, ANM_CYCLE); // "walk" animation loop gm_percentage += 10* time_step;
c_move(me,vector(0, 0, 0),vector(0, 0, -0.7), GLIDE);
vec_set(temp.x, my.x); temp.z -= 10000; floor = c_trace(my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE); // compute the distance between player's origin and the floor below its feet
if(joy_4 && floor < 30 && jump == 0 && J == 0) { jump = 1; } if(jump == 1) { c_move(me,vector(0, 0, 20*time_step), nullvector, GLIDE); J = 1; } if(floor > 30) { jump = 2; } if(floor < 1 && !joy_4) { jump = 0; J = 0; } //////////////////////////////////////////// if(joy_7 && floor < 1) { still(); } else { c_move(me, nullvector, vector(joy_force.y * 3 * time_step, -joy_force.x * 3 * time_step, 0), GLIDE); } //////////////////////////////////////////////////////
vec_to_angle(my.pan, vector(sign(joy_force.x),sign(joy_force.y),0)); my.pan -= 0;
///////////////////////////////////////// if(!joy_4 && joy_7) { z = 1; }
///////////////////////////////
if(z == 1 && joy_4 && floor < 60 && SJ == 0 && js == 0) { SJ = 1; } if(SJ == 1) { c_move(me,vector(0, 0, 10*time_step), nullvector, GLIDE); js = 1; } if(floor > 60) { SJ = 2; } if(floor < 1 && !joy_7) { SJ = 0; js = 0; z = 0; } /////////////////////////////////////////////////////////////////////////// if(!joy_7 && floor > 1) { s = 1; } if(s == 1 && floor > 1 && joy_7) { c_move(me,vector(0, 0, -20*time_step), nullvector, GLIDE); } if(floor < 1) { s = 0; } //////////////////////////////// if(!joy_4 && floor > 1) { air = 1; } if(air == 1 && floor > 1 && joy_4) { c_move(me,vector(0, 0, 2*time_step), nullvector, GLIDE); } if(floor < 1) { air = 0; } ///////////////////////////////////////////////// if(key_space) { while(counter > 0) {
c_move(me,vector(10*time_step, 0, 0),vector(0, 0, 0), GLIDE); counter -= time_step; wait(1); }
}
}
wait(1);
} }
|
|
|
|