View Full Version : VB help! making connect 4 game

04-30-2004, 06:52 PM
I have to make a 2 player game of connect 4 using visual basic!
I have created the gui, and written the code to enter player names!
I keep confusing myself on how to get it to work :confused:
use a counter to count who's turn it is?? confused! can anyone help??

04-30-2004, 07:38 PM
This is a homework assignment isn't it? I had to write a program in college to simulate the connect 4 game. It was in java though.

04-30-2004, 08:09 PM
just part of a module! can you help?

04-30-2004, 09:21 PM
So how do you want us to help exactly? You could use a counter to keep track of whose turn it is using modulus. If there are 2 players, counter mod 2 will result in 0 if it's player 1 or 1 if it's player 2.

Is that all?

Check out planet-source-code (http://www.planet-source-code.com), I wouldn't be surprised if this project is available for download. (Why re-invent the wheel? Unless this is a school project of course..)

Hope that helps,

05-01-2004, 08:47 AM
A Boolean is better for a token in a two player game:

Dim Turn1P as Boolean

Sub SwitchTurns()
Turn1P = Not Turn1P
' now add extra code to handle turn switching according to Turn1P
End Sub