Tutorial: getCount() problems
by Dave Anderson · in Torque Game Engine · 11/10/2008 (2:36 pm) · 0 replies
I'm working through the Demo game where you collide with logos placed on the landscape, and they disappear (http://tdn.garagegames.com/wiki/Beginner/Torque_Intro). When they're all gone, you win.
Question: how do those logo objects become identified with the name "logos", so that the function call logos.getCount() in logoitems.cs returns a number? Doing a text search, the only .cs file where I see the word "logos" is in logoitems.cs - and there's no declaration connecting the "TorqueLogoItem" datablock with the word "logos". Is it just the SimGroup they're in?
My logos work just fine. But I've tried inserting other objects into this game, copying what I did with the logos, and can't get them to work. Specifically, the skulls in Torque for Teens. The skulls are simple objects with textures, just like the logos.
I've created a SimGroup called "Skulls" to contain them. But on collision with any of them, the console gives me the error message "unknown command getCount()" presumably because "skulls" isn't identified as a SimGroup. The datablock code and onCollision code are in the same file as the logos (logoitems.cs), and it compiles okay.
Below the message about getCount(), the console also prints "object skull(9) skull -> staticShapedata -> ShapeBaseData -> GameBaseData -> SimDataBlock -> SimObject" - if that's of any help.
What's going on here? Any help would be much appreciated!
Question: how do those logo objects become identified with the name "logos", so that the function call logos.getCount() in logoitems.cs returns a number? Doing a text search, the only .cs file where I see the word "logos" is in logoitems.cs - and there's no declaration connecting the "TorqueLogoItem" datablock with the word "logos". Is it just the SimGroup they're in?
My logos work just fine. But I've tried inserting other objects into this game, copying what I did with the logos, and can't get them to work. Specifically, the skulls in Torque for Teens. The skulls are simple objects with textures, just like the logos.
I've created a SimGroup called "Skulls" to contain them. But on collision with any of them, the console gives me the error message "unknown command getCount()" presumably because "skulls" isn't identified as a SimGroup. The datablock code and onCollision code are in the same file as the logos (logoitems.cs), and it compiles okay.
Below the message about getCount(), the console also prints "object skull(9) skull -> staticShapedata -> ShapeBaseData -> GameBaseData -> SimDataBlock -> SimObject" - if that's of any help.
What's going on here? Any help would be much appreciated!
About the author
I teach game development and video at Holyoke Community College in western Mass. Previously, I spent 20 years as a software engineer in television and multimedia. I hold an M.A. in Education, and am a writer of educational materials.