A question about different code in different files

BlitzPlus Forums/BlitzPlus Beginners Area/A question about different code in different files

Roe(Posted 2005) [#1]
Hello,

this is a bit of a noob question, but I'm making a game, and it's already getting pretty big with the four different movement functions and I've got a whole lot more code to go in. How do I do this?

Do I make one big long file with everything on the one page, or can I seperate different functions and procedures into different files? Should the menu be one file and call the main game file up, or does it all have to be under one file and executable?

Cheers


Ross C(Posted 2005) [#2]
Firstly, when you create an executable, all the .bb's get compiled into it. Basically you can lay it out however you like. Some folks like using a different .bb for functions or libraries that do a specific function. It's all up to you. Too many files and it might be harder to keep track of


CS_TBL(Posted 2005) [#3]
You might also choose an alternative IDE with function-folding.. thousands of lines of code, and just a few lines on your screen..

Usually I put generic stand-alone functions in include-files (sorted, like: __strings__.bb, __GUI__.bb, __math__.bb etc.) and keep the main project-file for my app.

Typically an app can be divided into several standlone functions .. so whenever you need something new for an app, better make it a stand-alone function and store it in the right include-file ..


Grey Alien(Posted 2005) [#4]
Standalone functions in another file are the way to go for reuseability and for easily location the function in question. Only problem with the Blitz IDE is you can do a "find in files" which is a stinker. I bought Protean IDE because it supports this except it's currently broke, sigh.


Roe(Posted 2005) [#5]
Cheers guys. I think I'm going to buy Protean after what you've said and looking at the product itself, looks quite feature rich :)

So, naturally my next question has to be "How do I call up other files?" I take it there is a specific bit of code for doing this?

Cheers again guys


ozak(Posted 2005) [#6]
VisualBlitz is best IMHO. Protean is way too bloated. They are trying to add too much functionality, instead of making a usable stable product :)


Grey Alien(Posted 2005) [#7]
just stick Include "filename" at the top of you main project. Then call and of the functions as per normal. Easy.


Hotcakes(Posted 2005) [#8]
They are trying to add too much functionality, instead of making a usable stable product :)

Actually, it's been a stable product right up until the last couple of updates, when support started dropping off...