Results 1 to 4 of 4

Thread: Game help

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    14

    Question

    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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Put your code between [code] and [/code] tags next time, looks better :

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

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    IF this is your detection method (for a 1d array)
    Code:
    If block(el).Tag = block(el + 8).Tag = block(el + 16).Tag
    then the idea is correct but it's wrong typed, shoud be
    Code:
    If block(el).Tag = block(el + 8).Tag and block(el).Tag= block(el + 16).Tag then
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    14

    name?

    does anyone have any idea for this game?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width