PDA

Click to See Complete Forum and Search --> : Game help


Silvertine
Oct 4th, 2000, 09:01 PM
I need help on a game I am making.
The game consists of an 8x15 matrix of image blocks. The point of the game is to get 3 or more colored blocks in a row which then elimanate. I got them to generate randomly and switch. I can't get them to detect when there is three or more in a row.
Please help or comment on the game.

The Code:



Option Explicit
Dim blocknum As Integer
Dim el As Integer
Dim x As Integer
Dim y As Integer
Dim indx As Integer
Dim fall As Integer
Private Sub bound_Timer()
Dim stag As Variant
If cursr.Left <= 0 Then
cursr.Left = 0
End If
If cursr.Left >= 120 Then
cursr.Left = 120
End If
If cursr.Top >= 280 Then
cursr.Top = 280
End If
If cursr.Top <= 0 Then
cursr.Top = 0
End If
End Sub

Private Sub elimanation_Timer()
If block(el).Tag = block(el + 8).Tag = block(el + 16).Tag Then
block(el).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blank.bmp")
block(el + 8).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blank.bmp")
block(el + 16).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blank.bmp")
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 And cursr.Left <> 0 Then
cursr.Left = cursr.Left - 20
indx = indx - 1
End If
If KeyCode = 40 And cursr.Top <> 280 Then
cursr.Top = cursr.Top + 20
indx = indx + 8
End If
If KeyCode = 39 And cursr.Left <> 120 Then
cursr.Left = cursr.Left + 20
indx = indx + 1
End If
If KeyCode = 38 And cursr.Top <> 0 Then
cursr.Top = cursr.Top - 20
indx = indx - 8
End If
If KeyCode = 13 Then
If cursr.Left = block(indx).Left And cursr.Top = block(indx).Top Then
storage.Picture = block(indx).Picture
block(indx).Picture = block(indx + 1).Picture
block(indx + 1).Picture = storage.Picture
End If

End If
End Sub

Private Sub Form_Load()
indx = 0

'purple=5
'yellow=1
'green=2
'blue=3
'red=4
'orange=6
'light blue=7
'pink=8
Randomize
For blocknum = 0 To 119
block(blocknum).Tag = Int(Rnd(1) * 8)
Select Case block(blocknum).Tag
Case 0
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Yellow.bmp")
Case 1
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Green.bmp")
Case 2
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Blue.bmp")
Case 3
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Red.bmp")
Case 4
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Purple.bmp")
Case 5
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Orange.bmp")
Case 6
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_LightBlue.bmp")
Case 7
block(blocknum).Picture = LoadPicture("C:\WINDOWS\Desktop\Ben\Games\Game X\blk_Pink.bmp")
End Select
Next
End Sub

Fox
Oct 5th, 2000, 12:07 AM
Put your code between and tags next time, looks better ;):


Sub Main()
With Indent()
.isCool! ;)
End With
End Sub

kedaman
Oct 5th, 2000, 07:11 AM
IF this is your detection method (for a 1d array)

If block(el).Tag = block(el + 8).Tag = block(el + 16).Tag

then the idea is correct but it's wrong typed, shoud be

If block(el).Tag = block(el + 8).Tag and block(el).Tag= block(el + 16).Tag then

Silvertine
Oct 5th, 2000, 02:59 PM
does anyone have any idea for this game?