Results 1 to 8 of 8

Thread: Game

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    3

    Game

    How do you create a 2 player connect four game for visual basic ?

  2. #2
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 2007
    Location
    VA - USA
    Posts
    866

    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.

  3. #3
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    3

    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.

  5. #5
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    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.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Game

    Moved to Games programming

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    3

    Re: Game

    When I click the checker piece, it comes somewhere else on the form, how do i position it to a specific place?

  8. #8
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    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
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width