Game Development Community

Problem with the Tetris tutorial

by James Daniel · in Torque Game Builder · 04/10/2007 (1:58 pm) · 4 replies

I've been runing through the Tetris Tutorial and I get the following error in my console window
Tetris/gameScripts/games.cs (30) Unable to find object: 'shapeGroup' attempting to call function 'getCount'

My question is this, is this being caused by my running the game before I've put in all the code or is it a real bug? I doing all this after I completed the "Current Shape" section as I wanted to run the console command "$GAME::CurrentShape.dump();"

#1
04/10/2007 (2:11 pm)
The error you're seeing in the console is pretty specific. It's telling you that it can't find an object named 'shapeGroup', so it can't perform shapeGroup.getCount(...). Looking at the tutorial, it seems that shapeGroup is created in ShapeTemplate::onAdd, so whenever you have a tile layer with that class it should create shapeGroup if it doensn't already exist. This should work fine by the time you get to that point in the tutorial.

In order to get that error you must be either missing the ShapeTemplate::onAdd method, forgot to set any tile layers' class to ShapeTemplate, are not executing the code that where ShapeTemplate::onAdd is defined, or there are no ShapeTemplate tile layers in the scene by the time shapeGroup is accessed.

Post back if you have any trouble finding the cause of the error.
#2
04/10/2007 (2:28 pm)
Thanks alot, that was the problem. I don't see anywhere in the tutorial tell me that I need to give the layers a class name, or what the class name should be. Is that missing or do I need to get my eyes checked ;)
#3
04/10/2007 (3:55 pm)
Got a new issue, when ever I exit TGB and then restart I loose the class name on the ShapeTemplate layers. I do not have any of the layers in the screen, is this what needs to be done or am I not setting something correctly when I edit the layers?
#4
04/10/2007 (6:47 pm)
Never Mind, I downloaded the sample code/project and yes the ShapeTemplate layers are there.