Game Development Community

Annoying setImageMap setSize problem.

by Jon Mitchell · in Torque Game Builder · 12/20/2006 (6:16 pm) · 2 replies

I brought this up in another thread and I decided to break it off into its own unique problem. I have this section of code to create a projectile and fire it, but it seems like I can not rope in the size of the image at all.

%machinegun = new t2dStaticSprite() { scenegraph = sceneWindow2D.getSceneGraph(); };
   %machinegun.setImageMap( "particles1ImageMap" );
   %machinegun.setSize = "1, 1";
   %machinegun.setPosition( turret.getlinkpoint("2") ); 
   %machinegun.setRotation( turret.getRotation() );
   $machinegunSpeed = p1Tank.machineGunSpeed;
   %machinegun.setLinearVelocityPolar(   turret.getRotation(), t2dVectorLength(turret.getLinearVelocity() ) + $machinegunSpeed );


Phillip \"Renolc\" Gibson said change the .setSize to %cannon.setSize( 1, 1 ); which is exactly what is in the shooter demo, but that kicks out a parse error, I am at a little of a loss why it is erroring out.

#1
12/20/2006 (6:23 pm)
Quote:
%machinegun.setSize = "1, 1";
setSize is a function, not a field
%machinegun.setSize(1, 1);
#2
12/20/2006 (6:26 pm)
Nevermind, it was a really stupid mistake. when I tried what Philip and the demo said to do I had been putting in an equal sign ' = ' where there was no call for it :-p so instead of %cannon.setSize( 1, 1 ); I was using %cannon.setSize = ( 1, 1 );

And thank you Drew and Phillip :)