mouse wheel prob
Blitz3D Forums/Blitz3D Beginners Area/mouse wheel prob
| ||
How can i stop the tileindex from increasing/decreasing constantly? I thought I could use the code mousewheel=MouseZ () If mousewheel>0 Then tileindex=tileindex+1 : mousewheel=0 If mousewheel<0 Then tileindex=tileindex-1 : mousewheel=0 so that 'tileindex' would go up or down once then set 'mousewheel' to 0. What happens is once I move the mousewheel up or down it cycles through my tiles and doesnt stop. Any ideas why? thanks |
| ||
I think this should do it:wheel_dir = MouseZSpeed() If wheel_dir > 0 tileindex = tileindex + (1 And (tileindex < lastindex)) ElseIf wheel_dir < 0 tileindex = tileindex - (1 And (tileindex > firstindex)) EndIf |
| ||
or alternatively:mousewheel=MouseZ() If mousewheel>MlastPos Then tileindex=tileindex+1 : MlastPos = mousewheel If mousewheel<MlastPos Then tileindex=tileindex-1 : MlastPos = mousewheel |