GetName() Oddity
by David Taylor · in Torque Game Builder · 11/26/2008 (2:24 am) · 1 replies
I have a number of sprites in my scene window which all fall under the same class, mapLocation.cs. Each of these mapLocations has two behaviours: a tool tip, and an object overlay. Each mapLocation also has its own unique name assigned to it: Forest, Village, Bridge, etc.
I want to have the code get the mapLocation's name in an onMouseDown() call so that the game knows which level to load. The only problem is that when, in mapLocation.cs, I call %this.getName(), it returns the name of the object overlay! If I tick the 'persist' tickbox in the editor, it then returns the correct name, but the tool tip and object overlay effects are no longer visible.
How can I have it return the name of the mapLocation itself, and not the overlaid object, while keeping the tool tip and object overlay effects?
I want to have the code get the mapLocation's name in an onMouseDown() call so that the game knows which level to load. The only problem is that when, in mapLocation.cs, I call %this.getName(), it returns the name of the object overlay! If I tick the 'persist' tickbox in the editor, it then returns the correct name, but the tool tip and object overlay effects are no longer visible.
How can I have it return the name of the mapLocation itself, and not the overlaid object, while keeping the tool tip and object overlay effects?
About the author
Torque Owner David Taylor