Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB6] Array help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
pkyourface
Master Cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 252

PostPosted: Sun Jan 11, 2009 6:41 pm    Post subject: [VB6] Array help Reply with quote

I have 4 groups of images named Shield1, Shield2, Shield3 and Shield4 and each of those shields has an index of 9 images starting from 0 and ending at 9 so Shield1(0), Shield1(1) and so on.
Using this code:
Code:
For i = 0 To 9
        If (Shield1(i).Left + Shield1(i).Width) > Shape1.Left Then
            If Shield1(i).Left < (Shape1.Left + Shape1.Width) Then
                If (Shield1(i).Top + Shield1(i).Height) > Shape1.Top Then
                    If Shield1(i).Top < (Shape1.Top + Shape1.Height) Then
                    collision = True
                End If
            End If
        End If
    End If
   
    If collision = True Then
    Shape1.Visible = False
    collision = False
    End If
Next i


I want that when "i" reaches 9 of the first shield it changes "Shield1" into "Shield2" and then start back from 0 and check for the collision on sheild2 all the way to shield4.
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Jan 11, 2009 7:35 pm    Post subject: Reply with quote

make at multi dimension array (think thats what its called)

ie
Code:
Shield(9, 9)


Code:
For i = 0 To 9
For i2 = 0 To 9
        If (Shield(i, i2).Left + Shield1(i, i2).Width) > Shape1.Left Then
            If Shield(i, i2).Left < (Shape1.Left + Shape1.Width) Then
                If (Shield(i, i2).Top + Shield(i, i2).Height) > Shape1.Top Then
                    If Shield(i, i2).Top < (Shape1.Top + Shape1.Height) Then
                    collision = True
                End If
            End If
        End If
    End If
   
    If collision = True Then
    Shape1.Visible = False
    collision = False
    End If
Next i
Next i2

_________________
Back to top
View user's profile Send private message
pkyourface
Master Cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 252

PostPosted: Mon Jan 12, 2009 10:58 am    Post subject: Reply with quote

Thanks a lot, I've never heard of multi dimension arrays but I seems that is what I needed to use and it worked Very Happy .
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Mon Jan 12, 2009 12:04 pm    Post subject: Reply with quote

snootae that is pretty interesting solution nice and simple o0
Back to top
View user's profile Send private message MSN Messenger
pkyourface
Master Cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 252

PostPosted: Mon Jan 12, 2009 4:36 pm    Post subject: Reply with quote

The multi array works fine but the ".left" at the end makes it say invalid qualifier.. I've resorted to using 4 timers but any other solutions are appreciated.
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Wed Jan 14, 2009 7:54 pm    Post subject: Reply with quote

Quote:
The multi array works fine but the ".left" at the end makes it say invalid qualifier.. I've resorted to using 4 timers but any other solutions are appreciated.


let me see your Dim for the array

it should be
Code:
Dim Shield(9, 9) As PictureBox
or something, that should work
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites