All pastes #801588 Raw Edit

Unbenannt

public text v1 · immutable
#801588 ·published 2007-11-29 12:30 UTC
rendered paste body
Include "sprite candy.bb"
Include "sprite candy gui.bb"
;################################################## Player Type, hier werden die Spieler gespeichert.... :A
Type TPlayers
	Field X#
	Field Y#
	Field Rotation#
	Field Beschleunigung#
	Field Port
	Field IP
	Field EnergieShape
	Field SchussKraft#
	Field Leben#
	Field MaxSchussKraft#
	Field PfeilObjekt
	Field LastAufladen#
	Field LastReceived
	Field PlayerImage
	Field Farbe
End Type
;##################################################
Type TSchuss
	Field X#
	Field Y#
	Field Rotation#
	Field Speed#
	Field LastMove
	Field Farbe
	Field SchussObjekt
	Field SpielerIP
End Type
;##################################################
Type TExplosion
	Field X#
	Field Y#
	Field Rotation#
	Field AnimationObject
End Type
;################################################## Ja, allgemeiner Grafikkram, Auflösung 800x600, 32 bit, Fenstermodus + Tformfilter 0 für die Drehung des Autos
Graphics3D 800,600,32,2
TFormFilter 0
Global OwnUDPStream = CreateUDPStream()
;##################################################
SeedRnd MilliSecs()
;##################################################
Global HauptKamera  = CreateCamera()
CameraClsMode HauptKamera,0,1
Global Main_HUD = HUD_Create(HauptKamera)
;##################################################
Global Sicherheits_Layer = HUD_CreateLayer(Main_HUD, 0, 5)
Global Sicherheits_Shape = HUD_CreateShape(Sicherheits_Layer, "DOTRING", 45, 30, 0,0,500, 500)
HUD_SetObjectOrigin(Sicherheits_Shape, 0,0)
HUD_SetObjectColor(Sicherheits_Shape, 255,0,0,0.8)
HUD_SetObjectShadow(Sicherheits_Shape, 20, 10.0)
HUD_FX_SteadyRotate(Sicherheits_Shape, 10, 0)
;##################################################
Global Tank_Texture = HUD_LoadImageResource("panzer.bmp", 4,255,0,255)
Global Tank_Layer = HUD_CreateLayer(Main_HUD, Tank_Texture, 2)
;##################################################
Global Backgroundimage = LoadImage("hintergrund.bmp")
;##################################################
Global Main_GUI = GUI_Create(Main_HUD, "gui/sd.png", "gui/font_title.png", "gui/font.png", "gui/icons.png")
Global GUI_InformationWindow = GUI_CreateWindow("Schüsse", 5, 570, 780, 24, 0, "LEFT+5")
Global GUI_InformationSchusskraft = GUI_AddProgBar(GUI_InformationWindow, 10,5,760, 1.0)
HUD_SetObjectAlpha(GUI_InformationWindow, 0.8)
;##################################################
Global GUI_FarbWindow = GUI_CreateWindow("Farbe", 720,0, 150,100, 0,"", "TOP")
Global GUI_FarbPicker = GUI_AddColorPicker(GUI_FarbWindow,0,0,150,100)
HUD_SetObjectAlpha(GUI_FarbWindow, 0.8)
GUI_SetColorPickerCoords(GUI_FarbPicker, 0,0,0)
;##################################################
Global GUI_JoinWindow = GUI_CreateWindow("Netzwerk", 105,51,200, 75, 0)
Global GUI_PortLabel = GUI_AddLabel(GUI_JoinWindow, 5,5,190, 17, "Eigener Port: " + UDPStreamPort(OwnUDPStream), "CENTER", 1)
Global GUI_JoinIP = GUI_AddTextField(GUI_JoinWindow, 5,25,190, 200, "1234567890.","IP")
Global GUI_JoinPort = GUI_AddTextField(GUI_JoinWindow, 5,50,50, 200, "1234567890","PORT")
Global GUI_JoinButton = GUI_AddButton(GUI_JoinWindow, 60,50,100,"Beitreten")
HUD_SetObjectAlpha(GUI_JoinWindow, 0.8)
;##################################################
Global Schuss_Texture = HUD_LoadImageResource("schuss.bmp", 4, 0,0,0)
Global Schuss_Layer = HUD_CreateLayer(Main_HUD, Schuss_Texture, 1)
;##################################################
Global Radar_Texture = HUD_LoadImageResource("radar.bmp", 4, 0,0,0)
Global Radar_Layer = HUD_CreateLayer(Main_HUD, Radar_Texture, 4)
;##################################################
Global Energie_Shape = HUD_CreateLayer(Main_HUD, 3)
;##################################################
;Global Explosions_Texture = HUD_LoadImageResource("image/tank_explosion.bmp", 4, 0,0,255)
;Global Explosions_Layer = HUD_CreateLayer(Main_HUD, Explosions_Texture, 5)
;################################################## Öffnung des Lokalen UDP Streams
Global Players.TPlayers
Global Schuss.TSchuss
Global Explosion.TExplosion
;##################################################
Global PanzerSchussSound = LoadSound("sound\tank_01.wav")
;################################################## Selbsterklärend
SetBuffer BackBuffer()
;################################################## Der eigene Spieler wird erstellt, IP = 50 habe ich genommen, damit Blitz erkennt, dass es sich hier um den eigenen Spieler handelt.  50, weil es eine tolle Zahl ist.
Global OwnPlayer.TPlayers = New TPlayers
OwnPlayer\X# = Rand(-100, 100)
OwnPlayer\Y# = Rand(-100, 100)
OwnPlayer\Rotation = Rand(0,350)
OwnPlayer\Port = UDPStreamPort(OwnUDPStream)
OwnPlayer\IP = 50
OwnPlayer\SchussKraft# = 1.0
OwnPlayer\Leben = 100
OwnPlayer\MaxSchussKraft# = 5.0
OwnPlayer\PfeilObjekt = HUD_CreateImage(Radar_Layer, 0,0,0,0,32,32)
OwnPlayer\PlayerImage = HUD_CreateImage(Tank_Layer, 0,0,0,0,64,64) 
OwnPlayer\EnergieShape = HUD_CreateShape(Energie_Shape, "PERCENTBAR", 100, 1,0,0,60,8)
HUD_SetObjectColor(OwnPlayer\EnergieShape, 0,255,0,0.8)
HUD_SetObjectOrigin(OwnPlayer\EnergieShape, 0.0,0.0)
HUD_SetObjectColor(OwnPlayer\PfeilObjekt, 255,0,0,0.8)
HUD_SetObjectShadow(OwnPlayer\PfeilObjekt, 3, 3.0)
HUD_SetObjectShadow(OwnPlayer\PlayerImage, 3, 3.0)
HUD_SetObjectOrigin(OwnPlayer\PlayerImage, 0,0)
;################################################## Kamerapositionen
Global LastPositionSend, LastIPListSend, LastColorSend
;##################################################
Global CameraX
Global CameraY
;##################################################
Function Angle2D#( x1#,y1#,x2#,y2# )
	Return 180-ATan2(x2-x1,y2-y1)
End Function
;################################################## So, hier kommt die Steuerung, dabei wird zuerst nach dem eigenen Spieler gesucht (der, welcher die IP 50 hat, und dieser ist dann Steuerbar)
Function PlayerControls()
   ;##############################################
	For Players = Each TPlayers 
		Players\X = (Players\X+((Players\Beschleunigung#/2)*Cos(Players\Rotation#)))
		Players\Y = (Players\Y+((Players\Beschleunigung#/2)*Sin(Players\Rotation#)))
	Next	
	;##############################################
	CameraX = OwnPlayer\X
	CameraY = OwnPlayer\Y
   ;##############################################
	GUI_SetGadgetValue(GUI_InformationSchusskraft,OwnPlayer\SchussKraft#/OwnPlayer\MaxSchussKraft#)
	;##############################################
	If KeyDown(200) Then
		If OwnPlayer\Beschleunigung# < -3.0 Then
			OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# + 1
		End If
		OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# + 0.3
	ElseIf KeyDown(208) Then
		If OwnPlayer\Beschleunigung# > 3.0 Then
			OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# - 1
		End If
		OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# - 0.3
	EndIf
   ;##############################################
	If OwnPlayer\Beschleunigung# > 0.0
		OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# - 0.1
	ElseIf OwnPlayer\Beschleunigung# < 0.0
		OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# + 0.1
	End If
	;##############################################
	If MilliSecs() - OwnPlayer\LastAufladen# > 300 Then
		OwnPlayer\LastAufladen# = MilliSecs()
		If OwnPlayer\Beschleunigung < 0.0 Then
			OwnPlayer\SchussKraft# = OwnPlayer\SchussKraft# + (0.2+(OwnPlayer\Beschleunigung#/100))
		Else
			OwnPlayer\SchussKraft# = OwnPlayer\SchussKraft# + (0.2-(OwnPlayer\Beschleunigung#/100))
		End If		
		
	End If
	
	If OwnPlayer\SchussKraft# > OwnPlayer\MaxSchussKraft# Then
		OwnPlayer\SchussKraft# = OwnPlayer\MaxSchussKraft#
	End If
	
	If KeyHit(57) And OwnPlayer\SchussKraft# >= 1.0 And HUD_GetDistance(OwnPlayer\X, OwnPlayer\Y, 0, 0) > 250 Then
		PlaySound(PanzerSchussSound)
		OwnPlayer\SchussKraft# = OwnPlayer\SchussKraft#-1
		Schuss = New TSchuss
		Schuss\X# = OwnPlayer\X#
		Schuss\Y# = OwnPlayer\Y#
		Schuss\Speed# = 20.0
		Schuss\Rotation = OwnPlayer\Rotation
		Schuss\SpielerIP = 50
		Schuss\Farbe = GUI_GetGadgetValue(GUI_FarbPicker)	
		Schuss\SchussObjekt = HUD_CreateImage(Schuss_Layer, Schuss\X#, Schuss\Y#,  0,0,16,16)
		HUD_SetObjectColor(Schuss\SchussObjekt, (GUI_GetGadgetValue(GUI_FarbPicker) And $FF0000)/$10000 , (GUI_GetGadgetValue(GUI_FarbPicker) And $FF00)/$100,GUI_GetGadgetValue(GUI_FarbPicker) And $FF)
		SoundVolume PanzerSchussSound, 0.1
		
		PlaySound PanzerSchussSound
		For Players = Each TPlayers
			If Players\IP <> 50 Then
				WriteInt OwnUDPStream, 4
				WriteFloat OwnUDPStream, Schuss\X#
				WriteFloat OwnUDPStream, Schuss\Y#
				WriteFloat OwnUDPStream, Schuss\Speed#
				WriteInt OwnUDPStream, Schuss\Rotation
				WriteInt OwnUDPStream, Schuss\Farbe
				SendUDPMsg(OwnUDPStream, Players\IP, Players\Port)
			End If
		Next
	End If
	;##############################################
	RotationsFaktor# = 5+OwnPlayer\Beschleunigung/10
	If KeyDown(203) Then
		OwnPlayer\Rotation# = OwnPlayer\Rotation#-RotationsFaktor#
	ElseIf KeyDown(205) Then
		OwnPlayer\Rotation# = OwnPlayer\Rotation#+RotationsFaktor#
	End If
   ;###############################################
	If OwnPlayer\Rotation# > 360 Then OwnPlayer\Rotation# = 0
	If OwnPlayer\Rotation# < 0  Then OwnPlayer\Rotation# = 360
   ;##############################################
	If OwnPlayer\Beschleunigung# > 0 Then
		OwnPlayer\Beschleunigung# =  OwnPlayer\Beschleunigung# - 0.01
	ElseIf OwnPlayer\Beschleunigung# < 0 Then
		OwnPlayer\Beschleunigung# = OwnPlayer\Beschleunigung# + 0.01
	End If
	If OwnPlayer\Beschleunigung# > 20 Then OwnPlayer\Beschleunigung# = 20
	If OwnPlayer\Beschleunigung# < -20 Then OwnPlayer\Beschleunigung# = -20
	
	For Players = Each TPlayers
		If MilliSecs()-Players\LastReceived > 10000 And Players\IP <> 50 Then
			Delete Players
		End If
	Next
;##############################################	
	
;##############################################
End Function
;################################################## Hier werden alle Spieler gezeichnet
Function DrawPlayers()
	For Players = Each TPlayers
		If Players\PlayerImage <> 0 Then
			If HUD_GetDistance(OwnPlayer\X, OwnPlayer\Y, Players\X, Players\Y) < 200 Then
				HUD_SetObjectAlpha(Players\PfeilObjekt, 0.0)
			Else
				HUD_SetObjectAlpha(Players\PfeilObjekt, 0.8)
			End If
			HUD_SetObjectOrigin(Players\PlayerImage, 0,0)
			HUD_PositionObject(Players\PlayerImage, -(Players\X#-CameraX)+GraphicsWidth()/2, -(Players\Y#-CameraY)+GraphicsHeight()/2)
			HUD_SetObjectRotation(Players\PlayerImage, Players\Rotation#)
			If Players\PfeilObjekt <> 0 And Players\IP <> 50 Then
				HUD_SetObjectOrigin(Players\PfeilObjekt, 0,0)
				HUD_PositionObject(Players\PfeilObjekt,  -(OwnPlayer\X#-CameraX)+GraphicsWidth()/2, -(OwnPlayer\Y#-CameraY)+GraphicsHeight()/2)
				HUD_SetObjectRotation(Players\PfeilObjekt, Angle2D(-(OwnPlayer\X#-CameraX)+GraphicsWidth()/2, -(OwnPlayer\Y#-CameraY)+GraphicsHeight()/2,-(Players\X#-CameraX)+GraphicsWidth()/2, -(Players\Y#-CameraY)+GraphicsHeight()/2)-270)
			End If
			HUD_UpdateShape(Players\EnergieShape, "PERCENTBAR", Players\Leben/100*100, 1,-(Players\X#-CameraX)+GraphicsWidth()/2, -(Players\Y#-CameraY)+GraphicsHeight()/2+35,60,8)
			HUD_SetObjectColor(Players\EnergieShape, 255-(Players\Leben#*2.5),Players\Leben#*2.5,0,0.8)
		End If
	Next
	
	If HUD_GetDistance(OwnPlayer\X, OwnPlayer\Y, 0,0) < 300 Then
		HUD_SetObjectAlpha(OwnPlayer\PfeilObjekt, 0.0)
	Else
		HUD_SetObjectAlpha(OwnPlayer\PfeilObjekt, 0.8)
	End If
	HUD_SetObjectOrigin(OwnPlayer\PfeilObjekt, 0,0)
	HUD_PositionObject(OwnPlayer\PfeilObjekt, -(OwnPlayer\X#-CameraX)+GraphicsWidth()/2, -(OwnPlayer\Y#-CameraY)+GraphicsHeight()/2)
	HUD_SetObjectRotation(OwnPlayer\PfeilObjekt,Angle2D(OwnPlayer\X, OwnPlayer\Y,0,0)-90)
	HUD_PositionObject(Sicherheits_Shape, CameraX+400, CameraY+300)
	For Schuss = Each TSchuss
		HUD_PositionObject(Schuss\SchussObjekt, -(Schuss\X#-CameraX)+GraphicsWidth()/2, -(Schuss\Y#-CameraY)+GraphicsHeight()/2)
		If MilliSecs()-Schuss\LastMove > 20 Then
			Schuss\X# = (Schuss\X#+((Schuss\Speed#)*Cos(Schuss\Rotation#)))
			Schuss\Y# = (Schuss\Y#+((Schuss\Speed#)*Sin(Schuss\Rotation#)))
			Schuss\Speed# = Schuss\Speed# - 0.1
		End If
		If HUD_ObjectHitsObject(Schuss\SchussObjekt, OwnPlayer\PlayerImage) And Schuss\SpielerIP <> 50 Then
			HUD_FX_Rumble(OwnPlayer\PlayerImage, 10, 500, 0)
			OwnPlayer\Leben# = OwnPlayer\Leben#-10
			If OwnPlayer\Leben# < 1.0 Then	
				HUD_ClearEffects(OwnPlayer\PlayerImage)
				OwnPlayer\X# = Rand(-10, 10)
				OwnPlayer\Y# = Rand(-10, 10)
				OwnPlayer\Rotation = Rand(0,360)
				OwnPlayer\Leben# = 100.0
				OwnPlayer\SchussKraft# = 0.0
				Schuss\SpielerIP = 50
			End If
		End If
		If Schuss\Speed# <= 5.0 Or HUD_GetDistance(Schuss\X#, Schuss\Y#, 0,0) < 250 Then
			HUD_RemoveObject Schuss\SchussObjekt
			Delete Schuss
		End If
	Next
End Function
;################################################## Naja, meine mehr oder weniger tolle Netzwerkfunktion.
Function NetWorkData()
   ;########### Empfangen
	While 1
		RemoteIP = RecvUDPMsg(OwnUDPStream)
		If RemoteIP = 0 Then
			Exit
		Else
			For Players = Each TPlayers
				If Players\IP = RemoteIP Then
					Success = 1 : Exit
				End If
			Next
			If Success = 0 Then
				Players.TPlayers = AddPlayer.TPlayers(RemoteIP,0)
			End If
			Players\LastReceived = MilliSecs()
			Success = 0
			Command = ReadInt(OwnUDPStream)
			If Command = 1 Then
				Players\X# = ReadFloat(OwnUDPStream)
				Players\Y# = ReadFloat(OwnUDPStream)
				Players\Rotation# = ReadFloat(OwnUDPStream)
				Players\Leben = ReadInt(OwnUDPStream)
				Players\IP = RemoteIP
				Players\Port = ReadInt(OwnUDPStream)
			ElseIf Command = 2 Then
				While ReadAvail(OwnUDPStream) > 0 
					NewIP = ReadInt(OwnUDPStream)
					NewPort = ReadInt(OwnUDPStream)
					Success = 0
					For Players = Each TPlayers
						If NewIP = Players\IP Then
							Success = 1 : Exit
						End If
					Next
					If Success = 0 Then
						Players.TPlayers = AddPlayer.TPlayers(NewIP,  NewPort)
					End If				
				Wend
			ElseIf Command = 3 Then
				For Players = Each TPlayers
					If Players\IP = RemoteIP Then
						rgb = ReadInt(OwnUDPStream)
						HUD_SetObjectColor(Players\PlayerImage, (rgb And $FF0000)/$10000 , (rgb And $FF00)/$100,rgb And $FF)
						HUD_SetObjectColor(Players\PfeilObjekt, (rgb And $FF0000)/$10000 , (rgb And $FF00)/$100,rgb And $FF)
						Exit
					End If	
				Next
			ElseIf Command = 4 Then
				Schuss = New TSchuss
				Schuss\X#  = ReadFloat(OwnUDPStream)
				Schuss\Y# = ReadFloat(OwnUDPStream)
				Schuss\Speed# = ReadFloat(OwnUDPStream)
				Schuss\Rotation = ReadInt(OwnUDPStream)
				Schuss\Farbe = ReadInt(OwnUDPStream)
				Schuss\SpielerIP = RemoteIP
				Schuss\SchussObjekt = HUD_CreateImage(Schuss_Layer, Schuss\X#, Schuss\Y#,  0,0,16,16)
				rgb = Schuss\Farbe
				bla# = HUD_GetDistance(OwnPlayer\X, OwnPlayer\Y, Schuss\X#, Schuss\Y#)
				merkvolume# = 0.5-(bla#/1000.0)
				If merkvolume# > 0.0 Then
					SoundVolume(PanzerSchussSound, merkvolume#)
					PlaySound PanzerSchussSound
					SoundVolume(PanzerSchussSound, 1.0)
				End If
				HUD_SetObjectColor(Schuss\SchussObjekt, (rgb And $FF0000)/$10000 , (rgb And $FF00)/$100,rgb And $FF)
			ElseIf Command = 5 Then
				Explosion = New TExplosion
				Explosion\X# = ReadFloat(OwnUDPStream)
				Explosion\Y# = ReadFloat(OwnUDPStream)
				Explosion\Rotation# = ReadFloat(OwnUDPStream)
				Explosion\AnimationObject = HUD_CreateImage(Explosions_Layer, 0,0,0,0,128, 128)
				;HUD_AnimateImage(Explosion\AnimationObject, 0,0, 64, 64, "NORMAL", 1, 30)
			End If
		End If	
	Wend
	;############################################## Senden
	If MilliSecs()-LastPositionSend > 30 Then
		For Players = Each TPlayers
			If Players\IP <> 50 Then
				WriteInt OwnUDPStream, 1
				WriteFloat OwnUDPStream, OwnPlayer\X#
				WriteFloat OwnUDPStream, OwnPlayer\Y#
				WriteFloat OwnUDPStream, OwnPlayer\Rotation#
				WriteInt OwnUDPStream, OwnPlayer\Leben
				WriteInt OwnUDPStream, UDPStreamPort(OwnUDPStream)
				SendUDPMsg OwnUDPStream, Players\IP, Players\Port
			End If
			LastPositionSend = MilliSecs()
		Next
	End If	
	;##############################################
	If MilliSecs()-LastIPListSend > 500 Then
		For SendThrough.TPlayers = Each TPlayers
			If SendThrough\IP <> 50 Then
				WriteInt OwnUDPStream, 2
				For Players = Each TPlayers
					If SendThrough\IP <> Players\IP And Players\IP <> 50 Then
						WriteInt OwnUDPStream, Players\IP
						WriteInt OwnUDPStream, Players\Port
					End If
				Next
				SendUDPMsg OwnUDPStream, SendThrough\IP, SendThrough\Port
			End If	
		Next
		LastIPListSend = MilliSecs()
	End If
	;##############################################
	If MilliSecs()-LastColorSend > 300 Then
		LastColorSend = MilliSecs()
		For Players = Each TPlayers
			If Players\IP <> 50 Then
				WriteInt OwnUDPStream, 3
				WriteInt OwnUDPStream, GUI_GetGadgetValue(GUI_FarbPicker)
				SendUDPMsg(OwnUDPStream, Players\IP, Players\Port)
			End If
		Next
	End If
	;##############################################
	If OwnPlayer\Farbe <> GUI_GetGadgetValue(GUI_FarbPicker) Then
		OwnPlayer\Farbe = GUI_GetGadgetValue(GUI_FarbPicker)
		HUD_SetObjectColor(OwnPlayer\PlayerImage, (GUI_GetGadgetValue(GUI_FarbPicker) And $FF0000)/$10000 , (GUI_GetGadgetValue(GUI_FarbPicker) And $FF00)/$100,GUI_GetGadgetValue(GUI_FarbPicker) And $FF)
		For Players = Each TPlayers
			If Players\IP <> 50 Then
				WriteInt OwnUDPStream, 3
				WriteInt OwnUDPStream, GUI_GetGadgetValue(GUI_FarbPicker)
				SendUDPMsg(OwnUDPStream, Players\IP, Players\Port)
			End If
		Next
	End If
End Function
;################################################## Aus Blitzbase geklaut, um eine String IP in eine Integer IP zu verwandeln.
Function INT_IP(IP$)
	a1=Int(Left(IP$,Instr(IP$,".")-1)):IP$=Right(IP$,Len(IP$)-Instr(IP$,"."))
	a2=Int(Left(IP$,Instr(IP$,".")-1)):IP$=Right(IP$,Len(IP$)-Instr(IP$,"."))
	a3=Int(Left(IP$,Instr(IP$,".")-1)):IP$=Right(IP$,Len(IP$)-Instr(IP$,"."))
	a4=Int(IP$)
	Return ((a1 Shl 24) + (a2 Shl 16) + (a3 Shl 8 ) +a4)
End Function
;################################################## Otherstuff umfasst die anzeige des Eigenen Ports und ein Joinmenü, wenn man leertaste drückt.
Function CheckGUI()
	ButtonClicked = GUI_GetClickedGadget()
	Select ButtonClicked
		Case GUI_JoinButton
			If GUI_GetGadgetText(GUI_JoinIP) = "IP" Or GUI_GetGadgetText(GUI_JoinPort) = "PORT" Then
				Return 0
			End If
			AddPlayer.TPlayers(INT_IP(GUI_GetGadgetText(GUI_JoinIP)),  GUI_GetGadgetText(GUI_JoinPort))
			GUI_SetGadgetText(GUI_JoinIP, "IP")
			GUI_SetGadgetText(GUI_JoinPort, "PORT")
	End Select
End Function
;################################################## Die Hauptschleife
Global FPSTimer = CreateTimer(30)
;##################################################
Function AddPlayer.TPlayers(IP, Port)
	Players = New TPlayers
	Players\LastReceived = MilliSecs()
	Players\PfeilObjekt = HUD_CreateImage(Radar_Layer, 0,0,0,0,32,32)
	Players\IP = (IP)
	Players\Port = (Port)
	Players\Leben = 100
	Players\PlayerImage = HUD_CreateImage(Tank_Layer, 0,0,0,0,64,64) 
	HUD_SetObjectOrigin(Players\PlayerImage, 0,0)
	HUD_SetObjectShadow(Players\PlayerImage, 3, 3.0)	
	Players\EnergieShape = HUD_CreateShape(Energie_Shape, "PERCENTBAR", 100, 1,0,0,60,8)
	HUD_SetObjectColor(Players\EnergieShape, 0,255,0,0.8)
	Return Players
End Function
;##################################################
Repeat
	WaitTimer FPSTimer
	TileBlock Backgroundimage, CameraX, CameraY
   ;##############################################
	NetWorkData()
	CheckGUI()
	PlayerControls()
	DrawPlayers()
	HUD_Update() : GUI_Update() : RenderWorld()
	Flip 1
	Cls()
Until KeyHit(1)