Object scenegraph2d not found
by James Ford · in Torque Game Builder · 06/10/2006 (4:25 pm) · 3 replies
For somereason one of my keybinds is not working, and when I try to access scenegraph2d from keybinds.cs I get the error "object scenegraph2d trying to access scenegraph2d::pickpoint not found" (or close to that).
Heres my code at the beginning of main.
And here is where I am getting the errors from keybinds.cs.
(this is within a function that is called by the function actually bound to a keypress)
When I load a level is my scenegraph getting replaced or something?
Also, I am always getting the error "keybinds.cs not found", except they obviously were found because my keybinds work! (except for this other problem)
Heres my code at the beginning of main.
function initializeProject()
{
exec("./gui/mainScreen.gui");
exec("./gamescripts/keybinds.cs");
exec("./gamescripts/game.cs");
canvas.setcontent(mainscreengui);
canvas.setCursor(defaultcursor);
new t2dSceneGraph(sceneGraph2D);
sceneWindow2D.setSceneGraph( sceneGraph2D );
scenewindow2d.loadlevel( "fight/data/levels/level.t2d" );
setupkeybinds();
}And here is where I am getting the errors from keybinds.cs.
(this is within a function that is called by the function actually bound to a keypress)
%var = scenegraph2d.pickpoint( %obj.getpositionx(),%obj.getpositiony(),BIT(3),BIT(3),%obj ); %tilecoord = tile_layer.picktile(%x,%y);
When I load a level is my scenegraph getting replaced or something?
Also, I am always getting the error "keybinds.cs not found", except they obviously were found because my keybinds work! (except for this other problem)
About the author
http://jamesdev.info
#2
06/11/2006 (11:47 pm)
SceneWindow2D.loadLevel will use the scenegraph in the level file, so creating 'sceneGraph2D' is unnecessary. What you'll want to do is either name your scenegraph in the level builder (in the scripting section of the edit tab when no objects are selected) or store the return value of the loadLevel function. sceneWindow2D.loadLevel will return the scenegraph it is using so you could do something like:%scenegraph = sceneWindow2D.loadLevel("fight/data/levels/level.t2d");
#3
06/12/2006 (6:12 am)
Thanks guys
Torque Owner Alex Rice
Default Studio Name
%levelContent = new t2dSceneGraph(MLEggsSceneGraph) {I think you are correct the scenegraph name changes when you load the level.