I'm trying to create a very simple game, where I move a rectangle with the mouse.
The problem is that the move of the box isn't smooth, it looks like the game is using a lot of cpu...
Here is the code:
Code: Select all
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Error", 0)
End
EndIf
UsePNGImageDecoder()
If OpenScreen(640, 480, 16, "Sprite")
LoadSprite(0, "box.png", 0)
Repeat
FlipBuffers()
ClearScreen(RGB(0,0,0))
ExamineMouse()
x = MouseX()
y = MouseY()
DisplaySprite(0, x, y)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
EndIf
End
Thanks!