|
-
Jun 27th, 2001, 10:42 PM
#1
Thread Starter
New Member
Bet you cant figure this one out...
Well my other question was easy, but I have no clue how to do this one, and I tried asking elsewhere and noone bothered responding. So if you can figure it out - you are a genius.
Ill try to explain this as best I can, but to make seeing what I am doing eaiser goto http://games.swirve.com/ and click on cubix and play the game... this makes much more sence after having played it. As you can tell I am remaking Cubix in VB - for a school project.
Ok So far I have this, which selects a random color then fills the game area with random colored boxes. As you can see I have an array (Area()) which the sourceupperleftCorner that the color can be derived from.
Private Sub FillArea()
Do Until DestinationUpperLeftCornery = GameArea.Height - 20 And DestinationUpperLeftCornerx = GameArea.Width - 20
RandomNumber = Int((100 - 1 + 1) * Rnd) + 1
Call LevelDeterminer(RandomNumber)
Area(DestinationUpperLeftCornerx, DestinationUpperLeftCornery) = SourceUpperLeftCorner
Call DrawBox(DestinationUpperLeftCornerx, DestinationUpperLeftCornery, SourceUpperLeftCorner)
If Not DestinationUpperLeftCornerx >= GameArea.ScaleWidth Then
DestinationUpperLeftCornerx = DestinationUpperLeftCornerx + 20
Else
If Not DestinationUpperLeftCornery >= (GameArea.ScaleHeight) Then
DestinationUpperLeftCornery = (DestinationUpperLeftCornery + 20)
DestinationUpperLeftCornerx = 0
Else: Exit Sub
End If
End If
Loop
End Sub
Its kinof Laggy so I might go to direct draw, but Im kindof running out of time...
Anyway here is my problem, lets say you have:
red blue blue red
Blue Blue red red
I want the game to recognise when you click on a blue square that there are 4 of them tounching and then to delete the squares. So I will need the number touching and the coordinates of them.
I Figured I could do it with:
f Area(ClicklocationX, ClicklocationY) = Area((ClicklocationX + 20), ClicklocationY) Then
Right(RightIndex) = True
End If
If Area(ClicklocationX, ClicklocationY) = Area((ClicklocationX - 20), ClicklocationY) Then
Left(LeftIndex) = True
End If
If Area(ClicklocationX, ClicklocationY) = Area(ClicklocationX, (ClicklocationY + 20)) Then
Down(DownIndex) = True
End If
If Area(ClicklocationX, ClicklocationY) = Area(ClicklocationX, (ClicklocationY - 20)) Then
Up(UpIndex) = True
End If
and just loop it for every block found, but when there are squares you will end up with a infinite loop.... One solution I came up with was to temp change the value of the ones checked- but there are massive problems if they somehow dont get changed back and that only solves the loops- what do you do when there is more than 1 block togther...
Anyway play the game and it makes more sence.
Another problem is how to check if any 3 or more block combos exist anywhere in the field after each click
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|