Game Development Community

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?

#1
11/26/2008 (7:56 pm)
It must have been a syntax error on my part - I did it again from scratch and now it works fine. I don't need to have it persist and I still get the tool tip, the object overlay, and the correct name. :)