|
|
|
|
|
|
|
|
:: All Cards :: Online
:: Delphi Guide |
|
The procedure to save colour attributes of all bottom row cells before placing the marker:
Private Sub Save_Color()
savecolor(0) = Label7.BackColor 'Save bgcolor Label7
savecolor(1) = Label8.BackColor 'Save bgcolor Label8
savecolor(2) = Label9.BackColor 'Save bgcolor Label9
savecolor(3) = Label10.BackColor 'Save bgcolor Label10
savecolor(4) = Label11.BackColor 'Save bgcolor Label11
savecolor(5) = Label12.BackColor 'Save bgcolor Label12
savecolor(6) = Label13.BackColor 'Save bgcolor Label13
savecolor(7) = Label14.BackColor 'Save bgcolor Label14
End Sub
Create a trigger firstset = 0
Trigger=0, if a marker has not been placed in the bottom row yet.
General code fragment that handles marker placing in the bottom row - see code.
Save_Color() procedure is used to restore cell colour when moving the marker horizontally (along the bottom row of the playing area).
Create a markersave variable to memorize an array ELEMENT NUMBER savecolor(j), the variable corresponding to the marker cell (i.e. the cell, in which the marker has been placed).
| |
|
|
|
|
The possibility of placing a marker on one cell only can be checked. Now it is necessary to provide a marker being saved (in terms of cell turning blue) when shifting cells top – down.
The procedure of marker colour restoring after playing area cells shifting top-down:
Private Sub Marker_Reset()
If markersave = 0 Then Label7.BackColor = &HFF0000
If markersave = 1 Then Label8.BackColor = &HFF0000
If markersave = 2 Then Label9.BackColor = &HFF0000
If markersave = 3 Then Label10.BackColor = &HFF0000
If markersave = 4 Then Label11.BackColor = &HFF0000
If markersave = 5 Then Label12.BackColor = &HFF0000
If markersave = 6 Then Label13.BackColor = &HFF0000
If markersave = 7 Then Label14.BackColor = &HFF0000
End Sub
Now activate Marker_Reset() procedure to operate in a top-down shift procedure. In the bottom of Frame1_Click() procedure insert the following code (marked as underline):
Private Sub Frame1_Click()
Num_Move 'Shift the values of all rows one row down
Up_Str_App 'Fill in the top row with new nomimals
Marker_Reset 'Marker redraw
End Sub
A complete Visual Basic project of this game development stage is in the file vbg5.zip
Write a score count procedure when placing a marker in the beginning of the game - see code.
|
|
|
|
|
|
Now attach a score count procedure in each of click procedures for bottom row cells:
Private Sub Label7_Click()
If firstset = 0 Then Save_Color 'Save bgcolor
If firstset = 0 Then Label7.BackColor = &HFF0000 'Set new bgcolor (blue)
If firstset = 0 Then firstset = 1 'No use again
markersave = 0
Set_Marker_Count ‘Rewrite counter
End Sub
For other bottom row cells the procedure is exactly the same.
Now write a score counting procedure at cells’ shifting top-down.
Procedure looks like extremely simple:
Private Sub Dn_Count()
n = 0 ‘Temporarily to resolve work of procedure Set_Marker_Count
Set_Marker_Count ‘Procedure of calculation of glasses after installation of a marker
End Sub
To demonstrate the procedure operation, insert the procedure call in a top-down cell row shifting procedure Frame1_Click():
Private Sub Frame1_Click()
Num_Move 'To move values of all cells from above - downwards
Up_Str_App 'To fill in the top line of a game field new values
Marker_Reset 'Rewrite marker
Dn_Count 'To count up glasses at moving lines from above - downwards
End Sub
A complete Visual Basic project of this game development stage is in the file vbg6.zip
Create a procedure of linear colour indicator operation. Add Timer1 to the form and enable it at once. see code.
You can see how the indicator works.
Now you should disable the timer and enable it after the market has been placed in a playing area bottom row. Insert timer enabling in a marker placing procedure in a playing area bottom row (to be more exact – in a score counting procedure after marker placing Set_Marker_Count(), since the procedure is common for all cells of a lower level).
At the end of the procedure Set_Marker_Count() there is a line:
Timer1.Enabled = True 'The timer is ON since the marker is put
A complete Visual Basic project of this game development stage is in the file vbg7.zip
When a linear colour indicator disappears completely, it is necessary to shift down all rows with playing area cells (Frame1_Click() procedure) to the marker, count scores and fill in a playing area top row with new nominal values.
Timer1 operation procedure looks like the following way:
Private Sub Timer1_Timer()
IndLent = IndLent + 1
If IndLent = 9 Then
IndLent = 0
Timer1.Interval = 500
Frame1_Click 'To move levels
End If
Print_Ind 'Draw indicator
End Sub
Keyboard Now it is necessary to write handling of pressing down the key and marker’s moving to the [right] / [left] along the bottom row of playing area cells.
Place another timer (Timer2) at Form1. Set a time interval Timer2 = 50 and place a key status test code in a printer operation procedure.
Declare procedure operation functions:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
And a handling code as such - see code.
Inscriptions in Left and Right form header are presented only for debugging purposes. Markersave variable shows a unique playing area bottom row cell that contains a marker. Write a procedure of marker moving to the left / right along the bottom row - see code.
Now it is necessary to create only one procedure – a procedure of shifting the numbering of current gaming level |Level|:
Private Sub Level_Count()
Label6.Caption = Label6.Caption + 1
Label5.Caption = Label6.Caption + 1
Label4.Caption = Label5.Caption + 1
Label3.Caption = Label4.Caption + 1
Label2.Caption = Label3.Caption + 1
End Sub
Attach a shifting procedure to the operations, for example:
Private Sub Dn_Count()
n = 0
Set_Marker_Count
Level_Count 'Move Level
End Sub
A complete Visual Basic project of this game development stage is in the file vbg8.zip
Now, this is a demonstrative moment: all software-realization procedures of the game Oflameron are ready. In other words, you have created a completely operable logical gaming program in Visual Basic. It is still early to introduce it as a commercial product as it still contains many faults. For example, when clicking the Frame object the game starts without placing the marker.
Removing such faults and configuring the game as a commercial product are dealt in the 2nd & 3d parts of the guidelines.
One of the 2nd parts variants (with system of bonuses , variants of complication of game , connect to Internet) - in file vbg15.zip
|
|
|
|
|
|
|
|
Warning: All content on this website is free for none-commercial (personal) use. Game name, game algorithm, game forms and elements, game code is protected by copyright law and international treaties. Commercial reproduction must be licensed! Unauthorized commercial reproduction or distribution of this content, code and etc., or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.
Copyright (c) by Valery V Shmeleff http://www.oflameron.ru |
|
|
|
|
|
Registered in Russian Federation RIPN 30 Nov 2001 |
|
|
|