Code: Alles auswählen
;PB 3.94
InitSprite()
InitMouse()
InitKeyboard()
;- Image Plugins
UsePNGImageDecoder()
If OpenScreen(800,600,32,"IT") = 0
Debug 1
End
EndIf
LoadSprite(400,"GFX/Maus/Maus0.png")
TransparentSpriteColor(400, 255, 0, 255)
LoadSprite(450,"GFX/misc/close.png")
LoadSprite(501,"GFX/HPuMP.png")
hp = 100
mp = 100
HPMP = 1
HPMPx = 200
HPMPy = 200
HPMPh = SpriteHeight(501)
HPMPw = SpriteWidth(501)
ClBu = 1
Repeat
ExamineMouse()
ExamineKeyboard()
mousex = MouseX()
mousey = MouseY()
FlipBuffers():ClearScreen(255,255,255)
If ClBu = 1
DisplaySprite(450,580,0)
EndIf
If HPMP = 1
DisplaySprite(501, HPMPx, HPMPy)
If StartDrawing(ScreenOutput())
For y = 0 To 3
Line(HPMPx+6,HPMPy+16+y,hp,0,$0000FF)
Next y
For y = 0 To 3
Line(HPMPx+6,HPMPy+23+y,mp,0,$FF0000)
Next y
StopDrawing()
EndIf
EndIf
If StartDrawing(ScreenOutput())
Locate(50,200)
DrawText("HP : "+Str(hp))
Locate(50,220)
DrawText("MP : "+Str(mp))
Locate(50,250)
DrawText("Mouse(x,y) : "+Str(MouseX)+","+Str(MouseY))
Locate(50,280)
DrawText("Maus drückt : "+Str(MouseButton(1))+" move : "+Str(move))
StopDrawing()
EndIf
mb1 = MouseButton(1)
StartDrawing(ScreenOutput())
If mb1 = 1
If mousex <= HPMPx+112 And mousex >= HPMPx And mousey <= HPMPy+10 And mousey >= HPMPy And HPMP = 1
If move = 0
mousexmove = mousex - HPMPx
mouseymove = mousey - HPMPy
move = 1
EndIf
ElseIf mousex <= 600 And mousex >= 580 And mousey <= 20 And mousey >= 0 And ClBu = 1
End
Else
EndIf
EndIf
StopDrawing()
If move = 1
HPMPx = mousex - mousexmove
HPMPy = mousey - mouseymove
If HPMPx <= 0
HPMPx = 0
EndIf
If HPMPx >= 800 - HPMPw
HPMPx = 800 - HPMPw
EndIf
If HPMPy <= 0
HPMPy = 0
EndIf
If HPMPy >= 600 - HPMPh
HPMPy = 600 - HPMPh
EndIf
EndIf
If mb1_was = 1 And mb1 = 0
move = 0
EndIf
DisplayTransparentSprite(400, mousex, mousey)
If KeyboardReleased(#PB_Key_L)
If HPMP = 1
HPMP = 0
Else
HPMP = 1
EndIf
EndIf
SetFrameRate(50)
mb1_was = mb1
Until Quit
Aber wieso