TGB 1.5 - sceneWindow2D object not accessible within the Editor
by Ulric Boel · in Torque Game Builder · 07/16/2007 (12:37 am) · 2 replies
Hi,
I was discovering the behaviors and while trying to code a simple a background behavior centering a static sprite at camera position and resizing it to the window resolution, I found out that the SceneWindow2D object is not accessible anymore from within the TGB editor... (It was accessible with the version 1.1.3).
This code is working when I run the game...but not when fired from within the editor!
I was discovering the behaviors and while trying to code a simple a background behavior centering a static sprite at camera position and resizing it to the window resolution, I found out that the SceneWindow2D object is not accessible anymore from within the TGB editor... (It was accessible with the version 1.1.3).
if (!isObject(BackgroundBehavior))
{
%template = new BehaviorTemplate(BackgroundBehavior);
%template.friendlyName = "Background";
%template.behaviorType = "GUI";
%template.description = "Set a static sprite as background, centered on the camera position and sized properly";
}
function BackgroundBehavior::onBehaviorAdd(%this)
{
%temp = sceneWindow2D.getWindowExtents();
%posX = getWord(%temp, 0);
%posY = getWord(%temp, 1);
%sizeX = getWord(%temp, 2);
%sizeY = getWord(%temp, 3);
%this.owner.setPosition(%posX, %posY);
%this.owner.setSize(%sizeX, %sizeY);
%this.owner.layer = 31;
}This code is working when I run the game...but not when fired from within the editor!
#2
That's pity this object (and perhaps some others) could not be used anymore in the Editor of version 1.5...could be really useful for some behaviours...like my background stuff.
But anyway...now I know the reason...
Thanks a lot
Ulric
07/16/2007 (4:16 am)
Thanks for the answer.That's pity this object (and perhaps some others) could not be used anymore in the Editor of version 1.5...could be really useful for some behaviours...like my background stuff.
But anyway...now I know the reason...
Thanks a lot
Ulric
Torque Owner Jemand den es nicht gibt