For some reason the game seems to completly ignore the function. Some 1 help plz
graphics 800,600,32,2
Global controller
global x
global y
global frame
print"select controller device"
Print"0 = mouse"
Print"1 = joystick"
Print"2 = keyboard"
.ask_for_controller
controller = input("")
if controller > 2 or controller < 0 then goto ask_for_controller
while not keydown(1)
controller_control()
plot x,y
flip
cls
wend
Function controller_control()
Select controller
Case 0
If MouseX() > x Then
x = x + speed
frame = Rand(0,5)
EndIf
If MouseX() < x Then
x = x - speed
frame = Rand(0,5)
EndIf
If MouseY() > y Then
y = y + speed
frame = Rand(0,5)
EndIf
If MouseY() < y Then
y = y - speed
frame = Rand(0,5)
EndIf
Case 1
If JoyX() > 0.5 Then
x = x + speed
frame = Rand(0,5)
EndIf
If JoyX() < -0.5 Then
x = x - speed
frame = Rand(0,5)
EndIf
If JoyY() > 0.5 Then
y = y + speed
frame = Rand(0,5)
EndIf
If JoyY() < -0.5 Then
y = y - speed
frame = Rand(0,5)
EndIf
Case 2
If KeyDown(200)
y = y - speed
frame = Rand(0,5)
EndIf
If KeyDown(208)
y = y + speed
frame = Rand(0,5)
EndIf
If KeyDown(205)
x = x + speed
frame = Rand(0,5)
EndIf
If KeyDown(203)
x = x - speed
frame = Rand(0,5)
EndIf
End Select
End Function
|