Guck dich mal auf www.robsite.de um da soltest du einige antworten finden.Oder such mal im Code Archiv.Hier das ist ein Grundgerüst,das ich mal gecodet habe, mit allen wichtigen Funktionen die du benötigst.
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN]
skybox(Elemente,gx,gy,gz,px,py,pz,Textur,collsky) Baeume(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Haus1(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2)
Repeat steuerung(entity,oben,unten,rechts,links,lspeed,rspeed,zspeed) Fall(Objekt,cw#,OG#,LD#,g#,AO#,up) If KeyDown(57) Then add_bullet(sprite,max_life,speed#,cam) move_bullets() Until KeyDown(1) End
Function skybox(Elemente,gx,gy,gz,px,py,pz,Textur,collsky) sky=CreateSphere(Elemente) FlipMesh sky ScaleEntity sky,gx,gy,gz PositionEntity sky,px,py,pz EntityTexture sky,Textur EntityType sky,collsky EntityOrder sky,1 Collisions camcoll,collsky,2,1 End Function
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,ColSchuss EntityRadius b\sprite,10 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+10 ShowEntity b\sprite End Function
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
Function Baeume(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Baumstumpf=LoadMesh(\"H:\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
Function screenshot(key) If KeyHit(key)=1 Then tasten=1 SaveBuffer BackBuffer(),\"H:\Screenshots.bmp\" tasten=0 EndIf End Function
Function steuerung(entity,oben,unten,rechts,links,lspeed,rspeed,zspeed) mxs=MouseXSpeed() mys=MouseYSpeed() MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 RotateEntity entity,EntityPitch(entity)+mys,EntityYaw(entity)-mxs,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
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
Function Ende(B1,B2,B3,B4,B5,Modell) MaskImage B5,255,255,255 If GameOver=1 Then DrawImage B5,0,0
If sperre=0 Then DrawImage B2,xButtonja,yButtonja DrawImage B3,xButtonNein,yButtonNein If KeyDown(28) And sperre=0 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
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
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
Function Haus1(anzahl,collisionNumber,realPositionx,realPositiony,realPositionz,copyPositionrndx1,copyPositionrndx2,constanty,copyPositionrndz1,copyPositionrndz2) Gebaude=LoadMesh(\"H:\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
|