Kleines WayPoint Bsp
Übersicht BlitzBasic Codearchiv
BigmichiBetreff: Kleines WayPoint Bsp |
Fr, Feb 27, 2004 16:35 Antworten mit Zitat |
|
---|---|---|
Falls jemand sowas gebrauchen kann
Steuerung: Rechte MT = Waypoint erstellen Linke MT = Waypoint aktivieren (Maus bewegen um WP zu bewegen) Linke MT = Waypoint wieder frei lassen LeerTaste = Spieler laufen lassen Code: [AUSKLAPPEN] Type WPE Field PT Field ID Field entity End Type Graphics3D 1024,768,16,2 SetBuffer BackBuffer() Global Kamera = CreateCamera() PositionEntity Kamera,0,50,0 TurnEntity Kamera,90,0,0 Global SP = CreateCube() ScaleEntity SP,1,1,2 PositionEntity SP,-10,0,0 EntityColor SP,255,0,0 Global MX,MY Global Pentity,PAktiv Global WPID = 0 Global Play = 0 Global GWP = 0 ;############################################################# While Not KeyHit(1) MX = MouseX() MY = MouseY() If PAktiv = 0 Then Pentity = CameraPick(Kamera,MX,MY) If Paktiv <> 0 Then SelPW() If MouseHit(2) Then ADDPW() If KeyHit(57) Then If Play = 0 Then Play = 1 Else Play = 0 If Play = 1 Then UpdateSpieler() If MouseHit(1) Then If Pentity <> 0 Then If Paktiv = 0 Then PAktiv = 1 MXS# = MouseXSpeed() MYS# = MouseYSpeed() Else PAktiv = 0:ShowPointer() End If End If End If RenderWorld() Text 10,10,Pentity Flip:Cls Wend End ;############################################################# Function UpdateSpieler() If WPID = 0 Then Exit For WayPoint.WPE = Each WPE If WayPoint\ID = GWP + 1 Then PointEntity SP,WayPoint\PT If EntityDistance(SP,WayPoint\PT) < 1 Then GWP = WayPoint\ID Exit End If Next If WPID = GWP Then GWP = 0 MoveEntity SP,0,0,1 Return 0 End Function ;############################################################# Function SelPW() HidePointer() For WayPoint.WPE = Each WPE If WayPoint\entity = Pentity Then MXS# = MouseXSpeed() MYS# = MouseYSpeed() If MXS# < 10 And MYS# < 10 Then MoveEntity WayPoint\entity,(MXS#*.2),0,-(MYS*.2) MoveEntity WayPoint\PT,(MXS#*.2),0,-(MYS*.2) End If MoveMouse (GraphicsWidth()/2),(GraphicsHeight()/2) Exit End If Next Return 0 End Function ;############################################################# Function ADDPW() WayPoint.WPE = New WPE WayPoint\PT = CreatePivot() WayPoint\entity = CreateSphere() WPID = WPID + 1 WayPoint\ID = WPID EntityPickMode WayPoint\entity,1 Return 0 End Function |
||
Blatolo |
Sa, Feb 28, 2004 21:38 Antworten mit Zitat |
|
---|---|---|
BlitzBasic: [AUSKLAPPEN] Function UpdateSpieler() musst du ersetzen durch BlitzBasic: [AUSKLAPPEN] Function UpdateSpieler() Denn Funktionen werden durch return beendet und nicht durch exit. Das hat mir der COmpiler auch als Fehler ausgegeben. Ansonsten gut zum Demonstrieren von waypints |
||
Übersicht BlitzBasic Codearchiv
Powered by phpBB © 2001 - 2006, phpBB Group