Game Development Community

Miniplatformer Update problem

by AzraelK · in Torque Game Builder · 11/08/2006 (9:52 am) · 4 replies

Im getting this warning everytime I try to work with my miniplatformer based game, Ive been working around with it, but I think I have to get it fixed.

trompo/gameScripts/player.cs (319): Unable to find object: '' attempting to call function 'updateMovement'

the code which generates this warning is this:

function t2dSceneGraph::onUpdateScene()
{
	if ($gameInProgress){
            $pGuy.updateMovement();
	}
}

#1
11/08/2006 (10:12 am)
You're getting the error because $pGuy is equal to the empty string.

Additionally, you need a %this in your arg list for onUpdateScene. You probably also want to name the scenegraph and call onUpdateScene on that namespace instead of the namespace of the type itself.
#2
11/08/2006 (11:10 am)
Thanks for answering.

You're getting the error because $pGuy is equal to the empty string.

Well.. that variable is stated in the level editor and the level.onloaded callback so Is not supposed to be empty

You probably also want to name the scenegraph and call onUpdateScene on that namespace 
instead of the namespace of the type itself.

To be honest I have no idea how to do that. Could you give me an example?
#3
11/08/2006 (11:50 pm)
1. Figure out why $pGuy is empty

2. Open your .t2d file and change "new t2dSceneGraph()" to "new t2dSceneGraph(myT2dScene)" and change "t2dSceneGraph::onUpdateScene()" to "myT2dScene::onUpdateScene(%this)"
#4
11/09/2006 (11:30 am)
Ah! Thanks that did solved the problem! Apparently I had already changed the scenegraph name and thats why I was getting the error.

Once again thanks!