Game properties:
Form 1
CaptionFlip Card Game
Label 1
Name Numbers of Win
BorderStyle 1 - Fixed Single
Caption0
Font MS Sans Serif12Regular
Label 2
Name lblLoss
BorderStyle1 - Fixed Single
Caption 0
Font MS Sans Serif12Regular
Label 3
Caption Numbers of Win
Label 4
CaptionNumbers of Loss
Command 1
Name cmdNew
CaptionNew Game
Command 2
Name cmdExit
Caption Exit
Command 3
NamecmdChose
CaptionChose A
Command 4
Name cmdChose
CaptionChose B
Sub for click on a cover card
Sub for a New Game
÷Code for the New game Button:
Private Sub cmdNew_Click ()
Static Occupied (1 To 2)
Random picBox = True "Random the Picture box after new game"
PicCover. Invisible = true" For picBox # 1 and 2"
Set win label = 0' update number of win for new game
Set loss label = 0' update number of loss for new game
End Sub
÷Code to activate a covering card when it's clicked on:
Private Sub picCover_Click (Index As Integer)
Static First picBox as Integer, First picBox as Integer
Static Second picBox as Integer, Second picBox as Integer
PicCover (Index).
Visible = False" cover card not visible'
lblWin. Caption = \3' update number of win
lblLoss. Caption = \3' update number of loss
If match's fixed card = +1' add 1 to lblWin
If not match's fixed card = +1' add 1 to lblLoss and take 1 off lblWin
MessageBox ' YOU WIN' play again' if card match's the fixed card
Fixed CardCover. Visible = True' show the fixed Card
End Sub
÷Code for Chose A command Button
Private Sub cmdChose_Click
Uncover picBox #1 = True' show picBox # 1 when clicked on Chose A
End Sub
÷Code for Chose B command Button:
Private Sub cmdChose_Click
Uncover picBox #2 = True' show picBox #2 when clicked on Chose B
End Sub
÷Code for Exit command Button:
Private Sub cmdExit_Click
End
End Sub
Solving The Problem
1.Define the problem
2.Plane the solution
3.Implement the solution
4.Look back
Defining the problem
First I thought of what to do, what game to create. What properties to set for the game and the codes. Think of what the game screen will look like and the features in the game.
Plane the solution
When planing you are required to know the problem first of all. In order to solve it first I design a sketch of how my game screen will look like and labeled the features that are need in the game on the sketch. And then started to set the game's rules and properties. Plan the codes for the game.
Implement the solution
This game basically will be card game where there is three cards one of them is shown to you and the other two are covered for you to guess or find whatever on the shown card.
If the selected card match's the visible card you increase your win points by one because you first start with zero and then you build you way up every time the card match's the shown card. And if the selected card do not match your loss point increase by 1 and your win decrease by 1. Every time you start a new game the covered cards shuffles automatically.
Look back
Looked back and checked the all properties in the game and it's code and insured that it corresponds to the task which was originally defined.
...
Many things are missing. Mention that this is Visual Basic, first off. Very ugly code, some functions I believe do not exist (.invisible = true is supposed to be .visible = false), etc.
1 out of 1 people found this comment useful.