Hallöchen liebes Forum,
nun mein Problem ich weiß nicht wie ich eien Sprung vom einem Actor schreiben soll. Das ist mir etwas peinlich ... .
Mein Player Script sieht so aus ...
action player_walk()
{
// if necessary, adjust the bounding box to give the entity 'floor room' (see remarks)
// my.min_z *= 0.5;
var speed_down = 0; // downward speed by gravity
var anim_percent = 0; // animation percentage
VECTOR vFeet;
player = me;
cameraa();
my.health = 100;
vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
mouse_mode = 0;
while (my.health > 0)
{
// rotate the player using the [A] and [D] keys
my.pan += 5*(key_a-key_d)*time_step;
// determine the ground distance by a downwards trace
var dist_down;
if (c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0)
dist_down = my.z + vFeet.z - target.z; // get distance between player's feet and the ground
else
dist_down = 0;
// apply gravity when the player is in the air
if (dist_down > 0) // above floor, fall down with increasing speed
dist_down = clamp(dist_down,0,accelerate(speed_down,5,0.1));
else // on or below floor, set downward speed to zero
speed_down = 0;
// move the player using the [W] and [S] keys
var dist_ahead = 8*(key_w-key_s)*time_step;
dist_ahead = sign(dist_ahead)*(abs(dist_ahead) + 0.5*dist_down); // adapt the speed on slopes
c_move(me,vector(dist_ahead,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
var dist_aheads = 15*(key_w-key_s)*time_step;
dist_aheads = sign(dist_ahead)*(abs(dist_aheads) + 0.5*dist_down); // adapt the speed on slopes
c_move(me,vector(dist_aheads,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
// animate the player according to its moved distance
if (dist_ahead != 0) // player is moving ahead
{
anim_percent += 1.3*dist_ahead; // 1.3 = walk cycle percentage per quant
ent_animate(me,"run",anim_percent,ANM_CYCLE); // play the "walk" animation
}
else // player stands still
{
anim_percent += 1*time_step;
ent_animate(me,"stand",anim_percent,ANM_CYCLE); // play the "stand" animation
}
if(key_space) // rechte Maustaste gedrückt
{
//jump();
}
if(mouse_left == 1) // rechte Maustaste gedrückt
{
anim_percent = 0;
snd_play(shoot_wav,100,0);
while(anim_percent < 100) {
anim_percent += 5*time_step;
ent_animate(me,"attack",anim_percent,ANM_CYCLE); // play the "stand" animation
wait(1);
}
}
wait(1);
}
// the player is dead here
my.skill22 = 0;
while (my.skill22 < 100)
{
reset (time_pan, VISIBLE);
reset (timex, VISIBLE);
sec = -1;
die_cam();
mouse_mode = 2;
set(die , VISIBLE);
my.skill22 += 3 * time_step;
ent_animate(my, "die", my.skill22, NULL); // play a one-shot "death" animation
time_factor = 0.1;
wait (1);
}
set (my, PASSABLE);
}
Danke für eure hilfe.
mfg Memorix101