Code: Alles auswählen
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0, 0, 0, 700, 700, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )
OpenWindowedScreen(WindowID(0), 0, 0, 700, 700, 0, 0, 0)
Enumeration
#Zeiger
#Wand
#Seite
#Unten
#Mitte
#Spieler
#kolli
EndEnumeration
#tileh = 20
#tilew = 20
#rrand = 640 - #tilew
#urand = 640 - #tileh
#orand = 20
#lrand = 20
SpielerX = #lrand
SpielerY = #orand
Anzahl = 11
CreateSprite(#Spieler, 20, 20)
StartDrawing(SpriteOutput(#Spieler))
Box(0, 0, 20, 20, RGB(0,0,255))
StopDrawing()
CreateSprite(#Zeiger, 20, 20)
StartDrawing(SpriteOutput(#Zeiger))
Box(0, 0, 20, 20, RGB(255,0,0))
StopDrawing()
CreateSprite(#Wand, 20, 20)
StartDrawing(SpriteOutput(#Wand))
Box(0, 0, 20, 20, RGB(255,255,0))
StopDrawing()
CreateSprite(#Seite, 60, 640)
StartDrawing(SpriteOutput(#Seite))
Box(0, 0, 60, 640, RGB(255,255,255))
StopDrawing()
CreateSprite(#Unten, 640, 60)
StartDrawing(SpriteOutput(#Unten))
Box(0, 0, 640, 60, RGB(255,255,255))
StopDrawing()
CreateSprite(#Mitte, 60, 60)
StartDrawing(SpriteOutput(#Mitte))
Box(0, 0, 60, 60, RGB(255,0,255))
StopDrawing()
CreateSprite(#kolli, 20, 20)
StartDrawing(SpriteOutput(#kolli))
Box(0, 0, 20, 20, RGB(150,0,0))
StopDrawing()
Structure waendekoords
xx.l
yy.l
EndStructure
Global NewList Waendelist.waendekoords()
Procedure Waende(x,y)
AddElement(Waendelist())
Waendelist()\xx = x
Waendelist()\yy = y
EndProcedure
Waende(20, 40)
Waende(40, 40)
Waende(60, 40)
Waende(80, 40)
Waende(100, 40)
Waende(120, 40)
Waende(20, 60)
Waende(40, 60)
Waende(60, 60)
Waende(80, 60)
Waende(100, 60)
Waende(120, 60)
Repeat
ExamineKeyboard()
ExamineMouse()
ClearScreen(0)
StartDrawing(SpriteOutput(#Mitte))
Box(0,0,60,60,RGB(255,0,255))
DrawingMode(1)
DrawText(10, 10, Str(ListIndex(Waendelist())))
DrawText(10, 20, Str(Aufladung))
LastElement(Waendelist())
DrawText(10, 30, Str(Waendelist()\yy))
StopDrawing()
MouX = MouseX()
MouY = MouseY()
CurX = MouX
CurY = MouY
If MouseButton(#PB_MouseButton_Left)
If Mausgedrueckt = 0 Or Mausgedrueckt = 1
Auflader + 10
If Auflader = 20
Aufladung + 20
Auflader = 0
EndIf
Mausgedrueckt = 1
EndIf
EndIf
Select ActBord
Case 0 ; Oberer Rand
If MouY > #tileh
If MouX < #tilew
ActBord = 3
ElseIf MouX > #rrand
ActBord = 1
EndIf
EndIf
CurY = 0
If MouseButton(#PB_MouseButton_Left) = 0 And Mausgedrueckt = 1 And Aufladung > #tileh
WandX = CurX
WandY = Aufladung
Aufladung = 0
Waende(WandX, WandY)
Anzahl + 1
Mausgedrueckt = 2
EndIf
Case 1 ;Rechter Rand
If MouX < #rrand
If MouY < #tileh
ActBord = 0
ElseIf MouY > #urand
ActBord = 2
EndIf
EndIf
CurX = #rrand
If MouseButton(#PB_MouseButton_Left) = 0 And Mausgedrueckt = 1 And Aufladung > #tilew
WandX = #rrand - Aufladung
WandY = CurY
Aufladung = 0
Waende(WandX, WandY)
Anzahl + 1
Mausgedrueckt = 2
EndIf
Case 2 ;Unterer Rand
If MouY < #urand
If MouX < #tilew
ActBord = 3
ElseIf MouX > #rrand
ActBord = 1
EndIf
EndIf
CurY = #urand
If MouseButton(#PB_MouseButton_Left) = 0 And Mausgedrueckt = 1 And Aufladung > #tileh
WandX = CurX
WandY = #urand - Aufladung
Aufladung = 0
Waende(WandX, WandY)
Anzahl + 1
Mausgedrueckt = 2
EndIf
Case 3 ;Linker Rand
If MouX > #tilew
If MouY < #tileh
ActBord = 0
ElseIf MouY > #urand
ActBord = 2
EndIf
EndIf
CurX = 0
If MouseButton(#PB_MouseButton_Left) = 0 And Mausgedrueckt = 1 And Aufladung > #tilew
WandX = Aufladung
WandY = CurY
Aufladung = 0
Waende(WandX, WandY)
Anzahl + 1
Mausgedrueckt = 2
EndIf
EndSelect
If CurX > #rrand
CurX = #rrand
EndIf
If CurY > #urand
CurY = #urand
EndIf
If SpielerX => #rrand - #tilew
Richtung = 1
ElseIf SpielerX <= #lrand
Richtung = 0
EndIf
If Richtung = 0
SpielerX + 1
ElseIf Richtung = 1
SpielerX - 1
EndIf
If MouseButton(#PB_MouseButton_Left) And Mausgedrueckt = 2
Mausgedrueckt = 0
EndIf
DisplaySprite(#Kolli, SpielerX, SpielerY + 20)
For c = 0 To Anzahl
SelectElement(Waendelist(), c)
DisplaySprite(#Wand, Waendelist()\xx, Waendelist()\yy)
Next
DisplaySprite(#Spieler, SpielerX, SpielerY)
DisplaySprite(#Seite, 640, 0)
DisplaySprite(#Unten, 0, 640)
DisplaySprite(#Mitte, 640, 640)
DisplaySprite(#Zeiger, CurX, CurY )
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End
ach und noch etwas wenn ich das ganze mit einem ereignis beenden will, dann läuft das spiel nicht mehr flüssig, wenn mir dabei viell. auch noch jmnd helfen könnte wäre das auch nett
€dit: oben beschreibung hinzugefügt und das problem mit dem beenden