mach 1 aus 2 aber wie

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

 

phpmännchen

Betreff: mach 1 aus 2 aber wie

BeitragSo, Sep 17, 2006 18:06
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo, wer kann mir helfen diese zwei Code zusammen zu stricken?



Code: [AUSKLAPPEN]

Graphics3D 1024,768,32,1
SetBuffer BackBuffer()
WBuffer 0
HidePointer


Const game_pause = 1
Const game_menue = 2
Const game_haupt = 3
Const game_over  = 4

Global game_zustand = game_menue



;--------------------------------------------------------------------------------------------------------------
;---Hier kommen alle Globalen Variablen hin-------------------------------



;-----------------------------------------------------------------------
;Für das Menue

Global kanal = PlayMusic("start.mp3")

Global Maus = LoadImage("maus.png")
Global bildvariable = LoadImage("1.bmp")
Global menu = LoadImage("menu1.png")
Global castle=LoadMesh("castle\castle1.x")

Global Wahl = 0
Global mh_1
Global Mx,My

;------------------------------------------------------------------------
;Für das Hauptprogramm




; Kamrea und so einrichten
Global main_pivot = CreatePivot()
Global cam = CreateCamera(main_pivot)
PositionEntity cam,356,0,460
RotateEntity cam,0,180,0
CameraRange cam,1,900
CameraFogMode cam,1
CameraFogRange cam,150,300
CameraFogColor cam,190,210,245
EntityType cam, 2
MoveEntity cam,0,5,-3
TurnEntity cam,20,0,0



; Skybox laden
Global skybox = LoadSkyBox(main_pivot)

; Licht setzen
Global main_light = CreateLight()
MoveEntity main_light,20,50,0
PointEntity main_light, main_pivot

; Terrain erstellen
Global ter = LoadTerrain("gfx/hmap2.bmp")
ScaleEntity ter,20,50,20
TerrainDetail ter,1500,1
TerrainShading ter,1

; Terraintextur laden
Global ter_tex = LoadTexture("gfx/tex1.bmp")
EntityTexture ter, ter_tex
ScaleTexture ter_tex,5,5

; Gras erstellen
Dim grass(9,9)
Global gtex
CreateGrass(ter,ter_tex,"gfx/gras.png")


Global fps_frames,fps_ms,fps_anzeige#


; Nen paar Variablen setzen
; .. für Zeit
Global gaspeed#
Global lastmsc = MilliSecs()

; .. für Gras
Global lod = 1
Global wogen = 1


; Baüme setzen

   Baum1 = LoadMesh("sprites\herbst.b3d")
   Baum1 = LoadMesh("sprites\herbst.b3d")
   
   Baum2 = LoadMesh("sprites\herbst2.b3d")
   
   Baum3 = LoadMesh("sprites\herbst3.b3d")
   Baum31 = LoadMesh("sprites\herbst3.b3d")
   Baum32 = LoadMesh("sprites\herbst3.b3d")
   Baum33 = LoadMesh("sprites\herbst3.b3d")
   Baum34 = LoadMesh("sprites\herbst3.b3d")
   
   Baum4 = LoadMesh("sprites\herbst4.b3d")
   Baum41 = LoadMesh("sprites\herbst4.b3d")
   Baum42 = LoadMesh("sprites\herbst4.b3d")
   Baum43 = LoadMesh("sprites\herbst4.b3d")
   Baum44 = LoadMesh("sprites\herbst4.b3d")
   Baum45 = LoadMesh("sprites\herbst4.b3d")
   Baum46 = LoadMesh("sprites\herbst4.b3d")
   Baum47 = LoadMesh("sprites\herbst4.b3d")
   Baum48 = LoadMesh("sprites\herbst4.b3d")
   Baum49 = LoadMesh("sprites\herbst4.b3d")
   Baum40 = LoadMesh("sprites\herbst4.b3d")
   Baum400 = LoadMesh("sprites\herbst4.b3d")
   Baum401 = LoadMesh("sprites\herbst4.b3d")
   Baum402 = LoadMesh("sprites\herbst4.b3d")

   
   
   
   PositionEntity Baum1,1000,0,2000
   PositionEntity Baum1,1000,0,1000
   
   PositionEntity Baum2,1200,0,1100
   PositionEntity Baum2,200,0,1000
   PositionEntity Baum2,250,0,1150
   
   PositionEntity Baum3,2100,0,1150
   PositionEntity Baum31,2300,0,1380
   PositionEntity Baum32,2400,0,950
   PositionEntity Baum33,-67,0,82
   PositionEntity Baum34,100,0,182
   PositionEntity Baum34,240,0,982
   PositionEntity Baum34,190,0,900
   
   PositionEntity Baum4,1500,0,1500
   PositionEntity Baum41,920,0,1450
   PositionEntity Baum42,1500,0,950
   PositionEntity Baum43,650,0,6110
   PositionEntity Baum44,1730,0,300
   PositionEntity Baum45,1270,0,2150
   PositionEntity Baum46,1170,0,1250
   PositionEntity Baum47,1005,0,1657
   PositionEntity Baum48,1605,0,1650
   PositionEntity Baum49,1408,0,150
   PositionEntity Baum40,1630,0,1550
   PositionEntity Baum400,1300,0,1577
   PositionEntity Baum401,1850,0,2250
   PositionEntity Baum402,1909,0,260
   
   ScaleMesh Baum1,0.3,0.3,-0.3
   ScaleMesh Baum1,0.3,0.3,-0.3
   
   ScaleMesh Baum2,0.3,0.3,-0.3
   
   ScaleMesh Baum3,0.3,0.3,-0.3
   ScaleMesh Baum31,0.3,0.3,-0.3
   ScaleMesh Baum32,0.3,0.3,-0.3
   ScaleMesh Baum33,0.3,0.3,-0.3
   ScaleMesh Baum34,0.3,0.3,-0.3
   
   
   ScaleMesh Baum4,0.3,0.3,-0.3
   ScaleMesh Baum41,0.3,0.3,-0.3
   ScaleMesh Baum42,0.3,0.3,-0.3
   ScaleMesh Baum43,0.3,0.3,-0.3
   ScaleMesh Baum44,0.3,0.3,-0.3
   ScaleMesh Baum45,0.3,0.3,-0.3
   ScaleMesh Baum46,0.3,0.3,-0.3
   ScaleMesh Baum47,0.3,0.3,-0.3
   ScaleMesh Baum48,0.3,0.3,-0.3
   ScaleMesh Baum49,0.3,0.3,-0.3
   ScaleMesh Baum40,0.3,0.3,-0.3
   ScaleMesh Baum400,0.3,0.3,-0.3
   ScaleMesh Baum401,0.3,0.3,-0.3
   ScaleMesh Baum402,0.3,0.3,-0.3

   
;--------------------------------------------------------------------------------------------------------------





;Wichtig. Hauptschleife. Hier wird das ganze Spiel verwaltet.

Repeat


Select game_zustand
   Case game_menue
      GameMenue()
   Case game_haupt
      GameHaupt()
   Case game_pause
      GamePause()
End Select


Until game_zustand = game_over
End;-----------------------------------------------------------------------------------------------------------------------------



Function GameMenue()

Local temp_zustand = game_zustand

FlushMouse()
FlushKeys()





Repeat
Cls
 
;-----------------------------------------------------------------------------------
   
DrawBlock bildvariable, 110, 80
MaskImage bildvariable, r, g, b

Mx=MouseX()
My=MouseY()
mh_1 = MouseHit(1)

Button(780,600,100,20,"Beenden",58,58,58,255,255,255,0,2)
Button(680,600,100,20,"Start",58,58,58,255,255,255,0,1)







;------------------Maus Zeichen----------------
Color 0,0,0
   Rect Mx,My,1,1,1
DrawImage Maus,Mx,My
;---------------------------------------------
Color 255,255,255
Text 20,20,"Wahl : "+ Wahl
   
   
   
   
   
;------------------------------------------------------------------------------------
   
   
   
Flip
Until game_zustand<>temp_zustand

End Function



Function Button(Bx,By,weite,hoehe,Txt$,Rot,Gruen,Blau,Rot2,Gruen2,Blau2,Defaultnummer,Wahln)

If RectsOverlap(Mx,My,1,1,Bx,By,weite,hoehe)    Then     
       
      Wahl = wahln
      If Wahl = 1 Then
         Text 420,384,"Gleich gehts los!"
      ElseIf Wahl = 2 Then
         Text 384,384,"Wollen Sie Mara wirklich schon beenden?"
      EndIf
             
      Color Rot,Gruen,Blau
         Rect Bx,By,weite,hoehe,1
      Color 120,120,120
         Line Bx,By,Bx+weite,By
         Line Bx,By+1,Bx+weite,By+1
         Line Bx+1,By+hoehe,Bx+1,By
         Line Bx,By+hoehe,Bx,By
      Color 255,255,255
         Line Bx,By+hoehe,Bx+weite,By+hoehe
         Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1
         Line Bx+weite,By,Bx+weite,By+hoehe
         Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2
         
         
   If mh_1 Then
      If Wahl = 1 Then
         game_zustand = game_haupt
      ElseIf Wahl=2 Then
         game_zustand = game_over
      EndIf
   EndIf


EndIf


If Wahl <> wahln Then

Color Rot,Gruen,Blau
Rect Bx,By,weite,hoehe,1
Color 255,255,255
Line Bx,By,Bx+weite,By
Line Bx,By+1,Bx+weite,By+1
Line Bx+1,By+hoehe,Bx+1,By
Line Bx,By+hoehe,Bx,By
Color 120,120,120
Line Bx,By+hoehe,Bx+weite,By+hoehe
Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1
Line Bx+weite,By,Bx+weite,By+hoehe
Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2

EndIf




If Not RectsOverlap(Mx,My,1,1,Bx,By,weite,hoehe) Then Wahl = 0

Color Rot2,Gruen2,Blau2
Text Bx+(weite/2),By+(hoehe/2),Txt$,1,1

End Function



Function Endefunction ()
End
End Function











Function GamePause()

Local temp_zustand = game_zustand

FlushKeys()
FlushMouse()

Repeat
ClsColor 0,0,0
Cls
   
   Color 0,0,255
   Text GraphicsWidth()/2,GraphicsHeight()/2,"Sie machen gerade eine Pause!!!",1,1
   
   If KeyHit(57)
      game_zustand = game_haupt
   EndIf
   
Flip
Until game_zustand<>temp_zustand

End Function








Function GameHaupt()

Local temp_zustand = game_zustand

FlushKeys()
FlushMouse()








Repeat


;------------------------------------------------------------------------------------------------------------------
;------Hier ist die Hauptschleife----------------------------------------------------------------------------------


   ; Echtzeitberechnungen
   msc = MilliSecs()
   gaspeed# = Float#(msc-lastmsc)/20.00
   lastmsc = msc
   
   ; Kamereasteuerung
   TurnEntity cam,MouseYSpeed(),-MouseXSpeed(),0
   MoveMouse 400,300
   RotateEntity cam,EntityPitch(cam),EntityYaw(cam),0
   MoveEntity cam,(KeyDown(205)-KeyDown(203))*gaspeed#/+2,0,(KeyDown(200)-KeyDown(208))*gaspeed#/+2
   PositionEntity cam,EntityX(cam),TerrainY(ter,EntityX(cam),0,EntityZ(cam))+15,EntityZ(cam)

   
   
   
   
 
   ; Umgebung updaten
   UpdateEnviron()
   
   If Rand(0,1) Then
      ;Gras-LOD berechnen (Entferntes Gras nich zeichnen)
      UpdateGrass(ter)
   EndIf
   
   ; Gras im Wind wogen lassen
   If wogen
      RotateTexture gtex,Cos(Msc/10)*2.2
   Else
      RotateTexture gtex,0
   EndIf
   
   ; Welt rendern
   RenderWorld()
   
   ; Ein-/Ausschalten von verschiedenen Dingen
   If KeyHit(2) Then lod = 1 - lod ; Dem Gras-LOD
   If KeyHit(3) Then wogen = 1 - wogen ; Dem Gras-Wogen
   If KeyHit(17)Then wire = 1 - wire : WireFrame wire ; Wireframemodus ein/aus



   
   
   ; Texte teichnen... Zu erst die Schatten, versteht sich
   Color 0,0,0
   Text 2,2,"Tris: "+TrisRendered()
   Text 2,17,"FPS: "+util_fps()
   Text 302,2,"LOD(1): "+lod+"  Wogen(2): "+wogen + "  Wireframe(W): "+wired
   Text 862,752,"MARA ANNO 1500"
   
   Color 255,255,255
   Text 0,0,"Tris: "+TrisRendered()
   Text 0,15,"FPS: "+Int(fps_anzeige)
   Text 300,0,"LOD(1): "+lod+"  Wogen(2): "+wogen + "  Wireframe(W): "+wired
   Text 860,750,"MARA ANNO 1500"


; Das Menu_____________________________________________________________________________________

If KeyDown(5)
DrawImage menu, 2, 240
DrawImage menu, 2, 410
DrawImage menu, 2, 580

MaskImage menu, 255, 0, 255
Else
DrawImage menu, -200, 240
DrawImage menu, -200, 410
DrawImage menu, -200, 580

MaskImage menu, 255, 0, 255
EndIf

; Die Burg ____________________________________________________________________________________



   PositionEntity castle,123,01,1100
   ScaleEntity castle,.215,.20,.115
   EntityType castle,TYPE_SCENERY



;------------------------------------------------------------------------------------------------------------------



If KeyHit(8)
   game_zustand = game_pause
EndIf


If KeyHit(1)
   game_zustand = game_menue
EndIf

Flip 0
Until game_zustand<>temp_zustand

End Function



Function UpdateEnviron()
   PositionEntity skybox,EntityX(cam,0),EntityY(cam,0),EntityZ(cam,0)
   TurnEntity skybox,0,.01*gaspeed#,0
End Function

Function LoadSkyBox( parent=0 )
   m=CreateMesh(parent)
   


   ;front face
   b=LoadBrush( "gfx/sky_f.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0
   AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;right face
   b=LoadBrush( "gfx/sky_l.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0
   AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;back face
   b=LoadBrush( "gfx/sky_b.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
   AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;left face
   b=LoadBrush( "gfx/sky_r.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0
   AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;top face
   b=LoadBrush( "gfx/sky_u.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0
   AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;bottom face   
   b=LoadBrush( "gfx/sky_d.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,-1,-1,1,0:AddVertex s,+1,-1,-1,1,1
   AddVertex s,+1,-1,+1,0,1:AddVertex s,-1,-1,+1,0,0
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   
   ScaleMesh m,5,5,5
   EntityOrder m,1
   FlipMesh m
   EntityFX m,1
   Return m
End Function


; Diese funktion erstellt das Gras
Function CreateGrass(ter,ttex,texp$)
   Local vert[3]
   gpiv = CreatePivot()
   tex = LoadTexture(texp,2)
   gtex = tex
   
   ; Das Gras besteht aus 10x10 Meshs.
   
   For sx = 0 To 9
      For sz = 0 To 9
         gmesh = CreateMesh(gpiv)
         EntityTexture gmesh,tex
         gsur = CreateSurface(gmesh)
         PositionEntity gmesh,sx*64,0,sz*64
         EntityFX gmesh,1+16+2
         
         ; In jedem Mesh gibt's 16x16 Sprites
         For x = 0 To 15
            For z = 0 To 15
               vx1# = x*4+Rnd(-8,8)
               vz1# = z*4+Rnd(-8,8)
               vx2# = x*4+Rnd(-8,8)
               vz2# = z*4+Rnd(-8,8)
               
               vert[0] = AddVertex(gsur,vx1,TerrainY(ter,vx1+sx*64,0,vz1+sz*64)-.1,vz1,0,.9)
               vert[1] = AddVertex(gsur,vx1,TerrainY(ter,vx1+sx*64,0,vz1+sz*64)+Rnd(3,5.5),vz1,0,0)
               vert[2] = AddVertex(gsur,vx2,TerrainY(ter,vx2+sx*64,0,vz2+sz*64)-.1,vz2,.9,.9)
               vert[3] = AddVertex(gsur,vx2,TerrainY(ter,vx2+sx*64,0,vz2+sz*64)+Rnd(3,5.5),vz2,.9,0)
               
               AddTriangle(gsur,vert[0],vert[1],vert[2])
               AddTriangle(gsur,vert[1],vert[2],vert[3])
               
               r = Rand(75,85)
               g = Rand(195,230)
               b = Rand(75,85)
               
               VertexColor gsur,vert[0],r,g,b
               VertexColor gsur,vert[1],r,g,b
               VertexColor gsur,vert[2],r,g,b
               VertexColor gsur,vert[3],r,g,b
            Next
         Next
         grass(sx,sz) = gmesh
      Next
   Next
   Return gpiv
End Function

; Updatet das Gras während des Ausführens
Function UpdateGrass(ter)
   If lod = 0 Then
      ; Ist das LOD deaktiviert, so werden alle Grasmeshs einfach so angezeigt
      For x = 0 To 9
         For z = 0 To 9
            ShowEntity grass(x,z)
            PositionEntity grass(x,z),x*64,TerrainY(ter,x,0,z),z*64
         Next
      Next
   Else
      ; Ist das LOD aktiviert, so werden weiter entfernte Grasmeshs versteckt, davor tiefer gezeichnet
      For x = 0 To 9
         For z = 0 To 9
            dist# = Sqr((EntityX(cam,0)-x*64)^2+(EntityZ(cam,0)-z*64)^2)
            If dist<= 250
               ShowEntity grass(x,z)
               PositionEntity grass(x,z),x*64,TerrainY(ter,x,0,z)-dist/60+.5,z*64
            Else
               HideEntity grass(x,z)
            EndIf
         Next
      Next
   EndIf
End Function

Function Util_Fps()
   fps_frames=fps_frames+1
   If MilliSecs()-fps_ms >= 1000 Then
      fps_anzeige=fps_frames
      fps_frames=0
      fps_ms=MilliSecs()
   EndIf
   Return fps_anzeige
End Function


Code: [AUSKLAPPEN]


Graphics3D 1024,768,32,1
SetBuffer BackBuffer()


 Include "system.bb"

;===================================================================================================
; Vars and Types
;===================================================================================================

Type trail
   Field mesh
   Field brush
   Field surf
   Field vert
   Field width#
   Field dist#
   Field left_x#
   Field right_x#
   Field left_z#
   Field right_z#
   Field stat
   Field update
   Field add_flag
   Field add_cnt
   Field add_cnt_value
End Type

Global trail.trail


;-----------------------------------------------------------
Const GRAVITY#=-.05
Const BODY=1,WHEEL=2,SCENE=3

Collisions BODY,SCENE,2,3
Collisions WHEEL,SCENE,2,3
;-----------------------------------------------------------
;max. frames per second
Const max_fps = 75
;-----------------------------------------------------------
;size of map
Const Gridx=32
Const Gridz=32

Global Tile_mask
Global Lightmap
;-----------------------------------------------------------
Global ent
Global tria
Global surf
Global sx0#,sx1#,sx2#,sxp#
Global sy0#,sy1#,sy2#,syp#
Global un0#,vn0#
Global un1#,vn1#

Global u0#,v0#
Global u1#,v1#
Global u2#,v2#

;---------------------------------------------------
Global mxspd#=1.4,myspd#=1.4


;--> vehicle


Global car =  LoadAnimMesh ("dwarf2.b3d")
;ScaleMesh car,-1,1,1
;FlipMesh car
EntityType car,BODY

 


ExtractAnimSeq car, 2, 14 ;walk

 
ExtractAnimSeq car, 16, 26  ;run
ExtractAnimSeq car, 28, 40  ;jump 1
;ExtractAnimSeq car, 42, 54  ;jump 2 - for user controlled jumps


ExtractAnimSeq car, 56, 74  ;crouch - 56-59=down, 60-69=crouch, 70-74=get up
ExtractAnimSeq car, 75, 88  ;battle idle 1
;ExtractAnimSeq car, 90, 110 ;battle idle 1



ExtractAnimSeq car, 112, 126  ;Attack 1 - swing
ExtractAnimSeq car, 128, 142  ;Attack 2 - Jump and overhead whack
;ExtractAnimSeq car, 144, 160  ;Attack 3 - 360 backhand
;ExtractAnimSeq car, 162, 180  ;Attack 4 - 2 Swipes
;ExtractAnimSeq car, 182, 192  ;Attack 5 - Stab
;ExtractAnimSeq car, 194, 210  ;Attack 6 - BLOCK
;ExtractAnimSeq car, 212, 227  ;Die 1 - Forwards
;ExtractAnimSeq car, 230, 251   ;Die 1 - Backwards

;ExtractAnimSeq car, 253, 272   ;Nod YES
;ExtractAnimSeq car, 274, 290   ;Shake head NO

;ExtractAnimSeq car, 292, 325   ;Idle 1
;ExtractAnimSeq car, 327, 360   ;Idle 2

; ExtractAnimSeq car, 2, 360  ;All Animations


;FreeEntity car


;car_back = LoadMesh("mesh\dummy_back.b3d",car)
;ScaleMesh car_back,5,5,5
;FlipMesh car
;RotateEntity car_back,0,180,0
;PositionEntity car_back,0,-12,-16
;cartex = LoadTexture("mesh\cartex_2.png")
;EntityTexture car_back,cartex

;car_wheels = LoadMesh("mesh\dummy_wheels.b3d",car)
;ScaleMesh car_wheels,4,4,4
;RotateEntity car_wheels,0,180,0
;PositionEntity car_wheels,0,0,0
;wheeltex = LoadTexture("mesh\wheeltex.png")

;--> trees
CreateTrees()

;--> trails
CreateTrails()

;--> wheels
;Global wheels[4]

;tiretex = LoadTexture("mesh\tiretex.png")

;cnt=1
;For z#=6 To -6 Step -12
;For x#=-6 To 6 Step 12
;   wheels[cnt]=CreateSphere(8,car)
;   EntityTexture wheels[cnt],tiretex
;   EntityAlpha wheels[cnt],1
;   ScaleEntity wheels[cnt],1,2,2
;   EntityRadius wheels[cnt],2
;   PositionEntity wheels[cnt],x,0,z
;   EntityType wheels[cnt],WHEEL
;   cnt=cnt+1
;Next
;Next


target=CreatePivot(car)
PositionEntity target,0,5,-12

;Add Lights and Camera
lit=CreateLight()




Global  camera=CreateCamera()




CameraRange camera,.1,6000

PositionEntity camera,0,256,0

Dim tex(15)            ;Holds textures used for tiles
Load_Textures()

;Create and store map heights from a heightmap
Dim map.tile(gridx,gridz)   ;Now holds all info including brush tiles set 1 and 2,mask and lightmap
Create_MapLayout("hmap.bmp");create a height map and store it in dimension map(x,y)
;Create a map mesh and scale to size
ground=Create_Map(gridx,gridz,3)
PositionEntity ground,-100,0,-100
ScaleMesh ground,80,0,80
EntityType ground,SCENE

;Finally add a lightmap texture
EntityTexture ground,Lightmap,0,3

groundtex=LoadTexture("tex0.bmp"):ScaleTexture groundtex,50,50Color 255,255,255

plane = CreatePlane()
basictex = LoadTexture("tex1.bmp"):ScaleTexture basictex,50,50
PositionEntity plane,0,-1,0
EntityTexture plane,basictex,0,0
EntityTexture plane,groundtex,0,1
EntityType plane,SCENE

;Load logo and resize
;im=LoadImage("bl3d_big.jpg")
;ResizeImage im,100,50

;Make a sky box and make its parent be the camera
sky=LoadSkyBox("sky")
EntityParent sky,camera


brushtex = CreateTexture(2048,2048)
TextureCoords brushtex,1
EntityTexture ground,brushtex,0,3
TextureBlend brushtex,3
EntityPickMode ground,2

speed#=0
x_vel#=0:prev_x#=EntityX(car)
y_vel#=0:prev_y#=EntityY(car)
z_vel#=0:prev_z#=EntityZ(car)

timer = CreateTimer(max_fps)


;===================================================================================================
; Mainloop
;===================================================================================================
While Not KeyDown(1)
   
   ;--> wireframe
   If KeyHit(2) Then
      wire = 1 - wire
      WireFrame wire
   EndIf
   
   ;--> reset
   If KeyHit(54) Then
      reset = 1
      
      PositionEntity car,20,5,0
      RotateEntity car,0,0,0,1
      
      DeleteTrails()
      CreateTrails()
   EndIf



   ;align car to wheels
   ;zx#=(EntityX( wheels[2],True )+EntityX( wheels[4],True ))/2
   ;zx=zx-(EntityX( wheels[1],True )+EntityX( wheels[3],True ))/2
   ;zy#=(EntityY( wheels[2],True )+EntityY( wheels[4],True ))/2
   ;zy=zy-(EntityY( wheels[1],True )+EntityY( wheels[3],True ))/2
   ;zz#=(EntityZ( wheels[2],True )+EntityZ( wheels[4],True ))/2
   ;zz=zz-(EntityZ( wheels[1],True )+EntityZ( wheels[3],True ))/2
   ;AlignToVector car,zx,zy,zz,1
   
   ;zx#=(EntityX( wheels[1],True )+EntityX( wheels[2],True ))/2
   ;zx=zx-(EntityX( wheels[3],True )+EntityX( wheels[4],True ))/2
   ;zy#=(EntityY( wheels[1],True )+EntityY( wheels[2],True ))/2
   ;zy=zy-(EntityY( wheels[3],True )+EntityY( wheels[4],True ))/2
   ;zz#=(EntityZ( wheels[1],True )+EntityZ( wheels[2],True ))/2
   ;zz=zz-(EntityZ( wheels[3],True )+EntityZ( wheels[4],True ))/2
   ;AlignToVector car,zx,zy,zz,3
   
   ;calculate car velocities   
   cx#=EntityX( car ):x_vel=cx-prev_x:prev_x=cx
   cy#=EntityY( car ):y_vel=cy-prev_y:prev_y=cy
   cz#=EntityZ( car ):z_vel=cz-prev_z:prev_z=cz
   
   ;resposition wheels
   ;cnt=1
   ;For z=10 To -10 Step -19
   ;For x=-6 To 16 Step 12
   ;   PositionEntity wheels[cnt],x,-1,z+1.5
   ;   cnt=cnt+1
   ;Next
   ;Next
   
   ;move car
   ; Kamereasteuerung


     
If    KeyDown(30) Then TurnEntity car,0,1.5,0 turn = 1
If    KeyDown(32) Then TurnEntity car,0,-1.5,0 turn = -1
If    KeyDown(72) Then MoveEntity car,0,0,+0.4 turn = 1
If    KeyDown(31) Then MoveEntity car,0,0,-0.4 turn = -1
If   KeyDown(17) Then MoveEntity  car,0,0,+0.9  turn = 1
If   KeyDown(47) Then MoveEntity  car,0,0,+5  turn = 1



If KeyDown(17)=1 And down=0 Then
   seq=1

 Animate car,1,.2, seq, 1
down=1

ElseIf KeyDown(17)=0 And down=1
down=0

   seq=5

 Animate car,1,.2, seq, 1

EndIf

If KeyDown(47)=1 And down1=0 And down=1 Then
    seq=2

 Animate car,1,.2, seq, 1

down1=1

ElseIf KeyDown(47)=0 And down1=1
down1=0

seq=1
 Animate car,1,.2, seq, 1

EndIf


If KeyDown(57)=1 And down2=0 And down=1 And down1=0 Then
    seq=3

 Animate car,1,.2, seq, 1

down2=1

ElseIf KeyDown(57)=0 And down2=1
down2=0

seq=1
 Animate car,1,.2, seq, 1

EndIf


If KeyDown(16)=1 And down3=0 And down=0  Then
    seq=4

 Animate car,1,.2, seq, 1

down3=1

ElseIf KeyDown(16)=0 And down3=1
down3=0

seq=5
 Animate car,1,.2, seq, 1

EndIf


If MouseDown (1)=1 And down4=0  Then
    seq=6

 Animate car,1,.2, seq, 1

down4=1

ElseIf MouseDown (1)=0 And down4=1 And down=0
down4=0

seq=5
 Animate car,1,.2, seq, 1

ElseIf MouseDown (1)=0 And down4=1 And down=1
down4=0

seq=1
 Animate car,1,.2, seq, 1

EndIf



If MouseDown (2)=1 And down5=0  Then
    seq=7

 Animate car,1,.2, seq, 1

down5=1

ElseIf MouseDown (2)=0 And down5=1 And down=0
down5=0

seq=5
 Animate car,1,.2, seq, 1

ElseIf MouseDown (2)=0 And down5=1 And down=1
down5=0

seq=1
 Animate car,1,.2, seq, 1

EndIf




   
    TurnEntity car,0,-JoyX(),0

   If EntityCollided(car,SCENE) Then

    If JoyY() Then turn = 1
      MoveEntity car,0,0,speed
      TranslateEntity car,0,GRAVITY,0
   Else
      TranslateEntity car,x_vel,y_vel+GRAVITY,z_vel
   EndIf
   
;__________________________________________________________________

   If KeyDown(2) Then
      trail = First trail
      trail\stat = 1
      
      If KeyHit(2) Then
      If trail\stat = 1 Then
         trail\update = 1
         TrailPos(trail)
         AddVertex trail\surf,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         AddVertex trail\surf,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
         
         trail\vert = trail\vert + 2
      ElseIf trail\stat = 0 Then
         TrailPos(trail)
         VertexCoords trail\surf,trail\vert,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         VertexCoords trail\surf,trail\vert+1,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
      EndIf
      EndIf
   Else
      trail = First trail
      trail\stat = 0
   EndIf
   
   If KeyDown(60) Then
      trail = First trail
      trail = After trail
      trail\stat = 1
      
      If KeyHit(60) Then
      If trail\stat = 1 Then
         trail\update = 1
         TrailPos(trail)
         AddVertex trail\surf,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         AddVertex trail\surf,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
         
         trail\vert = trail\vert + 2
      ElseIf trail\stat = 0 Then
         TrailPos(trail)
         VertexCoords trail\surf,trail\vert,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         VertexCoords trail\surf,trail\vert+1,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
      EndIf
      EndIf
   Else
      trail = First trail
      trail = After trail
      trail\stat = 0
   EndIf
   
   If KeyDown(73) Then
      trail = Last trail
      trail\stat = 1
      
      If KeyHit(73) Then
      If trail\stat = 1 Then
         trail\update = 1
         TrailPos(trail)
         AddVertex trail\surf,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         AddVertex trail\surf,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
         
         trail\vert = trail\vert + 2
      ElseIf trail\stat = 0 Then
         TrailPos(trail)
         VertexCoords trail\surf,trail\vert,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
         VertexCoords trail\surf,trail\vert+1,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
      EndIf
      EndIf
   Else
      trail = Last trail
      trail\stat = 0
   EndIf
   
   For trail = Each trail
      If turn Or trail\update Then
         trail\add_cnt = trail\add_cnt + 1
         If trail\add_cnt = trail\add_cnt_value Then
            trail\add_cnt = 0
            trail\add_flag = True
         Else
            trail\add_flag = False
         EndIf
      ElseIf trail\add_cnt Then
         trail\add_cnt = 0
         trail\add_flag = True
      Else
         trail\add_flag = False
      EndIf
      
      If trail\stat = 1 Then
         If trail\add_flag Then
            TrailPos(trail)
            AddVertex trail\surf,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
            AddVertex trail\surf,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
            
            AddTriangle trail\surf,trail\vert+2,trail\vert+1,trail\vert
            AddTriangle trail\surf,trail\vert+2,trail\vert+3,trail\vert+1
            
            trail\vert = trail\vert + 2
         Else
            TrailPos(trail)
            VertexCoords trail\surf,trail\vert,EntityX(car) - trail\right_x#,0,EntityZ(car) + trail\right_z#
            VertexCoords trail\surf,trail\vert+1,EntityX(car) + trail\left_x#,0,EntityZ(car) - trail\left_z#
            
            trail\update = 0
         EndIf
      EndIf
   Next
   
   turn = 0
   

   
   ;##############################################
   

   ;update camera

   PositionEntity camera,EntityX(camera),EntityY(camera)+2,EntityZ(camera)
   CamMovement(camera,car,.05,80,3,0,0)
   ;MoveMouse 400,300   


;--------------------------------------------
;---MAUS------------------
;------------------------

    TurnEntity camera,MouseY(),-MouseX(),0


   
   ;rotate the skybox true to the scene
   RotateEntity sky,0,0,0,True
   
   WaitTimer timer
      
   UpdateWorld
   
   RenderWorld
   
   Text 0,0, "MARA ANNO 1500"
   
   If wire Then Text 0,64,"Tris: " + TrisRendered()

   ;DrawImage im,540,0
   
   Flip
   
Wend

FreeEntity ground
FreeEntity lit
FreeEntity cam
EndGraphics
End

;===================================================================================================
; other functions
;===================================================================================================






Function Create_Map(tilex,tilez,tile)
   mesh=CreateMesh()
   u#=0
   v#=0
   stp#=1.0/Float(tilex)
   For z#=0 To tilez-1
      u=0
      For x#=0 To tilex-1
         h1#=map(x,z)\y                     ;top left height
         h2#=map(x+1,z)\y                  ;top right height
         h3#=map(x+1,z+1)\y                  ;bot right height
         h4#=map(x,z+1)\y                  ;bot left height
         br=map(x,z)\brush                  ; this brush contains both tiles + mask + lightmap
         surf=FindSurface( mesh,br )            ; Find a surface in the mesh that contains the same brush
         If surf=0 surf=CreateSurface(mesh,br)    ; If it can't find one create a new surface
         cnt=CountVertices( surf )            ; Get count of vertices

         ;Add vertices including tile coords
         AddVertex surf,x,h1,z,0,0
         AddVertex surf,x+1.0,h2,z,1,0
         AddVertex surf,x+1.0,h3,z+1.0,1,1
         AddVertex surf,x,h4,z+1.0,0,1
         ;Add second set of tex coords to fit grid
         VertexTexCoords surf,cnt,u,v,0,1
         VertexTexCoords surf,cnt+1,u+stp,v,0,1
         VertexTexCoords surf,cnt+2,u+stp,v+stp,0,1
         VertexTexCoords surf,cnt+3,u,v+stp,0,1
         ;Finally add the two triangles
         AddTriangle surf,cnt,cnt+2,cnt+1
         AddTriangle surf,cnt,cnt+3,cnt+2
         u=u+stp
      Next
      v=v+stp
   Next
   UpdateNormals mesh
   Return mesh
End Function

Function Load_Textures()
   For a=0 To 14
      b$="tex"+a+".bmp"
      tex(a+1)=LoadTexture(b$)
   Next
   Tile_mask=LoadTexture("mask.bmp")
   TextureCoords Tile_mask,1
   TextureBlend Tile_mask,3
   Lightmap=LoadTexture("lightmap.bmp",4)
   TextureCoords Lightmap,1
   TextureBlend Lightmap,3
End Function

Function Create_MapLayout(file$)
   hmap=LoadImage(file)
   DrawImage hmap,0,0
   For z=0 To gridz
      For x=0 To gridx
         map.tile(x,z)=New tile
         GetColor x,z
         map(x,z)\y=Float(ColorRed())/255
         map(x,z)\brush=CreateBrush()
         Read track
         BrushTexture map(x,z)\brush,tex(track),0,0      ;Bottom Tile
         BrushTexture map(x,z)\brush,tex(2),0,2         ;Top Tile
         BrushTexture map(x,z)\brush,Tile_mask,0,1      ;Mask
      Next
   Next
End Function

;
;Tile information
;
Type tile
   Field y#      ;yhieght at top left eg inc u0,v0
   Field brush      ;Remember that there are four brushes used ontop of each other blended
End Type

.mapdata
Data 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1
Data 1 ,14,1 ,1 ,1 ,1 ,1 ,1 ,5 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,6 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1
Data 1 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 )
   m=CreateMesh()
   ;front face
   b=LoadBrush( file$+"_FR.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0
   AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;Right face
   b=LoadBrush( file$+"_LF.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0
   AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;back face
   b=LoadBrush( file$+"_BK.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
   AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;Left face
   b=LoadBrush( file$+"_RT.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0
   AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   FreeBrush b
   ;top face
   b=LoadBrush( file$+"_UP.bmp",49 )
   s=CreateSurface( m,b )
   AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0
   AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1
   AddTriangle s,0,1,2:AddTriangle s,0,2,3
   ;FreeBrush b
   ScaleMesh m,3300,3300,3300
   FlipMesh m
   EntityFX m,1
   Return m
End Function

Function CamMovement(cam,ent,cspeed#,dist#,hite#,xrot#,tilt#)
   TFormPoint 0,hite#,-dist#,ent,0
   
   cx#=(TFormedX()-EntityX(cam))*cspeed#
   cy#=(TFormedY()-EntityY(cam))*cspeed#
   cz#=(TFormedZ()-EntityZ(cam))*cspeed#
   
   TranslateEntity cam,cx,cy,cz
   PointEntity cam,ent
   RotateEntity cam,xrot#,EntityYaw(cam),tilt#
   
   
End Function


Ich habs übers WE nicht gebacken bekommen!

MFG

DerHase

BeitragSo, Sep 17, 2006 18:10
Antworten mit Zitat
Benutzer-Profile anzeigen
Äaah ohne den Code durchgelesen zu haben würde ich
Code: [AUSKLAPPEN]
include
sagen.

robotx

BeitragSo, Sep 17, 2006 18:11
Antworten mit Zitat
Benutzer-Profile anzeigen
Von wem ist denn der zweite Code?

robotx
www.botbomb.robotzgames.de
www.robotzgames.de
 

phpmännchen

BeitragSo, Sep 17, 2006 18:12
Antworten mit Zitat
Benutzer-Profile anzeigen
DerHase hat Folgendes geschrieben:
Äaah ohne den Code durchgelesen zu haben würde ich
Code: [AUSKLAPPEN]
include
sagen.



Ne das geht nicht weil es zwei code sind die Ähnlich sind und zusammen sollen! Nicht include !!!!

Blitzcoder

Newsposter

BeitragSo, Sep 17, 2006 18:12
Antworten mit Zitat
Benutzer-Profile anzeigen
Wie zusammen stricken?
P4 3 Ghz@3,55Ghz|GF 6600GT 256MB|Samsung 80GB | 2x Samsung 160GB|2048MB DDR-400 RAM|6 Mbit Flatrate | Logitech G15 | Samsung 225BW-TFT | Ubuntu Gutsy Linux | Windows Vista | Desktop | Blog | CollIDE | Worklog
________________
|°°°°°°°°°°°°°°||'""|""\__,_
|______________ ||__ |__|__ |)
|(@) |(@)"""**|(@)(@)****|(@)
 

phpmännchen

BeitragSo, Sep 17, 2006 18:13
Antworten mit Zitat
Benutzer-Profile anzeigen
robotx hat Folgendes geschrieben:
Von wem ist denn der zweite Code?

robotx


Das ist ein von mir gebastelter und aus bb bestehender Code
 

phpmännchen

BeitragSo, Sep 17, 2006 18:14
Antworten mit Zitat
Benutzer-Profile anzeigen
Blitzcoder hat Folgendes geschrieben:
Wie zusammen stricken?


Wie die übersicht schon sagt aus 2 mach 1

robotx

BeitragSo, Sep 17, 2006 18:16
Antworten mit Zitat
Benutzer-Profile anzeigen
wo ist dann das problem?!
Du wirst doch deinen eigenen Code kennen und somit dürfte es nicht schwer sein ihn zusammenzuwurschteln. Zwei Codes, die nichts miteinander zu tun haben zusammen zu bekommen, ist schwer.
www.botbomb.robotzgames.de
www.robotzgames.de
 

phpmännchen

BeitragSo, Sep 17, 2006 18:17
Antworten mit Zitat
Benutzer-Profile anzeigen
robotx hat Folgendes geschrieben:
wo ist dann das problem?!
Du wirst doch deinen eigenen Code kennen und somit dürfte es nicht schwer sein ihn zusammenzuwurschteln. Zwei Codes, die nichts miteinander zu tun haben zusammen zu bekommen, ist schwer.


Das is ja mein Problem, ich bekomme sie net zusammen
 

Ava

Gast

BeitragSo, Sep 17, 2006 18:22
Antworten mit Zitat
LoL, also Dir wird mit Sicherheit niemand diese Arbeit abnehmen!
Zumal wir ja auch gar nicht wissen, wie genau Du den Code kombinieren
willst, warum das jetzt nicht so einfach machbar ist und was es überhaupt
bezwecken soll... ... Rolling Eyes

Vielleicht nimmst Du es als Anreiz, daraus zu lernen und alles beim nächsten
mal etwas geschickter zu strukturieren, dass es unproblematisch miteinander
verbunden werden kann.... *smile*
 

phpmännchen

BeitragMo, Sep 18, 2006 6:56
Antworten mit Zitat
Benutzer-Profile anzeigen
Habs geschaft, ju hu....

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group