Confusion about how CopySource operates
by Michael Rogers · in Torque Game Engine · 07/07/2005 (12:04 pm) · 1 replies
I have the following code, and I don't understand why anotherMovieObject isn't getting the myFavoriteShow field from movieObject:
Shouldn't $anotherMovieObject acquire all of the dynamic fields, such as myFavoriteShow?
Thanks for any insights,
Michael
$movieObject = new SimObject(){
myFavoriteShow = "Toy Story II"; // a dynamic field in movieObject
};
$anotherMovieObject = new SimObject(freddie : movieObject){
myFavoriteAuthor = "Arthur Connon Doyle";
};
echo("1" SPC $movieObject.myFavoriteShow);
echo("2" SPC $movieObject.myFavoriteAuthor); // shouldn't exist
echo("3" SPC $anotherMovieObject.myFavoriteShow); // doesn't print because ???
echo("4" SPC $anotherMovieObject.myFavoriteAuthor); // should display ACDShouldn't $anotherMovieObject acquire all of the dynamic fields, such as myFavoriteShow?
Thanks for any insights,
Michael
About the author
Torque Owner Michael Rogers
The item following the : in new SimObject ( : ) must be the name of an object. So, this fixes my problem:
$movieObject = new SimObject(anderson){
myFavoriteShow = "Toy Story II"; // a dynamic field in movieObject
};
$anotherMovieObject = new SimObject(freddie : anderson){
myFavoriteAuthor = "Arthur Connon Doyle";
};
All praise to Joel Baxter, who's brilliant 2002 tutorial helped me understand this.
Michael