LevelLoading problem
by Eric Schwegler · in Torque Game Builder · 08/14/2006 (5:33 am) · 2 replies
Hi,
is it possible to load a level on collision?
For example, if the player collides with a hole, can't I do this:
function Player::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal,
%contacts, %points)
{
if (%dstObject.class $= "Level2")
{
sceneWindow2D.loadLevel("ProjectName/data/levels/level2.t2d");
}
}
(Where "Player" is the Player Class and "level2" is the hole class)
?
Because it crashes everytime on collision...?
Can somebody help me with this?
Thx
is it possible to load a level on collision?
For example, if the player collides with a hole, can't I do this:
function Player::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal,
%contacts, %points)
{
if (%dstObject.class $= "Level2")
{
sceneWindow2D.loadLevel("ProjectName/data/levels/level2.t2d");
}
}
(Where "Player" is the Player Class and "level2" is the hole class)
?
Because it crashes everytime on collision...?
Can somebody help me with this?
Thx
About the author
Torque Owner Brian Hill
Try adding a short delay with 'schedule' -- something like this (replace your current 'loadLevel' line):
sceneWindow2D.schedule(1,"loadLevel","ProjectName/data/levels/level2.t2d");