3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Fall damage
#308278
02/02/10 17:57
02/02/10 17:57
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
Hello!I would like to know how can i make my character die after he falls a specified time or a specified distance and then colides with someting(my char should take damage when colides with something but also if it falls more than 5 seconds for instance,it dies)...How can i do this?Any examples? Thanks!
Last edited by Ted22; 02/02/10 18:02.
|
|
|
Re: Fall damage
[Re: 3run]
#308430
02/03/10 10:34
02/03/10 10:34
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
action stair() { VECTOR temp; while (1) { c_move (my, vector(0, 0, -5 * time_step), nullvector, GLIDE); player = me; camera.x = player.x - 100 * cos(player.pan);
camera.y = player.y - 100 * sin(player.pan);
camera.pan = player.pan; // the camera and the player have the same pan angle
camera.z = player.z + 70; // place the camera above the player, play with this value
camera.tilt = -25; vec_set(temp, my.x); temp.z -= 5; // trace downwards 500 quants below c_trace (my.x,temp,IGNORE_ME); if(c_trace == 0) fall = 1; if(c_trace >= 0) fall = 5; wait(1); } }
What is wrong hereeeeeeeeeeeeee????I got just an entity in my level but fall = 5(c_trace detected something)
|
|
|
Re: Fall damage
[Re: Ted22]
#308445
02/03/10 10:59
02/03/10 10:59
|
Joined: Mar 2007
Posts: 112
MikeS
Member
|
Member
Joined: Mar 2007
Posts: 112
|
and where is your Problem?
Bzw. Wo liegt denn genau dein Problem?
Last edited by MikeS; 02/03/10 10:59.
|
|
|
Re: Fall damage
[Re: Ted22]
#308484
02/03/10 13:00
02/03/10 13:00
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
i managed to make a code:
var life = 100; var life2 = life; var fall = 0; var life_for_fall = 100; var fall_prec = 1; ENTITY* stair;
PANEL* pDisplayy = { pos_x = 10; pos_y = 20; digits (10, 10, 5, *, 1, fall); flags = VISIBLE; }
PANEL* pDisplayyy = { pos_x = 10; pos_y = 40; digits (10, 10, 5, *, 1, life_for_fall); flags = VISIBLE; }
PANEL* pDisplay = { pos_x = 10; pos_y = 30; digits (10, 10, 5, *, 1, life); flags = VISIBLE; }
function main() { video_mode = 7; level_load ("work.wmb"); fps_max = 150; wait (2); // wait until the level is loaded }
action stair() { VECTOR temp; while (1) { c_move (my, vector(0, 0, -25 * time_step), nullvector, GLIDE); player = me; camera.x = player.x - 100 * cos(player.pan);
camera.y = player.y - 100 * sin(player.pan);
camera.pan = player.pan; // the camera and the player have the same pan angle
camera.z = player.z + 70; // place the camera above the player, play with this value
camera.tilt = -25; vec_set(temp, my.x); temp.z -= 5; // trace downwards 500 quants below c_trace (my.x,temp,IGNORE_ME); if(c_trace (my.x,temp,IGNORE_ME) == 0) fall += fall_prec * time_step; if(c_trace(my.x,temp,IGNORE_ME) > 0) fall = 0; if (fall > 100) life = 0; if (fall += fall_prec * time_step) life_for_fall -= 1 * time_step; if (c_trace(my.x,temp,IGNORE_ME) > 0) life = life2 - life_for_fall; if (c_trace(my.x,temp,IGNORE_ME) > 0) fall_prec = 0; if (life < 0) life = 0; wait(1); } }
tested and works fine but i'm not sure if it is very logical...so the ideea is:If it falls more than 100 metters it dies...if it falls a metter life -= 1
Last edited by Ted22; 02/03/10 13:06.
|
|
|
|