Game Development Community

Simple problem!! please help me solve it

by Aidan Sliney · in Technical Issues · 02/10/2007 (9:13 am) · 3 replies

Hi everyone!!

I'm coding up something in my game and its driving me nuts!! I'd really appreciate it if somebody could give me a tip or two! basically when the player enters a trigger area i want an object (in this case a door) somewhere else in the game level to disappear. In my trigger.cs file I put in the line

door.delete();

but i get an error back saying:

"Unable to find object: ' ' attempting to call function 'delete;"

At first my door was a TS static but i've changed it to being a static shape now with a simple datablock. I've tried loads of different ways of calling this function from the trigger but nothing's working - i always get the same error!!!

Can anybody shed some light on this for me?

Thanks,
Aidan

#1
02/10/2007 (9:24 am)
Be sure that when you create the door you give it the name "door":

new StaticShape(door) {
blah blah blah
};
#2
02/10/2007 (9:30 am)
Thanks but I've done that. Is there anything else it could be, do you think?
Am I calling the delete function right? is it

$door.delete();
#3
02/10/2007 (11:17 am)
That is attempting to delete the object stored in the global variable door.
$door = new StaticShape() {
....
};
If you want to reference it by name use the code.
door.delete();