Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Communications (http://www.xtremevbtalk.com/-net-communications/)
-   -   peer 2 peer game of the general (http://www.xtremevbtalk.com/-net-communications/326664-peer-2-peer-game.html)

gbraijin13 12-12-2013 09:31 AM

peer 2 peer game of the general
im making a peer to peer vb.net game ..the board are almost done and also the chat also done but all i need is how can i the 2 pieces? I use picture box for the pieces and also i use drag n drop codes for moving the picture box pls help me ...pls give me some idea how can i put make those picture box seen to the other pc...this is for my school thesis..

passel 12-13-2013 10:09 AM

What type of "drag n drop" code?
I would think that you would have objects (in this case pictureboxes) that represent all the players on each machine, with some sort of ID common to a given player on all machines.
If you were manually implementing the drag, as you dragged the object your code would periodically send the position and ID of the player object being moved in a message of your design between the machines. The receiving machines would see that player ID has moved, and move the cooresponding object on their end.

gbraijin13 12-14-2013 10:39 PM

this the flow of my game sir and also the SS
1 Attachment(s)
Attachment 33433

Private Sub GameBoard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call ScreenResolution()
        lblhostname.Text = Create.lblpname.Text
        Timer2.Enabled = True
        txtinbox.Enabled = False
        pic1.AllowDrop = True
        pic2.AllowDrop = True
        pic3.AllowDrop = True
        pic4.AllowDrop = True
        pic5.AllowDrop = True
        pic6.AllowDrop = True
        pic7.AllowDrop = True
        pic8.AllowDrop = True
        pic9.AllowDrop = True
        pic10.AllowDrop = True
        pic11.AllowDrop = True
        pic12.AllowDrop = True
        pic13.AllowDrop = True
        pic14.AllowDrop = True
        pic15.AllowDrop = True
        pic16.AllowDrop = True
        pic17.AllowDrop = True
        pic18.AllowDrop = True
        pic19.AllowDrop = True
        pic20.AllowDrop = True
        pic21.AllowDrop = True
        pic22.AllowDrop = True
        pic23.AllowDrop = True
        pic24.AllowDrop = True
        pic25.AllowDrop = True
        pic26.AllowDrop = True
        pic27.AllowDrop = True
        pic28.AllowDrop = True
        pic29.AllowDrop = True
        pic30.AllowDrop = True
        pic31.AllowDrop = True
        pic32.AllowDrop = True
        pic33.AllowDrop = True
        pic34.AllowDrop = True
        pic35.AllowDrop = True
        pic36.AllowDrop = True
        pic37.AllowDrop = True
        pic38.AllowDrop = True
        pic39.AllowDrop = True
        pic40.AllowDrop = True
        pic41.AllowDrop = True
        pic42.AllowDrop = True
        pic43.AllowDrop = True
        pic44.AllowDrop = True
        pic45.AllowDrop = True
        pic46.AllowDrop = True
        pic47.AllowDrop = True
        pic48.AllowDrop = True
        pic49.AllowDrop = True
        pic50.AllowDrop = True
        pic51.AllowDrop = True
        pic52.AllowDrop = True
        pic53.AllowDrop = True
        pic54.AllowDrop = True
        pic55.AllowDrop = True
        pic56.AllowDrop = True
        pic57.AllowDrop = True
        pic58.AllowDrop = True
        pic59.AllowDrop = True
        pic60.AllowDrop = True
        pic61.AllowDrop = True
        pic62.AllowDrop = True
        pic63.AllowDrop = True
        pic64.AllowDrop = True
        pic65.AllowDrop = True
        pic66.AllowDrop = True
        pic67.AllowDrop = True
        pic68.AllowDrop = True
        pic69.AllowDrop = True
        pic70.AllowDrop = True
        pic71.AllowDrop = True
        pic72.AllowDrop = True
        lbldate.Text = Date.Today
    End Sub
    Private Sub PictureBox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
    Handles pic1.DragDrop, pic2.DragDrop, _
    pic3.DragDrop, pic4.DragDrop, pic5.DragDrop, pic6.DragDrop, _
    pic7.DragDrop, pic8.DragDrop, pic9.DragDrop, pic10.DragDrop, _
    pic11.DragDrop, pic12.DragDrop, pic13.DragDrop, pic14.DragDrop, _
    pic15.DragDrop, pic16.DragDrop, pic17.DragDrop, pic18.DragDrop, _
    pic19.DragDrop, pic20.DragDrop, pic21.DragDrop, pic22.DragDrop _
    , pic23.DragDrop, pic24.DragDrop, pic25.DragDrop, pic26.DragDrop, _
    pic27.DragDrop, pic28.DragDrop, pic29.DragDrop, pic30.DragDrop, _
    pic31.DragDrop, pic32.DragDrop, pic33.DragDrop, pic34.DragDrop, _
    pic35.DragDrop, pic36.DragDrop, pic37.DragDrop, pic38.DragDrop, _
    pic39.DragDrop, pic40.DragDrop, pic41.DragDrop, pic42.DragDrop, _
    pic43.DragDrop, pic44.DragDrop, pic45.DragDrop, pic46.DragDrop, _
    pic47.DragDrop, pic48.DragDrop, pic49.DragDrop, pic50.DragDrop, _
    pic51.DragDrop, pic52.DragDrop, pic53.DragDrop _
    , pic54.DragDrop, pic55.DragDrop, pic56.DragDrop, pic57.DragDrop, _
    pic58.DragDrop, pic59.DragDrop, pic60.DragDrop, pic61.DragDrop, _
    pic62.DragDrop, pic63.DragDrop, pic64.DragDrop, pic65.DragDrop, _
    pic66.DragDrop, pic67.DragDrop, pic68.DragDrop, pic69.DragDrop, _
    pic70.DragDrop, pic71.DragDrop, pic72.DragDrop

        'Check if data is present
        If Not e.Data.GetDataPresent(DataFormats.Bitmap) Then Exit Sub

        'Determine if it is a copy or move operation
        If CBool(e.KeyState And 8) Then
            ' Display the copy cursor.
            e.Effect = DragDropEffects.Copy
            e.Effect = DragDropEffects.Move
        End If

        'Get a reference to the current textbox control
        Dim ctlCurrent As PictureBox = DirectCast(sender, PictureBox)
        'Paste the image to drop
        ctlCurrent.Image = DirectCast(e.Data.GetData(DataFormats.Bitmap), Image)
    End Sub
    Private Sub PictureBox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
    Handles pic1.DragEnter, pic2.DragEnter, _
    pic3.DragEnter, pic4.DragEnter, pic5.DragEnter, pic6.DragEnter, _
    pic7.DragEnter, pic8.DragEnter, pic9.DragEnter, pic10.DragEnter, _
    pic11.DragEnter, pic12.DragEnter, pic13.DragEnter, pic14.DragEnter, _
    pic15.DragEnter, pic16.DragEnter, pic17.DragEnter, pic18.DragEnter, _
    pic19.DragEnter, pic20.DragEnter, pic21.DragEnter, pic22.DragEnter _
    , pic23.DragEnter, pic24.DragEnter, pic25.DragEnter, pic26.DragEnter, _
    pic27.DragEnter, pic28.DragEnter, pic29.DragEnter, pic30.DragEnter, _
    pic31.DragEnter, pic32.DragEnter, pic33.DragEnter, pic34.DragEnter, _
    pic35.DragEnter, pic36.DragEnter, pic37.DragEnter, pic38.DragEnter, _
    pic39.DragEnter, pic40.DragEnter, pic41.DragEnter, pic42.DragEnter, _
    pic43.DragEnter, pic44.DragEnter, pic45.DragEnter, pic46.DragEnter, _
    pic47.DragEnter, pic48.DragEnter, pic49.DragEnter, pic50.DragEnter, _
    pic51.DragEnter, pic52.DragEnter, pic53.DragEnter _
    , pic54.DragEnter, pic55.DragEnter, pic56.DragEnter, pic57.DragEnter, _
    pic58.DragEnter, pic59.DragEnter, pic60.DragEnter, pic61.DragEnter, _
    pic62.DragEnter, pic63.DragEnter, pic64.DragEnter, pic65.DragEnter, _
    pic66.DragEnter, pic67.DragEnter, pic68.DragEnter, pic69.DragEnter, _
    pic70.DragEnter, pic71.DragEnter, pic72.DragEnter

        'Check the format of the data being dropped.
        If e.Data.GetDataPresent(DataFormats.Bitmap) Then
            'Checks if the CTRL key is held
            If CBool(e.KeyState And 8) Then
                'Display the copy cursor.
                e.Effect = e.AllowedEffect And DragDropEffects.Copy
                'Display the move cursor
                e.Effect = e.AllowedEffect And DragDropEffects.Move
            End If
            'Display the no-drop cursor.
            e.Effect = DragDropEffects.None
        End If

    End Sub
    Private Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
    Handles pic1.MouseMove, pic2.MouseMove, _
    pic3.MouseMove, pic4.MouseMove, pic5.MouseMove, pic6.MouseMove, _
    pic7.MouseMove, pic8.MouseMove, pic9.MouseMove, pic10.MouseMove, _
    pic11.MouseMove, pic12.MouseMove, pic13.MouseMove, pic14.MouseMove, _
    pic15.MouseMove, pic16.MouseMove, pic17.MouseMove, pic18.MouseMove, _
    pic19.MouseMove, pic20.MouseMove, pic21.MouseMove, pic22.MouseMove _
    , pic23.MouseMove, pic24.MouseMove, pic25.MouseMove, pic26.MouseMove, _
    pic27.MouseMove, pic28.MouseMove, pic29.MouseMove, pic30.MouseMove, _
    pic31.MouseMove, pic32.MouseMove, pic33.MouseMove, pic34.MouseMove, _
    pic35.MouseMove, pic36.MouseMove, pic37.MouseMove, pic38.MouseMove, _
    pic39.MouseMove, pic40.MouseMove, pic41.MouseMove, pic42.MouseMove, _
    pic43.MouseMove, pic44.MouseMove, pic45.MouseMove, pic46.MouseMove, _
    pic47.MouseMove, pic48.MouseMove, pic49.MouseMove, pic50.MouseMove, _
    pic51.MouseMove, pic52.MouseMove, pic53.MouseMove _
    , pic54.MouseMove, pic55.MouseMove, pic56.MouseMove, pic57.MouseMove, _
    pic58.MouseMove, pic59.MouseMove, pic60.MouseMove, pic61.MouseMove, _
    pic62.MouseMove, pic63.MouseMove, pic64.MouseMove, pic65.MouseMove, _
    pic66.MouseMove, pic67.MouseMove, pic68.MouseMove, pic69.MouseMove, _
    pic70.MouseMove, pic71.MouseMove, pic72.MouseMove

        'Nothing to do if no mouse button is pressed.
        If e.Button = 0 Then Exit Sub

        'Get a reference to the current PictureBox control
        Dim ctlCurrent As PictureBox = DirectCast(sender, PictureBox)

        'If we get here, it means that the mouse is
        '  being dragged outside the control.

        'Store the image to be drag into a DataObject object
        Dim objDO As New DataObject
        objDO.SetData(DataFormats.Bitmap, ctlCurrent.Image)
        'Starts the drag operation
        Dim effect As DragDropEffects = DragDropEffects.Copy Or DragDropEffects.Move
        effect = ctlCurrent.DoDragDrop(objDO, effect)

        'This portion of code will run after the code has been dropped.
        'Delete the image if it was a move.
        If effect = DragDropEffects.Move Then
            ctlCurrent.Image = Nothing
        End If
    End Sub

All times are GMT -6. The time now is 05:17 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.