%this.owner.something = %this.something
by rennie moffat · in Torque Game Builder · 10/15/2009 (3:13 pm) · 4 replies
I see this time and time again, for instance
this particular code come from an onBehaviorAdd function,
my question is, why declare this? In other words, what is the differnece or benifit of having %this.owner.health = %this.health? Why not just have %this.owner.health?
%this.owner.Health = %this.Health; %this.owner.Defense = %this.Defense;
this particular code come from an onBehaviorAdd function,
my question is, why declare this? In other words, what is the differnece or benifit of having %this.owner.health = %this.health? Why not just have %this.owner.health?
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
So in this case, the health will belong to an owner, but in the end it is an object, a static sprite. So am I declaring the health of the owner is defined by (loose term) the health.
in other words, like the code says
10/15/2009 (3:33 pm)
oh i see.So in this case, the health will belong to an owner, but in the end it is an object, a static sprite. So am I declaring the health of the owner is defined by (loose term) the health.
in other words, like the code says
%this.owner.health = %this.health
#3
%this.owner.SOMEVARIABLE refers to a variable that belongs to the object that the behavior is attached to.
and...
%this.SOMEVARIABLE refers to a variable that belongs to the actual behavior.
Even though both may be named SOMEVARIABLE, they are NOT the same variable. That one confused me for a while. :)
10/15/2009 (4:45 pm)
When you see this in a behavior, it's important to realize the following:%this.owner.SOMEVARIABLE refers to a variable that belongs to the object that the behavior is attached to.
and...
%this.SOMEVARIABLE refers to a variable that belongs to the actual behavior.
Even though both may be named SOMEVARIABLE, they are NOT the same variable. That one confused me for a while. :)
Torque 3D Owner Ted Southard