wenn ich das proggram starte,macht es zwei objekte,doch nur eines ist
eine richtige wand.
hier der code
Code: Alles auswählen
;TST 02
InitSprite()
InitKeyboard()
OpenScreen(1024,768,32,"TST 2")
CreateSprite(0,64,64)
StartDrawing( SpriteOutput(0) )
Circle(32,32,16,$ff0000)
StopDrawing()
CreateSprite(2,64,64)
StartDrawing( SpriteOutput(2))
Box(2,2,60,60,$aa6666)
StopDrawing()
Structure Mauer
x.w
y.w
Image.w
EndStructure
NewList Mauer .Mauer()
lvl = 1
playergo = 0
Repeat
ExamineKeyboard()
StartDrawing(ScreenOutput())
FrontColor(225,225,225)
DrawingMode(1)
Locate(10,0)
DrawText(Str(offX))
Locate(10,10)
DrawText(Str(offY))
StopDrawing()
Gosub iniobj
If lvl = 1
AddElement(Mauer())
Mauer()\x = 64
Mauer()\y = 128
Mauer()\Image = 2
AddElement(Mauer())
Mauer()\x = 64
Mauer()\y = 0
Mauer()\Image = 2
EndIf
Gosub steuerung
Gosub collision
DisplayTransparentSprite(0, offX,offY)
FlipBuffers()
ClearScreen(0,0,0)
Until KeyboardReleased(#PB_Key_Escape)
steuerung :
If KeyboardPushed(#PB_Key_Right) And playergo = 0
offX+64
playergo = 10
go = 1
EndIf
If KeyboardPushed(#PB_Key_Left) And playergo = 0
offX-64
playergo = 10
go = 2
EndIf
If KeyboardPushed(#PB_Key_Up) And playergo = 0
offY-64
playergo = 10
go = 3
EndIf
If KeyboardPushed(#PB_Key_Down) And playergo = 0
offY+64
playergo = 10
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
Return
collision :
If SpriteCollision(0,offx,offy,Mauer()\Image,Mauer()\x,mauer()\y)
If go = 1 And Mauer()\x = offX And Mauer()\y = offY
offx - 64
EndIf
If go = 2 And Mauer()\x = offX And Mauer()\y = offY
offx + 64
EndIf
If go = 3 And Mauer()\x = offX And Mauer()\y = offY
offy + 64
EndIf
If go = 4 And Mauer()\x = offX And Mauer()\y = offY
offy - 64
EndIf
EndIf
Return
iniobj :
ResetList(Mauer())
While NextElement(Mauer())
DisplayTransparentSprite(Mauer()\Image,Mauer()\x, Mauer()\y)
Wend
Return