Ich habe wieder ne Frage wegen entitycollided!
Übersicht

sven123Betreff: Ich habe wieder ne Frage wegen entitycollided! |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Also ich hab jetzt nen paar Gegner die herumfliegen und einen Code der sie löschen soll wenn sie von den schüssen getroffen werden.Am Code an sich stimmt auch alles aber es funtzt trotzdem nicht!Die blöden Gegner wollen nicht verschwinden.
Der code für die Gegner mit der lösch routine(ist bei der funktion bewegen das Unterste) Code: [AUSKLAPPEN] ;Erstellen der Dronen
Function BuildDronen(Modell) PositionEntity Modell,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType Modell,13 For f=1 To 150 D.Drone=New Drone D\anzahl=-10 D\Modelle=CopyEntity(Modell) PositionEntity D\Modelle,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType D\Modelle,13 Next End Function ;Bewegung der Dronen Function bewegen(Modell) If strecke<=0 Then MoveEntity Modell,-30,0,0 strecke=strecke+1 EndIf If strecke=>0 And strecke<300 Then RotateEntity Modell,0,180,0 MoveEntity Modell,-30,0,0 strecke=strecke+1 EndIf If strecke=>300 Then RotateEntity Modell,0,360,0 MoveEntity Modell,-30,0,0 strecke=strecke+1 If strecke=>600 Then strecke=-10 EndIf For D.Drone=Each Drone If D\anzahl<=0 Then MoveEntity D\Modelle,-30,0,0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>0 And D\anzahl<300 Then RotateEntity D\Modelle,0,180,0 MoveEntity D\Modelle,-30,0,0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>300 Then RotateEntity D\Modelle,0,360,0 MoveEntity D\Modelle,-30,0,0 D\anzahl=D\anzahl+1 If D\anzahl=>600 Then D\anzahl=-10 EndIf If EntityCollided(D\Modelle,11) Then FreeEntity D\Modelle : Delete D Next So und hier die Schussroutine,beide funktionen werden ine einer Repeatschleife aufgerufen. Code: [AUSKLAPPEN] ;erstellt ein sprite
Function add_bullet(sprite,max_life,speed#,cam) b.bullets=New bullets b\sprite=CopyEntity (sprite) EntityFX sprite,16 EntityType b\sprite,11 EntityRadius b\sprite,5 b\max_life=120 b\speed#=speed# PositionEntity b\sprite,EntityX(cam),EntityY(cam),EntityZ(cam) RotateEntity b\sprite,EntityPitch(cam),EntityYaw(cam),EntityRoll(cam) RotateSprite b\sprite,angelsprite If angelsprite > 360 Then angelsprite=0 angelsprite=angelsprite+80 ShowEntity b\sprite End Function ; ;bewegt die sprites Function move_bullets() For b.bullets=Each bullets MoveEntity b\sprite,0,0,b\speed# b\life=b\life+1 If b\life>b\max_life Then FreeEntity b\sprite : Delete b Next End Function Entschuldigt bitte die Unordnung im Code(das ist mein Stil ![]() |
||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
- Zuletzt bearbeitet von sven123 am Fr, Jan 07, 2005 18:07, insgesamt einmal bearbeitet
![]() |
Artemis |
![]() Antworten mit Zitat ![]() |
---|---|---|
nurn tipp.
vielleicht fragste mal nen admin ob der deinen Thread in das BB3D-Forum verschiebt! vielleicht bekommst du da mehr antworten. ![]() Ich kann kein BB3D also kann ich dir keine Antwort geben. ![]() Du solltest trotzdem deinen Code mal Ordnen. SOnst steigt da keiner durch!! zb.: Code: [AUSKLAPPEN] For f=1 To 150 D.Drone=New Drone D\anzahl=-10 D\Modelle=CopyEntity(Modell) PositionEntity D\Modelle,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType D\Modelle,13 Next ich (und die mesiten andern wohl auch) wüde das so einrücken: Code: [AUSKLAPPEN] For f=1 To 150 D.Drone=New Drone D\anzahl=-10 D\Modelle=CopyEntity(Modell) PositionEntity D\Modelle,Rnd#(2000,5000),Rnd#(1000,5000),Rnd# (3000,9000) EntityType D\Modelle,13 Next ------------------- Zitat: Entschuldigt bitte die Unordnung im Code(das ist mein Stil ![]() |
||
xperience2003Betreff: ... |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
@JonasCleve
dann poste net, wenn du keine antwort geben kannst^^ @mod please delete my post ![]() |
||
![]() |
dimaster |
![]() Antworten mit Zitat ![]() |
---|---|---|
lädst du die functionen in der while schleife oder vorher? | ||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Also die funktion buildDrone lade ich vor der repeat Schleife,die funktion mit der der Schuss bewegt wird und,die Funktion mit der die Drone bewegt wird starte ich in der repeat Schleife! | ||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Wahrscheinlich hast du einfach keine Kollision. Hast du auch irgendwo collisions....? | ||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Jo davor habe ich collisions.Aber wenn es weiter Hilft kann ich auch mal den ganzen Code Posten. | ||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Mach doch in dein Entitycollided... mal ein Playsound irgendwas.wav, um sicherzugehen, ob du eine Kollision 'hörst'. | ||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich habs mir end versucht,dann müsste sich das Programm ja bei einer colli Beenden hat aber auch nicht gefuntzt.Ich poste jetzt mal den gesamten code.
Code: [AUSKLAPPEN] Graphics3D 800,600,0,1 AppTitle "Rammjäger" HidePointer SetBuffer BackBuffer() SeedRnd MilliSecs() Locate 350,250 Print "Load..." ;Laden der Texturen und Meshs terrain=LoadTerrain("f:\Grassclip.bmp") text1=LoadTexture("f:\wuestensand1.jpg") text2=LoadTexture("f:\Wasser.jpg") metallpyramide=LoadMesh("f:\pyramide.x") Burg=LoadMesh("f:\Burg.x") himmel=LoadTexture("f:\himmel2.jpg") GegnerDrone=LoadMesh("f:\Plakat.3ds") cockpit=LoadImage("f:\rearcockpit1.bmp") Fadenkreutz=LoadImage("f:\Fadenkreutz.bmp") sprite=LoadSprite("f:\Kugel.bmp") Buttonja=LoadImage("F:\weiter.bmp") ButtonjaAn=LoadImage("F:\weiteran.bmp") ButtonNein=LoadImage("F:\Ende.bmp") ButtonNeinan=LoadImage("F:\Endean.bmp") Tod=LoadImage("f:\gesplitert.bmp") teen=LoadSound("F:\Azan-Masjidil-Haram.mp3") Lavahaus=LoadMesh("f:\Lavahaus.x") haus=LoadMesh("f:\haus.x") ;Sprites ScaleSprite sprite,15,15 HideEntity sprite ;Type Schuss Type bullets Field sprite Field life Field speed# Field max_life End Type ; Type Drone Field Modelle Field life Field zufall Field anzahl End Type loft=CreatePlane() ;Globals Global xButtonja=100 Global yButtonja=300 Global xButtonNein=550 Global yButtonNein=310 Global sperre=0 Global sperre2=0 Global sperre1=0 Global GameOver=0 Global steuerung=0 Global strecke=-10 Global an=0 Global ColG=6 Global ColSchuss=7 Global ColDronen=8 ;Himmel richtig drehen sky=CreateSphere(100) FlipMesh sky ScaleEntity sky,5500,7000,5500 PositionEntity sky,6500,1000,6800 ; PositionEntity Lavahaus,5000,2,3000 PositionEntity haus,7000,2,5000 ;Metallpyramide PositionEntity metallpyramide,5000,20,7800 EntityShininess metallpyramide,1 ;Bäume Baeume(25,ColG,8000,5,9000,3000,10000,5,2000,10000) ;Dronen BuildDronen(GegnerDrone) ; ;Häuser Positionieren Haus1(5,ColG,9000,2,5000,6000,9900,2,4000,6000) ;Burg PositionEntity Burg,5000,-5,8000 ;Das Terrain erstellen und Texturieren EntityTexture loft,text2 PositionEntity loft,0,-300,0 EntityTexture terrain,text1,0,0 ScaleEntity terrain,50,200,50 ScaleTexture text1,50,50 TerrainDetail terrain,8000,True ;Die Textur des Himmels bearbeiten und verwenden EntityTexture sky,himmel ;;;;;;;;;;;;;;;;;;;;;;;;;;------Die Eintsellung der Kamera auf Firstpersonsicht sicht ;; ;; ;Kameravoreinstellungen cam=CreateCamera() PositionEntity cam,5100,2050,8075 EntityRadius cam,5 ; CameraRange cam,1,80000 light=CreateLight() LightRange light,80000 EntityParent light,cam TurnEntity cam,10,106,0 PositionEntity cam,3007,4025,5845 TurnEntity cam,270,0,270 ;Kollisionsabfrage EntityType cam,1 EntityType terrain,2 EntityType Burg,ColG EntityType metallpyramide,ColG EntityType sky,5 EntityType Lavahaus,ColG EntityType haus,ColG ; Collisions 1,2,2,1 Collisions 1,ColG,2,1 Collisions 1,ColG,2,1 Collisions 1,5,2,1 Collisions 1,ColG,2,1 Collisions 1,ColG,2,1 Collisions 1,ColG,2,1 Collisions 1,ColG,2,1 ; EntityOrder sky,1 ;Steuerung des Spielers ;;;;;;;;;;;;;;;;;;;;-------Hauptschleife Repeat muezzin(teen) If EntityCollided(cam,2) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf ;Mausabfrage und Steuerung If steuerung=0 Then steuerung(cam,200,0,205,203,-20,20,20) Fall(cam,3.485,2000,1.25,9.812,2,200) EndIf Cls If MouseHit(1) Then add_bullet(sprite,40,40,cam) ;Bewegung der Schüsse move_bullets() bewegen(GegnerDrone) If KeyDown(1) Then End UpdateWorld RenderWorld If GameOver=1 Then Ende(Buttonja,ButtonjaAn,ButtonNein,ButtonNeinan,Tod,cam) EndIf ; MaskImage cockpit,128,128,255 DrawImage Fadenkreutz,375,279 DrawImage cockpit,0,380 screenshot(25) Flip Until KeyDown(1) End ClearWorld End ;Funktionen ;Erstellen der Dronen Function BuildDronen(Modell) PositionEntity Modell,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType Modell,ColDronen For f=1 To 150 D.Drone=New Drone D\anzahl=-10 D\Modelle=CopyEntity(Modell) EntityType D\Modelle,ColDronen PositionEntity D\Modelle,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) Next End Function ;Bewegung der Dronen Function bewegen(Modell) If strecke<=0 Then MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 EndIf If strecke=>0 And strecke<300 Then RotateEntity Modell,0,180+Rnd#(8,-8),0 MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 EndIf If strecke=>300 Then RotateEntity Modell,0,360,0 MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 If strecke=>600 Then strecke=-10 EndIf For D.Drone=Each Drone If D\anzahl<=0 Then MoveEntity D\Modelle,-30,0+Rnd#(10,-10),0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>0 And D\anzahl<300 Then RotateEntity D\Modelle,0,180+Rnd#(8,-8),0 MoveEntity D\Modelle,-30,0,0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>300 Then RotateEntity D\Modelle,0,360,0 MoveEntity D\Modelle,-30,0+Rnd#(10,-10),0 D\anzahl=D\anzahl+1 If D\anzahl=>600 Then D\anzahl=-10 EndIf If EntityCollided(D\Modelle,ColSchuss) Then FreeEntity D\Modelle : Delete D Next End Function ;erstellt ein sprite Function add_bullet(sprite,max_life,speed#,cam) b.bullets=New bullets b\sprite=CopyEntity (sprite) EntityFX sprite,16 EntityRadius b\sprite,500 EntityType b\sprite,ColSchuss b\max_life=120 b\speed#=speed# PositionEntity b\sprite,EntityX(cam),EntityY(cam),EntityZ(cam) RotateEntity b\sprite,EntityPitch(cam),EntityYaw(cam),EntityRoll(cam) RotateSprite b\sprite,angelsprite If angelsprite > 360 Then angelsprite=0 angelsprite=angelsprite+80 ShowEntity b\sprite End Function ; ;bewegt die sprites Function move_bullets() For b.bullets=Each bullets MoveEntity b\sprite,0,0,b\speed# b\life=b\life+1 If b\life>b\max_life Then FreeEntity b\sprite : Delete b Next End Function ;Bäume setzen Function Baeume(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Baumstumpf=LoadMesh("f:\Baumstumpf.x") PositionEntity Baumstumpf,realPositionx,realPositiony,realPositionz For a=1 To anzahl Baum=CopyEntity (Baumstumpf) PositionEntity Baum,Rnd#(copyPositionrndx1,copyPositionrndx2),constanty,Rnd#(copyPositionrndz1,copyPositionrndz2) EntityType Baum,collisionNumber EntityType Baumstumpf,collisionNumber Next End Function ;Screenshots Function screenshot(key) If KeyHit(key)=1 Then tasten=1 SaveBuffer BackBuffer(),"F:\Screenshots.bmp" tasten=0 EndIf End Function ;Steuerung Function steuerung(entity,oben,unten,rechts,links,lspeed,rspeed,zspeed) RotateEntity entity,EntityPitch(entity)+MouseYSpeed(),EntityYaw(entity)-MouseXSpeed(),0 If KeyDown(oben)=1 Then MoveEntity entity,0,0,zspeed If KeyDown(links)=1 Then MoveEntity entity,lspeed,0,0 If KeyDown(rechts)=1 Then MoveEntity entity,rspeed,0,0 End Function ;Fall mit Luftreibung Function Fall(Objekt,cw#,OG#,LD#,g#,AO#,up) G1#=0.5*cw#*LD#*AO# G2#=OG*g Ggesamt#=G2#/G1# Fall#=Ggesamt#^0.5 If Not KeyDown(up) Then MoveEntity Objekt,0,-Fall#,0 End Function ;End Funktion Function Ende(B1,B2,B3,B4,B5,Modell) MaskImage B5,255,255,255 If GameOver=1 Then DrawImage B5,0,0 ;Anzeigen von 2 Buttons z.B ja und nein!!!!!! If sperre=0 Then DrawImage B2,xButtonja,yButtonja DrawImage B3,xButtonNein,yButtonNein If KeyDown(57) Then GameOver=0 steuerung=0 PositionEntity Modell,5100,2050,8075 PositionEntity Modell,3007,4025,5845 TurnEntity Modell,10,106,0 TurnEntity Modell,270,0,27 EndIf EndIf ;Makierung der Buttons bei Tastendruck If KeyDown(205) Then sperre1=1 sperre=1 sperre2=0 EndIf If KeyDown(203) Then sperre2=1 sperre=1 sperre1=0 EndIf If sperre=1 Then DrawImage B1,xButtonja,yButtonja DrawImage B4,xButtonNein,yButtonNein If KeyDown(28)=1 And sperre1=1 Then End EndIf If sperre2=1 Then DrawImage B2,xButtonja,yButtonja DrawImage B3,xButtonNein,yButtonNein ;Neustart des Games durch Variabelen zurücksetzen If KeyDown(28)=1 And sperre2=1 Then GameOver=0 steuerung=0 PositionEntity Modell,5100,2050,8075 PositionEntity Modell,3007,4025,5845 TurnEntity Modell,10,106,0 TurnEntity Modell,270,0,27 EndIf EndIf EndIf End Function ;Gebäude setzen Function Haus1(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Gebaude=LoadMesh("f:\house.x") PositionEntity Gebaude,realPositionx,realPositiony,realPositionz For a=1 To anzahl Hauser=CopyEntity (Gebaude) PositionEntity Hauser,Rnd#(copyPositionrndx1,copyPositionrndx2),constanty,Rnd#(copyPositionrndz1,copyPositionrndz2) EntityType Hauser,collisionNumber EntityType Hauser,collisionNumber Next End Function ;Muezzin Function muezzin(sound) Zeit$=CurrentTime() If Zeit$="7:21:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="9:16:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="13:29:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="15:24:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="17:41:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="19:30:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf End Function |
||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Überprüf mal deine collisions.
Du hast nur collisions 1 (cam) mit irgendwas! Was fehlt sind andere collisions. Ausserdem brauchst du nicht 6 mal collisions cam mit ColG, sondern nur 1 mal. Ausserdem beendet er nicht, wenn du in deine Kollisionsabfrage ein Playsound einbaust. If entitycollided...then playsound x.wav : usw... Ist ein gutes Mittel, um zu prüfen, ob dein Programm durch irgendeine Routine überhaupt durchgeht. |
||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ne ich hatte vorher (end) als Befehl eingesetzt.Jetzt habe ich es so gemacht wie du sagtest ich habe einen sound in die Schleife eingebunden,auserdem hattest du recht es kommt zur keiner Kollision,dass wundert mich aber.Auserdem habe ich jetzt nur eine Kollisions abfrage mit ColG und der Cam.Aber irgendwie funtzt die Sache immer noch nicht warum. | ||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Wieso wundert dich das, du hast ja nur collisions cam mit irgendwas.
Dann kann dein D\Modelle ja schlecht kollidieren. Du brauchst also noch collisions coldronen mit colschuss. Also: collisions coldronen,colschuss,2,1 bei deinen collisions. Insgesamt scheint mir, du solltest dir die Kollisionen nochmal an einem einfachen Beispiel ansehen. So ganz verstanden hast du dieses Gebiet wohl noch nicht... ![]() |
||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Geht immer noch nicht Ich hab jetzt collisions,ColSchuss,ColDronen,2,1
eingefügt,auserdem wollte ich ja das die Kollision mit entitycollided geprüft wird und nicht mit Collisions,die beiden Befehle arbeiten ja nicht zusammen. |
||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
So ich habe meinen Code noch mal mit allen eueren Vorschlägen überarbeite,doch die Kollision mit entitycollided funktioniert immer noch nicht.Sorry das ich noch mal den ganzen Code Poste aber da ich eineige kleinere Änderungen gemacht habe,denke ich das es ganz sinvoll ist.Code: [AUSKLAPPEN] Graphics3D 800,600,0,1
AppTitle "Rammjäger" HidePointer SetBuffer BackBuffer() SeedRnd MilliSecs() Locate 350,250 Print "Load..." ;Laden der Texturen und Meshs terrain=LoadTerrain("f:\Grassclip.bmp") text1=LoadTexture("f:\wuestensand1.jpg") text2=LoadTexture("f:\Wasser.jpg") metallpyramide=LoadMesh("f:\pyramide.x") Burg=LoadMesh("f:\Burg.x") himmel=LoadTexture("f:\himmel2.jpg") GegnerDrone=LoadMesh("f:\Plakat.3ds") cockpit=LoadImage("f:\rearcockpit1.bmp") Fadenkreutz=LoadImage("f:\Fadenkreutz.bmp") sprite=LoadSprite("f:\Kugel.bmp") Buttonja=LoadImage("F:\weiter.bmp") ButtonjaAn=LoadImage("F:\weiteran.bmp") ButtonNein=LoadImage("F:\Ende.bmp") ButtonNeinan=LoadImage("F:\Endean.bmp") Tod=LoadImage("f:\gesplitert.bmp") teen=LoadSound("F:\Azan-Masjidil-Haram.mp3") Lavahaus=LoadMesh("f:\Lavahaus.x") haus=LoadMesh("f:\haus.x") ;Sprites ScaleSprite sprite,15,15 HideEntity sprite ;Type Schuss Type bullets Field sprite Field life Field speed# Field max_life End Type ; Type Drone Field Modelle Field life Field zufall Field anzahl End Type loft=CreatePlane() ;Globals Global xButtonja=100 Global yButtonja=300 Global xButtonNein=550 Global yButtonNein=310 Global sperre=0 Global sperre2=0 Global sperre1=0 Global GameOver=0 Global steuerung=0 Global strecke=-10 Global an=0 Global ColG=6 Global ColSchuss=7 Global ColDronen=8 ;Himmel richtig drehen sky=CreateSphere(100) FlipMesh sky ScaleEntity sky,5500,7000,5500 PositionEntity sky,6500,1000,6800 ; PositionEntity Lavahaus,5000,2,3000 PositionEntity haus,7000,2,5000 ;Metallpyramide PositionEntity metallpyramide,5000,20,7800 EntityShininess metallpyramide,1 ;Bäume Baeume(25,ColG,8000,5,9000,3000,10000,5,2000,10000) ;Dronen BuildDronen(GegnerDrone) ; ;Häuser Positionieren Haus1(5,ColG,9000,2,5000,6000,9900,2,4000,6000) ;Burg PositionEntity Burg,5000,-5,8000 ;Das Terrain erstellen und Texturieren EntityTexture loft,text2 PositionEntity loft,0,-300,0 EntityTexture terrain,text1,0,0 ScaleEntity terrain,50,200,50 ScaleTexture text1,50,50 TerrainDetail terrain,8000,True ;Die Textur des Himmels bearbeiten und verwenden EntityTexture sky,himmel ;;;;;;;;;;;;;;;;;;;;;;;;;;------Die Eintsellung der Kamera auf Firstpersonsicht sicht ;; ;; ;Kameravoreinstellungen cam=CreateCamera() PositionEntity cam,5100,2050,8075 EntityRadius cam,5 ; CameraRange cam,1,80000 light=CreateLight() LightRange light,80000 EntityParent light,cam TurnEntity cam,10,106,0 PositionEntity cam,3007,4025,5845 TurnEntity cam,270,0,270 ;Kollisionsabfrage EntityType cam,1 EntityType terrain,2 EntityType Burg,ColG EntityType metallpyramide,ColG EntityType sky,5 EntityType Lavahaus,ColG EntityType haus,ColG ; Collisions 1,2,2,1 Collisions 1,ColG,2,1 Collisions 1,5,2,1 Collisions ColSchuss,ColDronen,2,3 ; EntityOrder sky,1 ;Steuerung des Spielers ;;;;;;;;;;;;;;;;;;;;-------Hauptschleife Repeat muezzin(teen) If EntityCollided(cam,2) GameOver=1 steuerung=1 EndIf If EntityCollided(cam,ColG) GameOver=1 steuerung=1 EndIf ;Mausabfrage und Steuerung If steuerung=0 Then steuerung(cam,200,0,205,203,-20,20,20) Fall(cam,3.485,2000,1.25,9.812,2,200) EndIf Cls If MouseHit(1) Then add_bullet(sprite,40,40,cam) ;Bewegung der Schüsse move_bullets() bewegen(GegnerDrone) If KeyDown(1) Then End UpdateWorld RenderWorld If GameOver=1 Then Ende(Buttonja,ButtonjaAn,ButtonNein,ButtonNeinan,Tod,cam) EndIf ; MaskImage cockpit,128,128,255 DrawImage Fadenkreutz,375,279 DrawImage cockpit,0,380 screenshot(25) Flip Until KeyDown(1) End ClearWorld End ;Funktionen ;Erstellen der Dronen Function BuildDronen(Modell) PositionEntity Modell,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType Modell,ColDronen For f=1 To 150 D.Drone=New Drone D\anzahl=-10 D\Modelle=CopyEntity(Modell) PositionEntity D\Modelle,Rnd#(2000,5000),Rnd#(1000,5000),Rnd#(3000,9000) EntityType D\Modelle,ColDronen EntityRadius D\Modelle,5 Next End Function ;Bewegung der Dronen Function bewegen(Modell) If strecke<=0 Then MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 EndIf If strecke=>0 And strecke<300 Then RotateEntity Modell,0,180+Rnd#(8,-8),0 MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 EndIf If strecke=>300 Then RotateEntity Modell,0,360,0 MoveEntity Modell,-30,0+Rnd#(10,-10),0 strecke=strecke+1 If strecke=>600 Then strecke=-10 EndIf For D.Drone=Each Drone If D\anzahl<=0 Then MoveEntity D\Modelle,-30,0+Rnd#(10,-10),0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>0 And D\anzahl<300 Then RotateEntity D\Modelle,0,180+Rnd#(8,-8),0 MoveEntity D\Modelle,-30,0,0 D\anzahl=D\anzahl+1 EndIf If D\anzahl=>300 Then RotateEntity D\Modelle,0,360,0 MoveEntity D\Modelle,-30,0+Rnd#(10,-10),0 D\anzahl=D\anzahl+1 If D\anzahl=>600 Then D\anzahl=-10 EndIf If EntityCollided(D\Modelle,ColSchuss) Then FreeEntity D\Modelle:Delete D Next End Function ;erstellt ein sprite Function add_bullet(sprite,max_life,speed#,cam) b.bullets=New bullets b\sprite=CopyEntity (sprite) EntityFX sprite,16 b\max_life=120 b\speed#=speed# EntityType b\sprite,ColShuss EntityRadius b\sprite,5 PositionEntity b\sprite,EntityX(cam),EntityY(cam),EntityZ(cam) RotateEntity b\sprite,EntityPitch(cam),EntityYaw(cam),EntityRoll(cam) RotateSprite b\sprite,angelsprite If angelsprite > 360 Then angelsprite=0 angelsprite=angelsprite+80 ShowEntity b\sprite End Function ; ;bewegt die sprites Function move_bullets() For b.bullets=Each bullets MoveEntity b\sprite,0,0,b\speed# b\life=b\life+1 If b\life>b\max_life Then FreeEntity b\sprite : Delete b Next End Function ;Bäume setzen Function Baeume(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Baumstumpf=LoadMesh("f:\Baumstumpf.x") PositionEntity Baumstumpf,realPositionx,realPositiony,realPositionz For a=1 To anzahl Baum=CopyEntity (Baumstumpf) PositionEntity Baum,Rnd#(copyPositionrndx1,copyPositionrndx2),constanty,Rnd#(copyPositionrndz1,copyPositionrndz2) EntityType Baum,collisionNumber EntityType Baumstumpf,collisionNumber Next End Function ;Screenshots Function screenshot(key) If KeyHit(key)=1 Then tasten=1 SaveBuffer BackBuffer(),"F:\Screenshots.bmp" tasten=0 EndIf End Function ;Steuerung Function steuerung(entity,oben,unten,rechts,links,lspeed,rspeed,zspeed) RotateEntity entity,EntityPitch(entity)+MouseYSpeed(),EntityYaw(entity)-MouseXSpeed(),0 If KeyDown(oben)=1 Then MoveEntity entity,0,0,zspeed If KeyDown(links)=1 Then MoveEntity entity,lspeed,0,0 If KeyDown(rechts)=1 Then MoveEntity entity,rspeed,0,0 End Function ;Fall mit Luftreibung Function Fall(Objekt,cw#,OG#,LD#,g#,AO#,up) G1#=0.5*cw#*LD#*AO# G2#=OG*g Ggesamt#=G2#/G1# Fall#=Ggesamt#^0.5 If Not KeyDown(up) Then MoveEntity Objekt,0,-Fall#,0 End Function ;End Funktion Function Ende(B1,B2,B3,B4,B5,Modell) MaskImage B5,255,255,255 If GameOver=1 Then DrawImage B5,0,0 ;Anzeigen von 2 Buttons z.B ja und nein!!!!!! If sperre=0 Then DrawImage B2,xButtonja,yButtonja DrawImage B3,xButtonNein,yButtonNein If KeyDown(57) Then GameOver=0 steuerung=0 PositionEntity Modell,5100,2050,8075 PositionEntity Modell,3007,4025,5845 TurnEntity Modell,10,106,0 TurnEntity Modell,270,0,27 EndIf EndIf ;Makierung der Buttons bei Tastendruck If KeyDown(205) Then sperre1=1 sperre=1 sperre2=0 EndIf If KeyDown(203) Then sperre2=1 sperre=1 sperre1=0 EndIf If sperre=1 Then DrawImage B1,xButtonja,yButtonja DrawImage B4,xButtonNein,yButtonNein If KeyDown(28)=1 And sperre1=1 Then End EndIf If sperre2=1 Then DrawImage B2,xButtonja,yButtonja DrawImage B3,xButtonNein,yButtonNein ;Neustart des Games durch Variabelen zurücksetzen If KeyDown(28)=1 And sperre2=1 Then GameOver=0 steuerung=0 PositionEntity Modell,5100,2050,8075 PositionEntity Modell,3007,4025,5845 TurnEntity Modell,10,106,0 TurnEntity Modell,270,0,27 EndIf EndIf EndIf End Function ;Gebäude setzen Function Haus1(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Gebaude=LoadMesh("f:\house.x") PositionEntity Gebaude,realPositionx,realPositiony,realPositionz For a=1 To anzahl Hauser=CopyEntity (Gebaude) PositionEntity Hauser,Rnd#(copyPositionrndx1,copyPositionrndx2),constanty,Rnd#(copyPositionrndz1,copyPositionrndz2) EntityType Hauser,collisionNumber EntityType Hauser,collisionNumber Next End Function ;Muezzin Function muezzin(sound) Zeit$=CurrentTime() If Zeit$="7:21:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="9:16:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="13:29:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="15:24:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="17:41:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf If Zeit$="19:30:00" Then If an=0 Then PlaySound(sound) an=1 EndIf EndIf End Function |
||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
??? wieso arbeiten die Befehle nicht zusammen?
Ich habe die Kollisionen immer so verstanden, dass 1. die zu überprüfenden entitys einen Kollisionstyp (eine Nummer) erhalten 2. ich mit collisions die zu überprüfenden entities, die Kollisionserkennungsmethode und die Kollisionsreaktion festlege 3. updateworld() erfolgt 3. ich danach Einzelheiten einer eventuellen Kollision mit entitycollided oder collisionsurface usw. auslesen und darauf reagieren kann. Ohne collisions.... soll das auch gehen? Ich hab übrigens auch vorgeschlagen collisions ColDronen, colschuss,2,1, du hast aber collisions colschuss, coldronen,.... Vielleicht geht's aber auch so rum... |
||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Danke für die Hilfe ich hab bei collisions jetzt die Typen umgedreht.Geht aber trotzdem nicht!Warum? | ||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Dann probier mal Colschuss bei add_bullet und nicht Colshuss.
Wenn's das war, krieg ich ein Bier ![]() |
||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ups ![]() |
||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich gebe auf.
Um es im Kopf richtig nachzuvollziehen, ist mir das Programm schon zu kompliziert (mit den ganzen Parameterübergaben usw.). Da muss man das Programm laufen lassen können, um zu suchen und zu finden... Tut mir leid. ![]() |
||
sven123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
@Gehard ich suche jetzt noch mal den Fehler vieleicht finde ich ihn jetzt ja, wenn nicht könnte ich dir ja eine Version erstellen die du dann runterladen kannst,mit allen models und so. | ||
Amd Athlon 2200+,Saphire Atlantis Radeon9800pro,1024 MB DDR RAm,40 Gb Festblatte.
'in shâ'a llâh=so Gott will Fertiges Projekt:Invasion der Heuschrecken |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group