Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 527 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple Question on oragnization #137461
06/21/07 03:33
06/21/07 03:33
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
I'm trying to find a way to better organize my code. (ie: I just want a single WDL file that contains the movement scripts, a single WDL file that contains the levels, a single WDL file that contains the camera and lighting, one for the sounds, etc.) Is this possible to do? and if so, how do I link all of these files together so that they will all run at the same time? Will I need to put #include files on each one? or do I just put the #include tags in the Main.wdl only? I'm just wondering about that, because when I want to switch to another level, it seems like it would get confusing.

Will this slow down my game immensely if I have so many files to include that the engine has to call at once? Is there a better, more efficient way to do this? thanks in advance

Re: Simple Question on oragnization [Re: Knuckles] #137462
06/21/07 05:32
06/21/07 05:32
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
You don't need includes in each wdl. You can put them all in your main wdl.

and I don't think #include is neccessary. I have used just include for one of my tests.

Code:

var video_mode= 8;
var video_screen= 1;
var video_depth= 32;
var screen_color[3]= 8,8,8;

include <level_loader_top.wdl>;
include <level_loader_car.wdl>;

string level1_wmb= <carmovesnd.wmb>;
string level2_wmb= <top_move_test.wmb>;

string desc_back= "Go back to main menu";

bmap main_pcx= "mrcode.pcx";
bmap mouse_pcx= "bcursor.pcx";

panel main_pan
{
pos_x= 0;
pos_y= 0;
bmap= main_pcx;
flags= visible;
}

panel button1_pan
{
button= (384,250,"topspinner_on.pcx","top_spinner.pcx","topspinner_ovr.pcx",load_lvl1,null,null);
layer= 2;
flags= visible;
}

panel button2_pan
{
button= (350,350,"car3d_on.pcx","car_3d.pcx","car3d_ovr.pcx",load_lvl2,null,null);
layer= 2;
flags= visible;
}

panel exit_pan
{
button (290,450,"exit_on.pcx","exit_off.pcx","exit_ovr.pcx",exit,null,null);
layer= 2;
flags= visible;
}

panel back_button
{
button= (0,0,"back_on.pcx","back.pcx","back_ovr.pcx",go_back,back_desc_off,back_desc_on);
layer= 4;
}

function main()
{
mouse_map= mouse_pcx;
mouse_mode= 2;
while(1)
{
mouse_pos.x= pointer.x;
mouse_pos.y= pointer.y;
wait(1);
}
}

function load_lvl1()
{
wait(1);
button1_pan.visible= off;
wait(1);
button2_pan.visible= off;
wait(1);
exit_pan.visible= off;
wait(1);
main_pan.visible= off;
wait(1);
back_button.visible= on;
wait(1);
level_load (level2_wmb);
wait(1);
camera.x= 0;
camera.y= -876;
camera.z= 664;
camera.pan= 90;
camera.tilt= -62;
camera.roll= 0;
}

function load_lvl2()
{
wait(1);
button2_pan.visible= off;
wait(1);
button1_pan.visible= off;
wait(1);
exit_pan.visible= off;
wait(1);
main_pan.visible= off;
wait(1);
back_button.visible= on;
wait(1);
level_load (level1_wmb);
wait(2);
camera.x= -714;
camera.y= 0;
camera.z= 845;
camera.pan= 360;
camera.tilt= -71;
camera.roll= 0;
}

function exit()
{
sys_exit (null);
}

text desc_txt
{
pos_x= 70;
pos_y= 10;
string= desc_back;
}

function go_back()
{
wait(1);
main_pan.visible= on;
wait(1);
button1_pan.visible= on;
wait(1);
button2_pan.visible= on;
wait(1);
exit_pan.visible= on;
wait(1);
back_button.visible= off;
wait(1);
desc_txt.visible= off;
}

function back_desc_on()
{
desc_txt.visible= on;
}

function back_desc_off()
{
desc_txt.visible= off;
}



The code for the two levels is in the other two files. "#include" is used for preprocessing, whereas "include" reads from the files after compilation.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Simple Question on oragnization [Re: MrCode] #137463
06/21/07 22:18
06/21/07 22:18
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
I didn't realize "#include" and "include" were two different tags. I'm used to C++ so I generally used #include. When would you use the "#include" tag vs. "include?"

Re: Simple Question on oragnization [Re: Knuckles] #137464
06/21/07 22:41
06/21/07 22:41
Joined: May 2006
Posts: 398
Bot190 Offline
Senior Member
Bot190  Offline
Senior Member

Joined: May 2006
Posts: 398
ok, you can do that, its what almost if not every one does. first its easier to find things and second you can use that code elsewere. all you have to do is put the following somewere near the top of your main script, "include <player.wdl>;" thats it, you would change player.wdl to the name of you script...


Wait, there isn't a "Make My Game Now" button?

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1