Game Development Community

Tutorial playerFire() issues

by Ben Batstone-Cunningham · in Torque Game Builder · 05/23/2005 (9:40 pm) · 3 replies

Still working through the tutorial - I keep getting hung up on hard to find problems. My latest is a real tickler. I have two blocks of (as far as I can tell) identical code. One is typed by hand, and does not work. The other is copied and pasted from the tutorial, and works fine. I have been staring at them, and comparing them for an hour now, and I can't see a difference, but t2d can. However, the syntax checker is silent.

This does not work:
function playerFire()
{
// Create player projectile.
%projectile = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%projectile.setPosition( $player.getPosition() );
%projectile.setSize( "3 1.5" );
%projectile.setImageMap( playermissileImageMap );
%projectile.setWorldLimit( kill, "52 -40 52 40" );
%projectile.setLinearVelocityX( 35 );	
}

This DOES work:
function playerFire()
{
// Create player projectile.
%projectile = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%projectile.setPosition( $player.getPosition() );
%projectile.setSize( "3 1.5" );
%projectile.setImageMap( playermissileImageMap );
%projectile.setWorldLimit( kill, "-52 -40 52 40" );
%projectile.setLinearVelocityX( 35 );
}

If you see anything, please let me know - this is pretty frusterating.

thanks,
bbc

#1
05/23/2005 (10:02 pm)
Does not work -> "52 -40 52 40"
Does work -> "-52 -40 52 40"
#2
05/23/2005 (10:03 pm)
First set

%projectile.setWorldLimit( kill, "52 -40 52 40" );

second set

%projectile.setWorldLimit( kill, "-52 -40 52 40" );

you seemingly set the world limit accidentally posotive 52 to pos 52 on x axis effectively "killing" the projectile instantly
#3
05/24/2005 (10:31 am)
*cries*

of course it would be that simple

thanks guys.

bbc