Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[Newton] Levelchange / .cls problem #46337
05/19/05 23:25
05/19/05 23:25
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Hello,

The Newton physics work great in my first level.
However, the problem is when I build other levels then load them,
the physics entities fall through the floor because
the .cls won't build- only for the 1st level.
It was hard to find an answer on the newton forum.


This is what I have:
=================================
Main script: for level 1 (works)
=================================


ifdef USE_NEWTON_GAME_DYNAMICS;
string newtonLevel_cls = <intro.CLS>;
endif;

string level_str = <intro.WMB>; // Intro level

// now load the level
level_load(level_str);

// initialize newton physics
ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (level_str);
endif;


=================================
My Levelchange script:
=================================

ifdef USE_NEWTON_GAME_DYNAMICS;
string newtonLevel_cls = <21level0.CLS>;
endif;

ifdef USE_NEWTON_GAME_DYNAMICS;
string newtonLevel_cls = <21level1.CLS>;
endif;

/////////////////////////////////////////////////////
string 21level0_wmb = <21level0.wmb>;

action change_21level0
{
cross_pan.visible = OFF;
while (player == null) {wait (1);}
while (vec_dist (my.x, player.x) > 100) {wait (1);}

level_load(21level0_wmb);
ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (level_str);
endif;
}


string 21level1_wmb = <21level1.wmb>;

action change_21level1
{
while (player == null) {wait (1);}
while (vec_dist (my.x, player.x) > 100) {wait (1);}
level_load(21level1_wmb);
ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (level_str);
endif;
}

Last edited by Daedelus; 05/19/05 23:27.

Formula Games - A place to buy and sell Indie games.
Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46338
06/03/05 23:09
06/03/05 23:09
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Should I bump this or throw the mold out?


Formula Games - A place to buy and sell Indie games.
Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46339
06/14/05 22:12
06/14/05 22:12
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Hi Daedelus,
IŽve seen in the Newton forum that you have a lot of trouble with this problem...

IŽve found this in the newton.wdl:

// NewtonRemoveMap:
// description: destroy the level map
// parameters:
// return:
// remarks: detsroy the map
dllfunction NewtonRemoveMap();

Maybe you must destroy your old map before you can load a new one?
Just an Idea.

greets, fogman


no science involved
Re: [Newton] Levelchange / .cls problem [Re: fogman] #46340
06/14/05 23:33
06/14/05 23:33
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Quote:

// NewtonRemoveMap:
// description: destroy the level map
// parameters:
// return:
// remarks: detsroy the map
dllfunction NewtonRemoveMap();




Thanks for the suggestion Fogman.
I came across that too but for some reason, my script was causing a "Windows MFC error" and Gamestudio would quit so I put Newton on hold for a while.
I'll probably just start over since its likely a mistake I made somewhere in the process.


Formula Games - A place to buy and sell Indie games.
Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46341
06/15/05 16:32
06/15/05 16:32
Joined: Jun 2004
Posts: 241
muralist Offline
Member
muralist  Offline
Member

Joined: Jun 2004
Posts: 241
Destroy the level map and also (I think) entities.

Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46342
06/16/05 17:49
06/16/05 17:49
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
// NewtonRemoveAllBodies:
// description: destroy all physics entities, including the map (usefull for changing levels)
dllfunction NewtonRemoveAllBodies ();

Another one, I think exactly the one youŽll need!
IŽm at translating the descriptions in the newton.wdl to german, so IŽll
know all Newton functions in the next days


no science involved
Re: [Newton] Levelchange / .cls problem [Re: fogman] #46343
06/20/05 00:23
06/20/05 00:23
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
I thought I'd make another attempt at this levelchanger script.
While I no longer get that MFC error, I still can't get the .cls file to be created for 21level1.wmb.
The physics work but still fall through the floor because of the .cls not being present.

Here's what I have so far:

//////////////////////////////////////////////////////
ifdef USE_NEWTON_GAME_DYNAMICS;
string newtonLevel0_cls = <21level0.CLS>;
endif;

ifdef USE_NEWTON_GAME_DYNAMICS;
string newtonLevel1_cls = <21level1.CLS>;
endif;


/////////////////////////////////////////////////////
string 21level0_wmb = <21level0.wmb>;

action change_21level0
{
cross_pan.visible = OFF;
while (player == null) {wait (1);}
while (vec_dist (my.x, player.x) > 100) {wait (1);}
NewtonRemoveAllBodies ();
NewtonRemoveMap();
level_load(21level0_wmb);
wait(3);
ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (newtonLevel0_cls);
endif;

}


string 21level1_wmb = <21level1.wmb>;

action change_21level1
{
while (player == null) {wait (1);}
while (vec_dist (my.x, player.x) > 100) {wait (1);}
NewtonRemoveAllBodies ();
NewtonRemoveMap();
level_load(21level1_wmb);
wait(3);
ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (newtonLevel1_cls);
endif;

}

Any other ideas?

Last edited by Daedelus; 06/20/05 02:57.

Formula Games - A place to buy and sell Indie games.
Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46344
06/20/05 00:50
06/20/05 00:50
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Here is a siple script that you can use to create the .cls files for your levels.
It should create the .CLS everytime.
Just make sure you save your level before running.

Remember, you must create your 21level1_wmb's .cls file before trying to run and load it through your script.



////////////////////////////////////////////////////////////////////////////
// The engine starts in the resolution given by the follwing vars.
var video_mode = 7; //800x600;
var video_depth = 16; // start in 16 bit resolution

ifdef develop;
plugindir="\\a6\\acknex_plugins";
dllfunction debugmsg(message);
endif;

string s_level=<yourLevel.wmb>;
string s_levelcls=<yourLevel.cls>;

string newtonLevel_cls=s_levelcls;

function main()
{
wait(3);
level_load(s_level);
wait(1);

dll_handle=newtonHandle;
NewtonAddMap(s_level,0);
}

Re: [Newton] Levelchange / .cls problem [Re: Josh_Arldt] #46345
06/20/05 01:40
06/20/05 01:40
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Thanks for the reply Josh. Im testing out your method now.
My first level actuall is intro.wmb and the .cls always would build fine with the map in the compiler.
Its just the levels after it that don't. 21level0.wmb, 21level1.wmb
Is there anything in the script I posted above that doesen't look right as far as following the Newton instructions?


Formula Games - A place to buy and sell Indie games.
Re: [Newton] Levelchange / .cls problem [Re: Daedelus] #46346
06/20/05 01:46
06/20/05 01:46
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Quote:

Is there anything in the script I posted above that doesen't look right as far as following the Newton instructions?




The way you did it doesn't seem to build or load the .cls file with A6.31.4.
I'm going to make test levels and see what your script does after I change some things.

It seems we need to somehow change this string "string newtonLevel_cls=s_levelcls;" when the level changes.

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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