Class, Superclass, Inheritance
by Diogo Rios · in Torque Game Builder · 06/26/2008 (10:48 am) · 4 replies
Hello
I am confused as to how these work and couldnt find relevant info about it.
I got an object with class FoodHouse and Superclass House.
function House::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
echo("House");
}
function FoodHouse::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
echo("FoodHouse");
}
I think when mouse enters i should have 2 messages: House and FoodHouse but instead i get only FoodHouse. This doesnt seem right, any thoughts?
I am confused as to how these work and couldnt find relevant info about it.
I got an object with class FoodHouse and Superclass House.
function House::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
echo("House");
}
function FoodHouse::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
echo("FoodHouse");
}
I think when mouse enters i should have 2 messages: House and FoodHouse but instead i get only FoodHouse. This doesnt seem right, any thoughts?
About the author
#2
06/26/2008 (11:35 am)
Once again James, you ve been a great help. what can i say, if you keep helping me as you do, when our game comes out ill have to give you some credit :P
#3
06/26/2008 (3:45 pm)
James is a sick programmer.
#4
One other thing, when you use the "namespace"::"method" calling convention %this will NOT be passed automatically, so make sure you explicitly pass it to the Parent.
If you really love me you could recommend me to be an associate '-)
06/26/2008 (5:39 pm)
Haha thanks guys. One other thing, when you use the "namespace"::"method" calling convention %this will NOT be passed automatically, so make sure you explicitly pass it to the Parent.
If you really love me you could recommend me to be an associate '-)
Associate James Ford
Sickhead Games
function FoodHouse::onMouseEnter(....) { Parent::onMouseEnter(...); echo("FoodHouse"); }