Mouse behaves correctly without gravity.
authorPio <[email protected]>
Thu, 17 Jan 2019 20:42:03 +0000 (17 21:42 +0100)
committerPio <[email protected]>
Thu, 17 Jan 2019 20:42:03 +0000 (17 21:42 +0100)
gbg.bas

diff --git a/gbg.bas b/gbg.bas
index c156980..60ae505 100644 (file)
--- a/gbg.bas
+++ b/gbg.bas
@@ -806,7 +806,7 @@ Function windowmouse(mode As String) As String
                Case EVENT_MOUSE_BUTTON_PRESS
                        If mode = "gameover" Then Return " " 'Space=end gameover
                        If settings.play_mouse Then
-                               If e.button=1 Then
+                               If e.button=1 And gravity Then
                                        If settings.first_button_turning And Int(e.y  / tilewidth - blok.y) <= 0 Then
                                                Return " " 'Space = turn
                                        Else
@@ -819,16 +819,21 @@ Function windowmouse(mode As String) As String
                        End If
                        If Not settings.play_mouse Or e.button>2 Then Return Chr(27) 'Esc = open menu
                Case EVENT_MOUSE_BUTTON_RELEASE
-                       If settings.play_mouse Then
-                               If e.button=1 And blok.dropping Then Return Chr(13) 'Enter = drop
+                       If settings.play_mouse And e.button=1 Then
+                               If Not gravity Or blok.dropping Then Return Chr(13) 'Enter = drop
                        End If
                Case EVENT_WINDOW_CLOSE
                        quit()
                Case EVENT_MOUSE_MOVE
-                       If e.x > 0 And e.x < game.w And settings.play_mouse And mode <> "gameover" Then
+                       If e.x > 0 And e.x < game.w And settings.play_mouse And mode <> "gameover"Then
                                While Int(e.x  / tilewidth - blok.x) <> 0 And blok.move(Sgn(Int(e.x  / tilewidth - blok.x)))
                                WEnd
-                               If blok.dropping Then drop_but_dont_fix(e.y)
+                               If gravity Then
+                                       If blok.dropping Then drop_but_dont_fix(e.y)
+                               Else
+                                       While Int(e.y  / tilewidth - blok.y) <> 0 And blok.move(0, Sgn(Int(e.y  / tilewidth - blok.y)))
+                                       WEnd
+                               End If
                                drawplayfield()
                        End If
                End Select