Hi Jim, Yeah, there are many many ways to do the same thing. Some times its not the best way to do something, but it works which is what counts.
As far as creating bas files its been so long since I've used VB 6 I'm not sure I accurately remember how to do it myself. In Visual Basic .net I just press alt+p, open the Project menu, and arrow down to New File. Then, I can add a new file to the project. As I recall VB 6 is similar but the menus are a bit different which is where the problem lies. I know how to add a bas file, but can't remember the VB 6 menus accurately since I've been using VB .net for at least the last eight years or so. Cheers! On 7/19/12, Jim Kitchen <[email protected]> wrote: > Hi Thomas, > > You said; > "If memory serves me correctly all you have to do is create a new bas file > in Visual Basic 6," > Yeah, however I do not know how to do that, never have done it and have > never seen anywhere how to do it. I have just seen .bas files in projects > from other people. > > As far as modules, I just have 3 starter.frm files. All use DirectX to play > sounds, 1 uses VB6 key input, 1 uses DirectX key input and the third uses > DirectX key and joystick input. Then I just make a copy of the .frm, vbp > and vbw files with the name of my new game. All three have all of the subs > that I use in all my games. You know like change voice, adjust rate of > speech, play wave files etc etc. And of course one can very easily copy and > paste code straight anywhere into the VB6 frm while in the VB6 IDE. And I > do also have public and private variables, functions etc. > > Guess like we were saying, just all kinds of different ways of writing code > to do the same things. I mean all of my Windows games were written this > way. > > BFN > > ----- Original Message ----- > 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! > > > Jim > > BASIC programmers never die, they GOSUB and don't RETURN. > > [email protected] > http://www.kitchensinc.net > (440) 286-6920 > Chardon Ohio USA > --- > 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]. > --- 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].
