|
-
May 24th, 2007, 09:04 PM
#1
Thread Starter
New Member
Game
How do you create a 2 player connect four game for visual basic ?
-
May 24th, 2007, 10:23 PM
#2
Re: Game
Are you doing this for fun, a class or what? I think it involves making an algorithm to check all the possibilities of a connect 4 win. You can search for connect 4 source code examples on google but most are made in java or c. Besides the algorithm, the gui would be the easier part. I would make labels for the ?x? # of squares. Then two buttons, player1 & player2. When player1 is clicked, disable the button. When you click on a label, have it check the button status. If it's disabled then you would have the color background change to that player's color. As far as checking to see if there is a "piece" underneath the column to make sure someone doesn't put a piece on the top when there is no piece on the bottom for it, I would do an if/then or select case to check if the color of the label is set or blank. Best bet would be to make the labels an array so it would cut down on coding lines.
-
May 25th, 2007, 01:23 AM
#3
Re: Game
Is this gonna be an online kind of multi player or done on the one computer? If it is online then you will need to use the winsock control.
-
May 25th, 2007, 05:32 AM
#4
Thread Starter
New Member
Re: Game
The game is going to be multiplayer on one computer, how do I start of the code?
Last edited by vb2007; May 25th, 2007 at 05:43 AM.
-
May 25th, 2007, 06:00 AM
#5
Re: Game
I have code but do a search on PSC
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
May 25th, 2007, 06:17 AM
#6
Re: Game
Moved to Games programming
-
May 25th, 2007, 04:39 PM
#7
Thread Starter
New Member
Re: Game
When I click the checker piece, it comes somewhere else on the form, how do i position it to a specific place?
-
May 29th, 2007, 03:22 AM
#8
Hyperactive Member
Re: Game
Move it to the mouse coordinates?
On the mouse click event, two of the parameters specify X and Y repectively:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
checker.Left = X
checker.Top = Y
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|