|
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn),
581
guests, and 0
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: FPS TROUBLE (ima noob)
[Re: darkinferno]
#273187
06/21/09 20:56
06/21/09 20:56
|
ricky5564
OP
Unregistered
|
ricky5564
OP
Unregistered
|
lol... thats just a big breakthrough wit my progress... but i still cant start my character walking script.... this is really hard for me
|
|
|
Re: FPS TROUBLE (ima noob)
[Re: ]
#273239
06/22/09 07:36
06/22/09 07:36
|
Joined: Nov 2008
Posts: 946
the_clown
User
|
User
Joined: Nov 2008
Posts: 946
|
Player movement isn't that difficult... Alright, let's see... Follow this code now, I'll comment it as good as I can. DON'T COPY AND PASTE, READ it and try to UNDERSTAND, ok? That will help you more.
//////////////////////////////////////////////////////
//// first, we define a skill that stores the player's
//// health:
#define health skill1 // skill1 is now called health
////////////////////////////////////////////////
/// a skill for the animation percent
#define animate skill2
////////
// now, we define three more skills that store the player'S
// speed
#define move_x skill3 // speed forward/backwards
#define move_y skill4 // speed sidewards
#define move_z skill5 // speed up/down
/////////////////////////////////////////////////
/// Ok, now we have to define an action that we assign
/// to the player model in WED
action player_ent()
{
// we attach the predefined player pointer to it to
// identify it later
player = me;
my.health = 100; // he's at full health
/// now, a loop; we want to control him all the time
while(1)
{
///////////////////////////////////
// if he's dead (health <= 0), we exit the loop
if(my.health <= 0)
break; // this statement exits the loop
///////////////////////////////////////////
/// we move him using w,a,s,d keys, ok?
my.move_x = (key_w-key_s)*22*time_step;
my.move_y = (key_a-key_d)*22*time_step;
/// this is the function that moves him, using
// the speed vector skill we control
c_move(my,my.move_x,nullvector,GLIDE | USE_BOX);
//////////////////////////////////////////////
// now, a VERY simple animation system:
if((my.move_x + my.move_y) != 0) // if moving
{
ent_animate(my,"walk",my.animate,ANM_CYCLE);
my.animate += 10*time_step;
my.animate %= 100; // this sets animate to 0 if 100 is reached.
}
else // if standing still
{
ent_animate(my,"stand",my.animate,ANM_CYCLE);
my.animate += 5*time_step;
my.animate %= 100;
}
wait(1);
}
///////////////////////////////////////
/// and now, a simple death
my.animate = 0;
while(my.animate < 80)
{
ent_animate(my,"die",my.animate,ANM_CYCLE);
my.animate += 10*time_step;
my.animate%= 100;
wait(1);
}
set(my,PASSABLE); // make him passable
You'll have to name your animations walk, stand and die. Well, now after you read it, simply ask for the things you didn't understand, I'll be glad to help. And if you understood everything, we can go on with the camera. Btw, a game with a behind-the-back camera isn't a FPS but a TPS (Third Person Shooter). 
Last edited by the_clown; 06/22/09 07:58.
|
|
|
Re: FPS TROUBLE (ima noob)
[Re: the_clown]
#273869
06/24/09 19:05
06/24/09 19:05
|
ricky5564
OP
Unregistered
|
ricky5564
OP
Unregistered
|
thanks dude my whole gole from for this FPS is to learn the program and script .. i am not a copy and paster
|
|
|
Re: FPS TROUBLE (ima noob)
[Re: the_clown]
#273870
06/24/09 19:07
06/24/09 19:07
|
ricky5564
OP
Unregistered
|
ricky5564
OP
Unregistered
|
oh and lol it was hard for me to script the camera behind the character... so i just called it an fps for now but thnkz 2 u i might be able to make it a tbs
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|