Game Development Community

Puzzle Games Tutorial

by Charles "monkeyboy" Gibson · in Torque Game Builder · 07/04/2006 (5:38 am) · 5 replies

Hi, I am going through the Puzzle Game tutorial in TDN and had a question about the script block under the "Building Blocks" section particularly regarding the ShapeTemplate::onAdd() function. I understand what the function is doing, but I am not sure where the "shapeGroup" variable came from or what type of variable it is.

Here is a snippet of the script I am having difficulty parsing.

if(!isObject(shapeGroup))
new SimSet(shapeGroup);

...

shapeGroup.add(%this);

In the first line of the script it checks to see if it exists and if it doesn't it creates a new SimSet which I am understanding is a collection of SimObjects. So my first question is does "shapeGroup" exist elsewhere? Also, what type of variable is it since there isn't either '%' or '$' preceeding it? Another question that popped up is why is it being passed to the SimSet constructor as a parameter? I looked up the SimSet reference and I didn't see anything regarding a parameterized constructor for SimSet.

Thanks in advance for your help.

#1
07/04/2006 (6:37 am)
The script new does not have constructors. The argument is the name of the object. You can access objects by name directly. That is what's happening.
#2
07/04/2006 (6:58 am)
Ahh, I was assuming something like that, but was a bit confused because the name didn't have to be withing double quotes.

Thanks for the quick response.
#3
07/17/2006 (10:57 am)
Which tutorial did you use? When I click on the Puzzle tuts in TGN they are all empty for me.(

http://tdn.garagegames.com/wiki/index.php?title=Torque_2D/GenreTutorials/PuzzlePuzzleMouseSelect&action=edit
#4
07/18/2006 (4:30 am)
The Tetris Tutorial for the TGB

http://tdn.garagegames.com/wiki/Torque_2D/Getting_Started/T2DTetrisTutorial
#5
12/11/2006 (8:08 am)
I have tried that tetris tutorial but is not compatible with 1.1.3.

I'm wondering if TGB team is planning on update outdated tutorials? :)