4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Engine crasht ohne Grund
#430651
09/30/13 15:10
09/30/13 15:10
|
Joined: Oct 2005
Posts: 12
irchel2
OP
Newbie
|
OP
Newbie
Joined: Oct 2005
Posts: 12
|
Ich verwende das shooter-template t_shooter_player.c usw. Funktioniert soweit einwandfrei, aber wenn ich sterbe, moechte ich gern noch nen versuch. Also von:
[...]
if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
{
if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
jump_handle = snd_play(tshooter_jump_wav, 70, 0);
vertical_speed.z = tshooter_jump * time_step; // push the player upwards
}
// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE);
// player movement end
wait(1);
}
camera.z -= 30; // bring the camera closer to the floor
camera.roll = 40; // and rotate its view (the player is dead here)
}
(das geht wunderbar) zu:
[...]
if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
{
if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
jump_handle = snd_play(tshooter_jump_wav, 70, 0);
vertical_speed.z = tshooter_jump * time_step; // push the player upwards
}
// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE);
// player movement end
wait(1);
}
camera.z -= 30; // bring the camera closer to the floor
camera.roll = 40; // and rotate its view (the player is dead here)
wait(30);
//printf("unded");
camera.z += 30;
camera.roll = 0;
t_shooter_players_health = 100;
goto restarto;
//t_shooter_player();
}
was crasht, wenn man jumpt. So gehts wieder:
[...]
if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
{
// if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
// jump_handle = snd_play(tshooter_jump_wav, 70, 0);
vertical_speed.z = tshooter_jump * time_step; // push the player upwards
}
// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE);
// player movement end
wait(1);
}
camera.z -= 30; // bring the camera closer to the floor
camera.roll = 40; // and rotate its view (the player is dead here)
wait(30);
//printf("unded");
camera.z += 30;
camera.roll = 0;
t_shooter_players_health = 100;
goto restarto;
//t_shooter_player();
}
alles extrem unlogisch. Ich denke da hab ich einen Engine-Bug gefunden, vielleicht im Thread-Management; wegen snd_play? Kann man single-thread erzwingen? Oder seh ich hier was grundsaetzliches nicht?
Last edited by irchel2; 09/30/13 15:11.
|
|
|
Re: Engine crasht ohne Grund
[Re: irchel2]
#430655
09/30/13 15:49
09/30/13 15:49
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Kann man single-thread erzwingen? Ja. Einfach nichts tun. Die Engine arbeitet immer nur mit einem Thread. Leider zeigst Du ja nur einen Teil Deines Codes. Was passiert denn nach dem Label "restartto" ? Goto ist übrigens Teufelszeugs. Wenn es geht, solltest Du das vermeiden. wait(30) wartet übrigens 30 frames. Du willst aber doch sicher eine bestimmte Zeitspanne warten, oder?
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Engine crasht ohne Grund
[Re: irchel2]
#430661
09/30/13 16:58
09/30/13 16:58
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Ganz grob: Mit Schleifen, Funktionen usf. kannst Du dein Programm wunderbar strukturieren. Goto bewirkt leider das Gegenteil, weil die Struktur des Quellcodes dann dem späteren Programmfluß nicht mehr entspricht.
Es gibt Tonnen von Stoff online dazu...
Das Problem bleibt aber. Du zeigst nicht deinen kompletten Code. Du hast auch nicht geschrieben, was Du denn mit "crashen" meinst...
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|