Wie funktionieren eigentlich diese Code Tags???
Hoffe ich hab alles richtig übertragen, da ich eigentlich an einem anderem Computer arbeite.
Der Spieler soll einen Block von unten beim Springen berühren und dann nach unten falen oder abprallen. Bounce wollte ich nicht verwennden, da sich die Entity nicht drehan sollte. Der Block soll dann aber passable werden und ausgeblendet werden. Sory, das das Script schlecht komentiert ist.
[code ]
function hit_event()
{
if (event_type == event_impact)
{
while(me)
{
my.passable = on;
my.transparent = on;
my.alpha = 100;
if (my.alpha >= 0)
{
my.alpha -= 5 * time;
if (my.alpha <= 0)
{
wait(3);
ent_remove(my);
return;
}
}
wait(1);
}
}
}
action block
{
// my.enable_entity = on;
// my.ENABLE_IMPACT = ON;
my.enable_push = on;
my.push = -2;
my.event = hit_event;
//my.passable = on;
}
function hit_bottom_event() //die Entity soll von Level und Entity Blocks abprallen
{
if (event_type == EVENT_BLOCK) && (_distance_to_bottom < 2)
{
rel_speed.z *= -1;
return;
}
if (event_type == EVENT_ENTITY) && (_distance_to_bottom < 2)
{
rel_speed.z *= -1;
return;
}
}
action spieler
{
my.push = -1;
my.ENABLE_BLOCK = ON;
my.enable_entity = on;
my.enable_push = on;
my.event = hit_bottom_event;
while(1)
{
vec_set (temp, my.x);
temp.z = my.z - 2000; //trace nach unten
_distance_to_ground = c_trace (my.x, temp, ignore_me + ignore_passable) - ((my.max_z - my.min_z) / 2);
vec_set (temp, my.x);
temp.z = my.z + 5000; //trace nach oben
_distance_to_bottom = c_trace (my.x, temp, ignore_me + ignore_passable) - ((my.max_z - my.min_z) / 2);
// Jump & Gravitation
if (key_force.y == 1) && (_distance_to_ground <= 3) && (jumping == 0)
{
rel_speed.z = 128;
jumping = 1;
}
if (_distance_to_ground > 1)
{
grav = -13; //die Gravitation
if (key_force.y == 0)
{
jumping = 0;
}
}
else
{
grav = 0;
if (key_force.y == 0)
{
jumping = 0;
}
}
_rel_dist.z = accelerate (rel_speed.z, grav, 0.1);
///walk left/right
if (key_force.x != 0)
{
_rel_dist.y = accelerate (rel_speed.y, -32 * key_force.x, 0.7);
}
else
{
if (_distance_to_ground > 1)
{
_rel_dist.y = accelerate (rel_speed.y, 0, 0.1);
}
else
{
_rel_dist.y = accelerate (rel_speed.y, 0, 0.7);
}
}
c_move (my, _rel_dist, nullvector, glide + ignore_passable);
camera.y = my.y;
camera.z = my.z + 512;
wait(1);
}
}
Last edited by LX_Ulle; 12/24/07 23:14.