saveScene and loadScene - How do I add script control?
by Jack Haynes · in Torque Game Builder · 03/02/2009 (3:16 pm) · 0 replies
I create a scene with two objects. Both objects have the following
properties set (in addition to others) in their datablocks:
UseMouseEvents = "1";
CollisionResponseMode = "BOUNCE";
Object1 is immovable. Object2 bounces up and down on the immovable object.
With each collision, a function,Object2Class::onCollision(%this) causes a sound to be played (alxPlay).
Also, both objects can be deleted with the click of a mouse using a function like this:
I run this function:
Then I run this function:
Visually, the two objects behave just as they did. However, the object
collision no longer triggers an audio event, and neither object can be
deleted by a mouse click.
How might the objects retain their scripted properties using saveScene and loadScene? If this isn't possible, what do I need to be looking at?
properties set (in addition to others) in their datablocks:
UseMouseEvents = "1";
CollisionResponseMode = "BOUNCE";
Object1 is immovable. Object2 bounces up and down on the immovable object.
With each collision, a function,Object2Class::onCollision(%this) causes a sound to be played (alxPlay).
Also, both objects can be deleted with the click of a mouse using a function like this:
function Object1Class::onMouseDown( %this, %mod, %worldPos, %mouseClicks ){%this.safeDelete();}I run this function:
function Save()sceneWindow2D.getSceneGraph().saveScene("~/state.scn");} Then I run this function:
function Load(){sceneWindow2D.getSceneGraph().loadScene("~/state.scn");} Visually, the two objects behave just as they did. However, the object
collision no longer triggers an audio event, and neither object can be
deleted by a mouse click.
How might the objects retain their scripted properties using saveScene and loadScene? If this isn't possible, what do I need to be looking at?