Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

Why doesn't this work

$
0
0
In the game there are either 1 player or 2 players. When there is only 1 player then I want the ball colors to switch colors back and forth so when it is white's turn then white balls are on the board and when it is black's turn then black balls are on the board.

ShowBalls is a Function

Const White = 1 and Const Black = 2

Variable BallColor toggles the player's color each pass through PlaceBallOnSquare

The following works:

Code:

Private Sub PlaceBallOnSquare()
  '
  '
 If BallColor = White Then
  If Players = 1 Then ShowBalls Black
 Else
  If Players = 1 Then ShowBalls White
 End If
  '
  '
End Sub


....but this does not work:

1st time through BallColor = White, 2nd time through BallColor = Black

The ball colors do not change from white to black on 1st time

Code:

  '
  '
 IIf BallColor = White And Players = 1, ShowBalls(Black), ShowBalls(White)
  '
  '


Viewing all articles
Browse latest Browse all 21237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>