Posted By: Daedelus
[Newton] Levelchange / .cls problem - 05/19/05 23:25
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;
}
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;
}