Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Jump ?! #376188
06/30/11 16:06
06/30/11 16:06
Joined: Oct 2010
Posts: 59
Internet
Memorix101 Offline OP
Junior Member
Memorix101  Offline OP
Junior Member

Joined: Oct 2010
Posts: 59
Internet
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

Re: Jump ?! [Re: Memorix101] #376191
06/30/11 16:16
06/30/11 16:16
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Bitte gewöhne dir in Zukunft an, nur noch eingerückten Code mit Hilfe der [ code] [ /code] tags (ohne die Leerzeichen) zu posten, das liest sich sonst zu schrecklich und guckt sich auch niemand an.
Hier habe ich gestern einen einfachen player Code mit Sprung gepostet, der sollte dir helfen:

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=376081#Post376081

EDIT: Und die nicht-deutsch-sprachigen Forum Benutzer ärgern sich sicher, wenn sie auf "Jump" klicken und nur ein rein deutsches Topic vorfinden, sprich ein deutscher Titel wäre etwas angemessener. wink

Last edited by Superku; 06/30/11 16:17.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Jump ?! [Re: Superku] #376193
06/30/11 16:26
06/30/11 16:26
Joined: Oct 2010
Posts: 59
Internet
Memorix101 Offline OP
Junior Member
Memorix101  Offline OP
Junior Member

Joined: Oct 2010
Posts: 59
Internet
Cool ! Danke nun muss ich noch die animation rein bringen


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1