new t2dStaticSprite definitions
by Joao Brandao · in Torque Developer Network · 10/08/2011 (3:52 am) · 3 replies
I have a function that creates 2 rows of moving objects, from a random list of 5 possible imageMaps.
I can create them, and make them move, no problem. But I haven't been able to find out how to when creating a new t2dStaticSprite, give him a name, just as I would through the editor. I already have several working functions that work with objects with a certain name. So I would like to know if someone knows how I could create a new t2dStaticSprite through scripting, and give it a name, so it would also be affected by the functions I already created?
Right now, I have this and it doesn't work:
I can create them, and make them move, no problem. But I haven't been able to find out how to when creating a new t2dStaticSprite, give him a name, just as I would through the editor. I already have several working functions that work with objects with a certain name. So I would like to know if someone knows how I could create a new t2dStaticSprite through scripting, and give it a name, so it would also be affected by the functions I already created?
Right now, I have this and it doesn't work:
function createHouse()
{
%houseNew = new t2dStaticSprite()
{
scenegraph = sceneWindow2D.getSceneGraph();
class = egyptHouse;
name = $randomHouseName;
layer = 0;
imageMap = $randomHouse;
size = "100 100";
position = "620 320";
UsesPhysics = "1";
LinearVelocity = "-200 0";
};
}About the author
I'm a little old to start programming, as I'm 32, but being unemployed pushed me into learning new skills and go back to the area I graduated in (New Technologies). I am my own worst enemy, as I procrastinate a lot, and I'm very lazy. Also, I love games.
Recent Threads
Thread is locked
#2
I obviously appreciate your contribution, but it is REALLY late :) 4 years late. Not only did I launch that game I was working on a couple of years ago (It's called Lazy Santa, and it's for ipad only, please check it out :p) I have since abandoned Torque2d, and i'm currently developing a game for ios and android using unity and c#.
but again, thank you! :) that was mighty fine of you
08/02/2015 (2:45 pm)
oh wow! lolol I obviously appreciate your contribution, but it is REALLY late :) 4 years late. Not only did I launch that game I was working on a couple of years ago (It's called Lazy Santa, and it's for ipad only, please check it out :p) I have since abandoned Torque2d, and i'm currently developing a game for ios and android using unity and c#.
but again, thank you! :) that was mighty fine of you
#3
08/03/2015 (10:03 am)
Locking thread. Please do not resurrect old/dead threads.
Torque Owner Mike Kloeppner
right here in line 3
03. %houseNew = new t2dStaticSprite(NAME)