Hi Jim,
I bet. It sounds to me like you just put all your code directly into
the main form, the frm file, instead of breaking your games up into
reusable modules. Its actually quite easy to create reusable bas
files. If memory serves me correctly all you have to do is create a
new bas file in Visual Basic 6, and as long as your subs and functions
are set to public then the rest of your program can access them. For
example, here is a sample function.
Public Function AddNumbers(num1 As Integer, num2 As Integer) As Integer
result as Integer = num1 + num2
return result
End Function
Because this function is specifically set to public access your entire
Visual Basic application can access this function in any form or bas
module.The advantage of putting your code in bas modules is if you
have x number of programs that require access to the AddNumbers()
function you can simply copy the correct bas file into your new
project and add it to your project in the VB 6 IDE.
To give you a better idea how a trained Visual Basic developer would
design a game we basically split each component of the game up into
modules that handle a specific area of the game. One might handle just
audio, another just keyboard input, another joystick input,another one
contains common functions, etc. In this way we aren't cramming the
entire program into the main form. In fact, the main form simply is
there to draw the window, and call sub Main() wherever it is placed in
the program. The rest of the code for the game is split up among
several bas modules. You can have both internal functions that only
are visible to the current module by setting them to private, and
public functions visible to your entire program simply by specifying
they are public.
VB.net handles things a bit differently. Since VB.net is more object
oriented you have to create a class module, and then use the import
statement to import a class module in your code. However, since you
aren't familiar with VB.net I won't bore you with all the differences
between VB 6 and VB.net.
Cheers!
On 7/18/12, Jim Kitchen <[email protected]> wrote:
> Hi Thomas,
>
> Yes sir, I am always amazed when I look at code from others myself. Maybe
> even more so than you as I don't even know what it should look like. You
> know just being self taught. Just for example with VB6 all of my code is in
> the .frm file and there is also automatically a .vbp and .vbw file. But
> others also create a .bas file. I don't even know how to do that or
> reference it. So that is weird to me before even trying to figure out the
> logic flow of the code etc. Pretty cool though that things can be coded in
> all sorts of ways and they work.
>
> BFN
>
> Jim
---
Gamers mailing list __ [email protected]
If you want to leave the list, send E-mail to [email protected].
You can make changes or update your subscription via the web, at
http://mail.audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/[email protected].
If you have any questions or concerns regarding the management of the list,
please send E-mail to [email protected].