Code: Alles auswählen
;***DLL-Freak´s StandartScreen***
; *07.12.2006*
InitSprite()
InitKeyboard()
OpenScreen(1280,800,32,"StandartScreen")
#Var = 3
#Width=20
#Height=20
;-Bodentexturen erstellen
For x = 0 To #Var
CreateSprite(x,32,32)
StartDrawing(SpriteOutput(x))
Box(0,0,32,32,RGB(20,140,20))
For n = 0 To 2000
grn = Random(255)
rt = Random(grn/1.5)
bl = Random(grn/2)
Line(Random(31),Random(31),0,Random(2),RGB(rt,grn,bl))
Next
StopDrawing()
Next
;-Bodenlayer zuordnen
Dim flr(#Width,#Height)
For x = 0 To #Width:For y = 0 To #Height
flr(x,y) = Random(#Var)
Next:Next
;-Ein Layer erzeugen
CreateSprite(#Var + 1,32,32)
StartDrawing(SpriteOutput(#Var + 1))
For x = 0 To 8
Line(x*4,0,0,32,RGB(255,0,0))
Line(0,x*4,32,0,RGB(255,0,0))
Next
StopDrawing()
TransparentSpriteColor(#Var + 1,0)
;-Layermap zuordnen
Dim lyr(#Width,#Height)
For x = 0 To #Width:For y = 0 To #Height
lyr(x,y) = Random(1)
Next:Next
;-Char erzeugen
CreateSprite(#Var + 2,32,64)
StartDrawing(SpriteOutput(#Var + 2))
Box(8,16,16,48,RGB(255,255,0))
Box(8,32,16,6,RGB(255,0,0))
Circle(15,12,12,RGB(180,100,10))
StopDrawing()
TransparentSpriteColor(#Var + 2,0)
Repeat
ExamineKeyboard()
;-Karte scrollen
If KeyboardPushed(#PB_Key_W)
vy - 5
ElseIf KeyboardPushed(#PB_Key_S)
vy + 5
EndIf
If KeyboardPushed(#PB_Key_A)
vx - 5
ElseIf KeyboardPushed(#PB_Key_D)
vx + 5
EndIf
;-Spieler bewegen
If KeyboardReleased(#PB_Key_Up)
If pposy > 0
pposy - 1
EndIf
ElseIf KeyboardReleased(#PB_Key_Down)
If pposy < #Height
pposy + 1
EndIf
EndIf
If KeyboardReleased(#PB_Key_Left)
If pposx > 0
pposx - 1
EndIf
ElseIf KeyboardReleased(#PB_Key_Right)
If pposx < #Width
pposx + 1
EndIf
EndIf
;-Bodentexturen darstellen
For x = 0 To #Width:For y = 0 To #Height
DisplaySprite(flr(x,y),x*32-vx,y*32-vy)
Next:Next
;-Layer und Char darstellen
For x = 0 To #Width:For y = 0 To #Height
If x = pposx And y = pposy
DisplayTransparentSprite(#Var + 2,pposx*32-vx,pposy*32-vy-32) ;Char darstellen
EndIf
If lyr(x,y)
DisplayTransparentSprite(#Var + 1,x*32-vx,y*32-vy) ; Layer darstellen
EndIf
Next:Next
;-Bildschirm zeichnen und löschen
FlipBuffers()
ClearScreen(0)
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()
Bei mir funzt der Code oben perfekt.