Mouse emulating joystick challenge

Blitz3D Forums/Blitz3D Programming/Mouse emulating joystick challenge

I still have trouble understanding what you want to do exactly, but I hope this code helps a bit:
Graphics 800, 600, 0, 2
SetBuffer BackBuffer()

Repeat

	Cls
	
	;get mousexspeed (mxs) and mouseyspeed (mys)
	mxs = MouseXSpeed()
	mys = MouseYSpeed()
	
	;move (px, py) using these values
	px = px + mxs
	py = py + mys
	
	;reset mouse to middle of the screen
	MoveMouse 400, 300
	
	;get direction
	dirX = Sgn(mxs)
	dirY = Sgn(mys)
	
	;calculate speed
	speedX = Abs(mxs)
	speedY = Abs(mys)
	
	;print variables
	Text 0, 0, "mouse position: " + px + "," + py
	Text 0, 20, "x/y direction:" + dirX + "," + dirY
	Text 0, 40, "x/y speed: " + speedX + "," + speedY
	
	;space = reset
	If KeyHit(57) Then px = 0: py = 0
	
	Flip

Until KeyHit(1)