Wenn ich das programm starte wird es immer langsamer und langsamer und irgentwan ist es aus.Was tun?
Code: Alles auswählen
;TST 03
InitSprite()
InitKeyboard()
OpenScreen(1024,768,32,"TST 2")
CreateSprite(0,64,64)
StartDrawing( SpriteOutput(0) )
Circle(32,32,16,$ff0000)
StopDrawing()
CreateSprite(50,64,64)
StartDrawing( SpriteOutput(2))
Box(2,2,60,60,$aa6666)
StopDrawing()
SetFrameRate(70)
Structure Mauer
x.w
y.w
Image.w
mauer.w
EndStructure
NewList Mauer .Mauer()
Procedure Obj(Sprite, x, y,mauer)
AddElement(Mauer())
Mauer()\x = x
Mauer()\y = y
Mauer()\Image = Sprite
Mauer()\mauer = mauer
EndProcedure
Procedure Ojball(Sprite, x, y,mauer)
AddElement(Mauer())
Mauer()\x = x
Mauer()\y = y
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+64
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+128
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+192
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\y = y+0
Mauer()\x = x+256
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+320
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+384
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+448
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+512
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+576
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+640
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+192
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+704
Mauer()\Image = Sprite
Mauer()\mauer = mauer
AddElement(Mauer())
Mauer()\x = x+0
Mauer()\y = y+256
Mauer()\Image = Sprite
Mauer()\mauer = mauer
EndProcedure
lvl = 1
playergo = 0
Repeat
ExamineKeyboard()
If lvl = 1
Gosub iniobj
Gosub grundgras
Gosub steuerung
Gosub collision
DisplayTransparentSprite(0, offX,offY)
EndIf
FlipBuffers()
ClearScreen(0,0,0)
Until KeyboardReleased(#PB_Key_Escape)
steuerung :
If KeyboardReleased(#PB_Key_Right) And playergo = 0
offX+64
playergo = 7
go = 1
EndIf
If KeyboardReleased(#PB_Key_Left) And playergo = 0
offX-64
playergo = 7
go = 2
EndIf
If KeyboardReleased(#PB_Key_Up) And playergo = 0
offY-64
playergo = 7
go = 3
EndIf
If KeyboardReleased(#PB_Key_Down) And playergo = 0
offY+64
playergo = 7
go = 4
EndIf
If offX < 0
offX = 0
EndIf
If offY < 0
offY = 0
EndIf
If offy > 704
offY = 704
EndIf
If offX > 960
offX = 960
EndIf
playergo - 1
If playergo < 0
playergo = 0
EndIf
StartDrawing(ScreenOutput())
FrontColor(225,225,225)
DrawingMode(1)
Locate(10,0)
DrawText(Str(offX))
Locate(10,10)
DrawText(Str(offY))
StopDrawing()
Return
collision :
ResetList(Mauer())
While NextElement(Mauer())
If SpriteCollision(0,offx,offy,Mauer()\Image,Mauer()\x,mauer()\y)
If go = 1 And Mauer()\x = offX And Mauer()\y = offY And Mauer()\mauer = 1
offx - 64
EndIf
If go = 2 And Mauer()\x = offX And Mauer()\y = offY And Mauer()\mauer = 1
offx + 64
EndIf
If go = 3 And Mauer()\x = offX And Mauer()\y = offY And Mauer()\mauer = 1
offy + 64
EndIf
If go = 4 And Mauer()\x = offX And Mauer()\y = offY And Mauer()\mauer = 1
offy - 64
EndIf
EndIf
Wend
Return
iniobj :
ResetList(Mauer())
While NextElement(Mauer())
DisplayTransparentSprite(Mauer()\Image,Mauer()\x, Mauer()\y)
Wend
Return
grundgras :
Ojball(50,0,0,0)
Ojball(50,64,0,0)
Ojball(50,128,0,0)
Ojball(50,192,0,0)
Ojball(50,256,0,0)
Ojball(50,320,0,0)
Ojball(50,384,0,0)
Ojball(50,448,0,0)
Ojball(50,512,0,0)
Ojball(50,576,0,0)
Ojball(50,640,0,0)
Ojball(50,704,0,0)
Ojball(50,768,0,0)
Ojball(50,832,0,0)
Ojball(50,896,0,0)
Ojball(50,960,0,0)
Return
