|
Too many functions ?! [NEW]
#376342
07/01/11 21:54
07/01/11 21:54
|
Joined: Oct 2010
Posts: 59 Internet
Memorix101
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2010
Posts: 59
Internet
|
Diese meldung kommt neuer dings bei mir. Aber wie wird sie ausgelöst ?! Laut Manual hätte ich eine art schleife in den angegebebenen Action/Function. WAs für lösungen gibt es ich habe nun den nexus von 30 auf 80 hoch gestockt.Die function anzeige (F11) saust sehr schnell nach oben
Last edited by Memorix_101; 07/02/11 14:32.
|
|
|
Re: Too many functions ?!
[Re: Ayumi]
#376344
07/01/11 22:07
07/01/11 22:07
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
To understand recursion, you must first understand recursion!
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Too many functions ?!
[Re: WretchedSid]
#376345
07/01/11 22:16
07/01/11 22:16
|
Joined: Oct 2010
Posts: 59 Internet
Memorix101
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2010
Posts: 59
Internet
|
Die Teile sind
action player_walk()
{
player = my;
set(my,SHADOW);
my.skill4 = 1; // height above ground, should not be equal or below zero - increase min_z (min_z is negative) instead, if necessary
cameraa();
showMiniMap();
health_indicator();
power_indicator();
my.health = 100;
var anim_percent = 0; // animation percentage
mouse_mode = 0;
while (my.health > 0)
{
// horizontal movement
if(my.health < 100)
{
ent_morphskin(my,"sid1.bmp");
}
if(my.health < 75)
{
ent_morphskin(my,"sid2.bmp");
}
if(my.health < 10 )
{
ent_morphskin(my,"sid3.bmp");
}
my.pan += (key_a-key_d)*15*time_step;
my.skill1 += ((key_w-key_s)*20 - my.skill1)*time_step; // makes player accelerate and stop smoothly
c_move (my, vector(my.skill1*time_step, 0, 0), nullvector, GLIDE);
if(key_w)
{
anim_percent += 10*time_step;
ent_animate(me,"run",anim_percent,ANM_CYCLE); // play the "stand" animation
}
else // player stands still
{
anim_percent += 2*time_step;
ent_animate(me,"stand",anim_percent,ANM_CYCLE); // play the "stand" animation
}
if(key_s)
{
anim_percent -= 15*time_step;
ent_animate(me,"run",anim_percent,ANM_CYCLE); // play the "stand" animation
}
if(mouse_middle)
{
cameraa_fly();
}
else
{
cameraa();
}
if(key_w && mouse_right)
{
my.skill2 += ((key_w && mouse_right)*20 - my.skill2)*time_step;
c_move (my, vector(my.skill2*time_step, 0, 0), nullvector, GLIDE);
anim_percent += 10*time_step;
ent_animate(me,"fly",anim_percent,ANM_CYCLE); // play the "stand" animation
powers_ok();
}
if(key_space)
{
anim_percent += 1*time_step;
ent_animate(me,"jump",anim_percent,ANM_CYCLE); // play the "stand" animation
}
// vertical movement and gravity
result = c_trace(my.x,vector(my.x,my.y,my.z-200),IGNORE_ME | IGNORE_PASSABLE)+my.min_z;
result += !trace_hit*200; // when !trace_hit ist true, c_trace returns 0, that's why we have to add some quants (f.i. the maximum trace distance)
if(trace_hit) my.skill3 = target.z; // see 25 lines below
else my.skill3 = -9999999;
if(result > my.skill4 || my.skill2 > 0) {
my.skill2 -= gravity_acceleration*time_step;
my.skill2 = maxv(my.skill2,-80);
c_move(me,nullvector,vector(0,0,my.skill2*time_step),GLIDE);
}
else {
my.skill2 = 0;
if(key_space)
{
if(key_space_released) {
key_space_released = 0;
my.skill2 = 35; // jump strength
}
}
else key_space_released = 1; // no infinite jumping, release space (while on ground) for a new jump
}
// my.z = maxv(my.z,my.skill3+my.skill4-my.min_z); // make sure player's feet stay above ground
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;
ent_morphskin(my,"sid3.bmp");
//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.5;
wait (1);
}
set (my, PASSABLE);
wait(1);
}
dieser und
function mrbomb()
{
if (event_type == EVENT_IMPACT)
{
ent_create (explosion_pcx, my.x, explodes);
snd_play(explode_wav,100,0);
your.health -= 50;
ent_remove(my);
snd_stop(tic_wav);
}
wait(1);
}
bitte schaut dort mal rein und helft mir die fehler zufinden ...
|
|
|
Re: Too many functions ?!
[Re: Memorix101]
#376348
07/01/11 22:38
07/01/11 22:38
|
Joined: Oct 2010
Posts: 59 Internet
Memorix101
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2010
Posts: 59
Internet
|
Also ich habe den Fehler (die Nadel im heu hauffen^^) gefunden. Es ist
if(mouse_middle)
{
cameraa_fly();
}
else
{
cameraa();
}
Ich hätte nicht gedacht das die paar zeilen soviel bewircken köönen das ein ganzes spiel abstürtzt.
Last edited by Memorix_101; 07/01/11 22:39.
|
|
|
Re: Too many functions ?!
[Re: Memorix101]
#376398
07/02/11 15:53
07/02/11 15:53
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Das überleg dir mal selbst.  Soll heißen: Mach dir klar, was in einer while-Schleife ablaufen und was wie aufgerufen werden soll.
Last edited by Superku; 07/02/11 15:54.
"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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|