Posted: 27th May 2021 15:12
i have something like this to set up the joystick detction
+ Code Snippet
	for i = 1 to 8
		if GetRawJoystickExists(i)
			tmpplayer.joyID=i
			player.insert(tmpPlayer)
		endif    
		//sync()
	next i

Then i have this
+ Code Snippet
	if GetRawKeyState(KEY_UP) or GetRawJoystickY( player[0].joyID) <0 //or buttonHit=UpSpr
		if lastMoveY=0 or lastmoveY=2
			player[0].SpeedY#=minSpeed#
		endif
		lastMoveY=1:SetSpriteColor(UpSpr,100,100,100,255):SetSpriteColor(DownSpr,0,100,0,255)
		player[0].SpeedY#=player[0].SpeedY#+((maxSpeed#-player[0].SpeedY#)*AccelerationFactor#)
		if Speed#>maxSpeed# then Speed#=maxSpeed#
	elseif GetRawKeyState(KEY_DOWN) or GetRawJoystickY( player[0].joyID) >0  //or buttonHit=DownSpr
		if lastMoveY=0 or lastMoveY=1
			player[0].SpeedY#=minSpeed#
		endif
		lastMoveY=2:SetSpriteColor(DownSpr,100,100,100,255):SetSpriteColor(UpSpr,0,100,0,255)
		player[0].SpeedY#=player[0].SpeedY#+((maxSpeed#-player[0].SpeedY#)*(AccelerationFactor#))
		if player[0].SpeedY#>maxSpeed# then player[0].SpeedY#=maxSpeed#		
	else
		player[0].SpeedY#=player[0].SpeedY#-((maxSpeed#-player[0].SpeedY#)*DecelerationFactor#+.01)
		if player[0].SpeedY#<minSpeed# then player[0].SpeedY#=minSpeed#
		SetSpriteColor(UpSpr,0,100,0,255)
		SetSpriteColor(DownSpr,0,100,0,255)
	endif
	
	if GetRawKeyState(KEY_LEFT) or GetRawJoystickX( player[0].joyID) <0 //.5 //GetDirectionX()<0 or buttonHit = LeftSpr
		if lastMoveX=0 or lastMoveX=2
			player[0].SpeedX#=minSpeed#
		endif
		lastMoveX=1:SetSpriteColor(LeftSpr,100,100,100,255):SetSpriteColor(RightSpr,0,100,0,255)
		player[0].AccelerationFactorX#=GetDirectionSpeed()*.025
		player[0].SpeedX#=player[0].SpeedX#+((maxSpeed#-player[0].SpeedX#)*player[0].AccelerationFactorX#)
		if player[0].SpeedX#>maxSpeed# then player[0].SpeedX#=maxSpeed#
	elseif GetRawKeyState(KEY_RIGHT) or GetRawJoystickX( player[0].joyID)>0 //.5 //or GetDirectionX()>0 or buttonHit = rightSpr
		if lastMoveX=0 or lastMoveX=1
			player[0].SpeedX#=minSpeed#
		endif
		lastMoveX=2:SetSpriteColor(RightSpr,100,100,100,255):SetSpriteColor(LeftSpr,0,100,0,255)		
		player[0].AccelerationFactorX#=GetDirectionSpeed()*.025
		player[0].SpeedX#=player[0].SpeedX#+((maxSpeed#-player[0].SpeedX#)*(player[0].AccelerationFactorX#))
		if player[0].SpeedX#>maxSpeed# then player[0].SpeedX#=maxSpeed#		
	else
		player[0].DecelerationFactorX#=GetDirectionSpeed()*.025
		player[0].SpeedX#=player[0].SpeedX#-((maxSpeed#-player[0].SpeedX#)*player[0].DecelerationFactorX#+.01)
		if player[0].SpeedX#<minSpeed# then player[0].SpeedX#=minSpeed#
		SetSpriteColor(LeftSpr,0,100,0,255)
		SetSpriteColor(RightSpr,0,100,0,255)
	endif
	

The the arrow keys work perfectly for movement
but up and down joystick works if i use left right arrow keys things are fine
left right works if i use up down arrow keys
but i cant get the joystick to work diagonally even tho the spites i have on screen to display movement appear to work correctly sometimes

just cant get to move left or right with the joystick up / down

im sure theres something wrong in the code just why does the keyboard work perfectly is there a refresh state or something i should do

Thanks in advace

PS:I have placeholders in place for multiplayer but cant add that until i get the joystick to read properly
Posted: 27th May 2021 17:04
At a glance, is your joystick set to digital or analog? If digital, anything under 0.5 will cast as 0 since ur using integer variables while raw joystick commands return floats for x/y.

NMD... that's not it ("//.5")
Posted: 27th May 2021 22:01
Thanks VN
[s]Even if i replace either up/down joy or left/right joy for buttons i still get the same issues[/s]
it was my logic

the problen was GetDirectionSpeed() needed to be replaced with GetRawJoystickX( player[0].joyID)