5 Replies - 658 Views - Last Post: 24 July 2017 - 12:22 PM Rate Topic: *---- 1 Votes

#1 lisamorgan1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 24-July 17

Card game Help

Posted 24 July 2017 - 11:04 AM

Im kinda new to visual basic, so im making a card war game that is with the user vs the computer has buttons called NewGame, Nextcard, and stop. So basically when the user chooses next card another card will display on both sides of the user and the computer and whoever has the highest authority of the card gets 2 points and if its a draw they each get 1 point and i cant repeat cards.

How do i display the 52 deck of cards in a picture box, keep in mine i will
have 2 picture boxes as one is for the user and the other is for the computer?

How would the user be able to stop the game using the stop button?


Heres My code so far:
 Public Class Form1
    Dim card(52) As Integer
    Dim shuffle As New Random
    Dim cardnumber As Integer = 1
    Dim cardpick As Integer = 2
    Dim cardpickcomputer As Integer = 1
    Dim Y, X As Integer


    Private Sub BtnNewgame_Click(sender As Object, e As EventArgs) Handles BtnNewgame.Click
        BtnNewgame.Hide()
        For shuffleCard = 1 To 52
StartPosition: X = shuffle.Next(53) + 1
            For Y = 1 To 52
                If card(Y) = X Then
                    Do While StartPosition

                    Loop
                End If
            Next Y
            card(cardnumber) = X
            cardnumber = cardnumber + 1
        Next shuffleCard

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub BtnNextcard_Click(sender As Object, e As EventArgs) Handles BtnNextcard.Click

    End Sub

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub BtnStop_Click(sender As Object, e As EventArgs) Handles BtnStop.Click

    End Sub

    Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click

    End Sub
End Class


:code:
Help would be really appreciated ASAP

This post has been edited by modi123_1: 24 July 2017 - 11:06 AM
Reason for edit:: In the future please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: Card game Help

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13493
  • View blog
  • Posts: 53,899
  • Joined: 12-June 08

Re: Card game Help

Posted 24 July 2017 - 11:07 AM

Why would there need to be a stop button? I figure one button that is "do turn"... once clicked pulls one card from each deck, shows the image, awards points, and stops. Probably should check for a win condition in there as in 'no more cards left'.

As for showing an actual picture - heck an image list with each card would do.
Was This Post Helpful? 0
  • +
  • -

#3 lisamorgan1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 24-July 17

Re: Card game Help

Posted 24 July 2017 - 11:11 AM

View Postmodi123_1, on 24 July 2017 - 11:07 AM, said:

Why would there need to be a stop button? I figure one button that is "do turn"... once clicked pulls one card from each deck, shows the image, awards points, and stops. Probably should check for a win condition in there as in 'no more cards left'.

As for showing an actual picture - heck an image list with each card would do.

An image list what does that do? Im sorry can you be more elaborate mod

View Postlisamorgan1, on 24 July 2017 - 11:04 AM, said:

Im kinda new to visual basic, so im making a card war game that is with the user vs the computer has buttons called NewGame, Nextcard, and stop. So basically when the user chooses next card another card will display on both sides of the user and the computer and whoever has the highest authority of the card gets 2 points and if its a draw they each get 1 point and i cant repeat cards.

How do i display the 52 deck of cards in a picture box, keep in mine i will
have 2 picture boxes as one is for the user and the other is for the computer?

How would the user be able to stop the game using the stop button?


Heres My code so far:
 Public Class Form1
    Dim card(52) As Integer
    Dim shuffle As New Random
    Dim cardnumber As Integer = 1
    Dim cardpick As Integer = 2
    Dim cardpickcomputer As Integer = 1
    Dim Y, X As Integer


    Private Sub BtnNewgame_Click(sender As Object, e As EventArgs) Handles BtnNewgame.Click
        BtnNewgame.Hide()
        For shuffleCard = 1 To 52
StartPosition: X = shuffle.Next(53) + 1
            For Y = 1 To 52
                If card(Y) = X Then
                    Do While StartPosition

                    Loop
                End If
            Next Y
            card(cardnumber) = X
            cardnumber = cardnumber + 1
        Next shuffleCard

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub BtnNextcard_Click(sender As Object, e As EventArgs) Handles BtnNextcard.Click

    End Sub

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub BtnStop_Click(sender As Object, e As EventArgs) Handles BtnStop.Click

    End Sub

    Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click

    End Sub
End Class


:code:/>
Help would be really appreciated ASAP

Can someone help me more with more specifics please
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13493
  • View blog
  • Posts: 53,899
  • Joined: 12-June 08

Re: Card game Help

Posted 24 July 2017 - 11:13 AM

An image list is a collection of image objects. You navigate it like an array. Assuming your keep the same consistent number with the card objects you should be able to use the card's number to index the image array and assign the image to the picture box.

Side question - is this really VB6 or VB.NET?

Side note - you don't need to quote the post above yours.

Side side note - do not needlessly bump your thread. This is a volunteer forum and folk will answer on their schedule.
Was This Post Helpful? 0
  • +
  • -

#5 lisamorgan1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 24-July 17

Re: Card game Help

Posted 24 July 2017 - 11:49 AM

Okay

This post has been edited by andrewsw: 24 July 2017 - 12:20 PM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,775
  • Joined: 12-December 12

Re: Card game Help

Posted 24 July 2017 - 12:22 PM

That's VB.NET code, moved to VB.NET forum.

As suggested, you don't need to quote the previous post, there is a Reply button further down the page.

Concerning a Stop button, you could use Me.Close to exit the application, although there is already by default an X at the top-right corner. Otherwise, it is up-to you want happens when they click a Stop button.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1