Wieder einmal schussproblem -.-
Übersicht

HoneschBetreff: Wieder einmal schussproblem -.- |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ich weiß, dass es zu diesem thema schon viele threads gibt, doch bin ich noch immer zu keiner Lösung gekommen ![]() mein problem ist, dass ich einen schuss erstelle, dieser sich auch in die gewünschte richtung bewegt, aber sobald ich einen neuen schuss abfeuere, der alte in der luft stehn bleibt ?! hier einmal der codeausschnitt Code: [AUSKLAPPEN] Type shot Field x Field y Field z End Type If MouseHit(1) Then schuss_count=schuss_count+1 If schuss_count=100 schuss_count=0 EndIf fire.shot=New shot fire\x=EntityX(player) fire\y=EntityY(player)+140 fire\z=EntityZ(player) shot_cone=CreateCone(10) EntityType shot_cone,typ_shot ScaleEntity shot_cone,10,10,10 PositionEntity shot_cone,fire\x,fire\y,fire\z TurnEntity shot_cone,EntityPitch(camera),EntityYaw(player),0 EntityColor shot_cone,0,255,0 EndIf For fire.shot=Each shot MoveEntity shot_cone,0,0,shot_speed# If EntityCollided (shot_cone,typ_welt) Then Delete fire EndIf Next |
||
Das Leben ist wie ein Computerspiel. Scheiß Handlung aber geile Grafik ! |
Omenaton_2 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Mach den Shot_Cone (Entity) auch zum Teil des Types !
Type shot Field x Field y Field z Field Shot_Cone End Type Ersetze überall Shot-Cone mit fire\Shot_Cone. Dann bist du erstmal ein Stück weiter. |
||
Honesch |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
es funzt ! danke ![]() ![]() ![]() ![]() ![]() ![]() |
||
Das Leben ist wie ein Computerspiel. Scheiß Handlung aber geile Grafik ! |
Honesch |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
und kann ich das machen dass der schuss nach einer gewissen zeit verschwindet ? ich hab versucht ihm eine variable lifetime mitzugeben, wenn diese 0 ist, dass soll er verschwinden, damit sie nicht ewig in der welt herumfliegt und den speicher füllt...mein code sieht so aus:
Code: [AUSKLAPPEN] Type shot Field x Field y Field z Field shot_cone Field birthtime Field shotspeed_cone End Type schuss_count=schuss_count+1 If schuss_count=100 schuss_count=0 EndIf fire.shot=New shot fire\x=EntityX(player) fire\y=EntityY(player)+140 fire\z=EntityZ(player) fire\shot_cone=CreateCone(10) fire\birthtime=0 schuss_count=schuss_count+1 If schuss_count=100 schuss_count=0 EndIf fire.shot=New shot fire\x=EntityX(player) fire\y=EntityY(player)+140 fire\z=EntityZ(player) fire\shot_cone=CreateCone(10) fire\birthtime=0 EntityType fire\shot_cone,typ_shot ScaleEntity fire\shot_cone,10,10,10 PositionEntity fire\shot_cone,fire\x,fire\y,fire\z TurnEntity fire\shot_cone,EntityPitch(camera),EntityYaw(player),0 EntityColor fire\shot_cone,0,255,0 For fire.shot=Each shot fire\birthtime=fire\birthtime+1 MoveEntity fire\shot_cone,0,0,shot_speed# If EntityCollided (fire\shot_cone,typ_welt) Or fire\birthtime=100 FreeEntity fire\shot_cone Delete fire EndIf Next |
||
Das Leben ist wie ein Computerspiel. Scheiß Handlung aber geile Grafik ! |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du kannst nach der erstellung des Types die Zeit in einer Variable ablegen...
fire\birthtime= millisecs() + X, Wobei X die Zeit ist, die es existieren soll. Sobald Millisecs > fire\birthtime, ist die Zeit abgelaufen - so gehe ich meist vor. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group