How to delete Static Sprites
by Colin Richardson · in Torque Game Builder · 11/11/2006 (1:38 pm) · 5 replies
Hello,
I'm still messing with the Mini Platformer and what i want to be able to do is to place items around that $pGuy can pick up, ie like the Fish Food in that demo.
However i don't want to respawn the Item as they're placed on the level in the designer i would prefer the deleted after they've added the bonus to the player.
How do i do this? I'm used to in other languages etc just deleting/releasing the object but i can't see to find a way to do this.
This is the basic code for the collision of the itemclass and the %this.delete causes an error with the script.
function items::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if(%dstObj.class $= "playerClass")
{
echo("Let's despawn this");
%this.delete;
}
}
So can anyone point me in the right direction please.
Thanks
I'm still messing with the Mini Platformer and what i want to be able to do is to place items around that $pGuy can pick up, ie like the Fish Food in that demo.
However i don't want to respawn the Item as they're placed on the level in the designer i would prefer the deleted after they've added the bonus to the player.
How do i do this? I'm used to in other languages etc just deleting/releasing the object but i can't see to find a way to do this.
This is the basic code for the collision of the itemclass and the %this.delete causes an error with the script.
function items::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if(%dstObj.class $= "playerClass")
{
echo("Let's despawn this");
%this.delete;
}
}
So can anyone point me in the right direction please.
Thanks
#2
Thanks very much, that worked a treat.
I can't find that Method anywhere in the docs for TGB (TGB Reference.pdf.)
So does anybody know where i can find that Method please.
Thanks again Gary.
Cheers
11/12/2006 (2:39 pm)
Hi Gary,Thanks very much, that worked a treat.
I can't find that Method anywhere in the docs for TGB (TGB Reference.pdf.)
So does anybody know where i can find that Method please.
Thanks again Gary.
Cheers
#3
11/12/2006 (2:59 pm)
Call the dump() function on any object and you can see a list of the functions in that object's namespace.
#4
Thanks for that.
But is there not a doc that lists all of this? I was kind of hoping that in the reference folder there would be a doc that listed everything.
Cheers
11/13/2006 (1:53 am)
Hi Ben,Thanks for that.
But is there not a doc that lists all of this? I was kind of hoping that in the reference folder there would be a doc that listed everything.
Cheers
Torque Owner Gary Preston