|
Post by Ben on Dec 10, 2016 6:50:12 GMT
I want to use the mouse to move the camera, but I read that It only gives a value between 0 and 1. So how can I use this to get an actual 2D location that I can use to move the camera with?
|
|
|
Post by Tom on Dec 14, 2016 3:31:59 GMT
I want to use the mouse to move the camera, but I read that It only gives a value between 0 and 1. So how can I use this to get an actual 2D location that I can use to move the camera with? Hi, If you want the position in pixels, you can multiply by WindowWidth() and WindowHeight(). For example: ResizeSpriteArea(WindowWidth(), WindowHeight()) ' Position sprites in pixel coordinates TextMode(TEXT_BUFFERED) ' Don't update screen until DrawText() is called dim x, y NewSprite(LoadTex("gfx\Target.png")) ' Create a crosshair sprite
while true ' Read mouse x = Mouse_x() * WindowWidth() y = Mouse_y() * WindowHeight() cls: Print "x = "; x; ", y = "; y
' Position crosshair SprSetPos(x, y)
' Draw screen DrawText() wend
|
|