In this project, we are going to create a memory game. I think there are three steps of creating a memory game.
Step 1 : Create the form / user interface
Step 2 : Set the properties of the components
Step 3 : Write the code
Step 1 : Create the form / user interface
First you have to create a form with some image components, a label, a start button, a timer and an exit button. You can set any width or height properties of your components you use. And arrange them like the picture below or you can use your own arrangement.
Then cover all images with buttons. So your form will be like this :
Step 2 : Set the properties of the components
Now, set the properties of all components we use in this project like tables below :
Form
Property | Value |
---|---|
Caption | MEMORY GAME |
Position | poDesktopCenter |
Buttons
Component | Property | Value |
---|---|---|
StartButton | Name | StartButton |
Caption | &Start | |
ExitButton | Name | ExitButton |
Caption | &Exit | |
Button1 .. Button20 | Caption | ? |
Label
Property | Value |
---|---|
Caption | MEMORY GAME |
Images
Property | Value |
---|---|
Stretch | true |
Timer
Property | Value |
---|---|
Interval | 1000 |
Enabled | false |
Step 3 : Write the code
Before we start writing the code, we need to prepare some pictures for this project. I have prepared 30 pictures that you can download (jpg format). Or you can have your own pictures. If your pictures are in jpg format, you have to declare it in the uses clause.
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, jpeg;
To see the complete code, you can download this project here.