T2dsceneobject.moveto() taking a detour
by Shaz · in Torque Game Builder · 08/20/2008 (5:20 am) · 1 replies
I'm trying to move a sprite based on grid locations. It seems to be working when I move from side to side, but when I move up and down, it moves from A to B ok, but gets sidetracked on its way to C.
My code reads:
$player.moveto(tiles.TileToWorld(%newpos), 50, true, true, true, 1.500);
I did have it as:
$player.moveto(tiles.TileToWorld(%newpos), 50, true, true);
with the same results.
From the coordinates below it SEEMS the sprite starts heading up, then changes direction to go up and to the right. My onPositionTarget event isn't getting triggered, which seems to agree with the 1.500 range not being reached. However, the sprite itself isn't moving at all!
... and it just keeps getting closer to the target in the Y direction, but further away in the X.
I have send/receive collision turned on, and send physics. Collision callback is on, but I don't have a method written for it yet. I've also turned off the layers that the tilemap is on, so the sprite doesn't collide with them.
Any idea what I'm missing?
My code reads:
$player.moveto(tiles.TileToWorld(%newpos), 50, true, true, true, 1.500);
I did have it as:
$player.moveto(tiles.TileToWorld(%newpos), 50, true, true);
with the same results.
From the coordinates below it SEEMS the sprite starts heading up, then changes direction to go up and to the right. My onPositionTarget event isn't getting triggered, which seems to agree with the 1.500 range not being reached. However, the sprite itself isn't moving at all!
player position: 8.000 181.000 (4 11) - moving to (4 10) ... T ok Moving to 8.000000 143.000000 (4 10) Player at 8.000 179.400 (4 11) Player at 8.000 177.800 (4 11) Player at 8.000 176.200 (4 11) Player at 8.000 174.600 (4 11) Player at 8.000 173.000 (4 11) Player at 8.000 171.400 (4 11) Player at 8.000 169.800 (4 11) Player at 8.000 168.200 (4 11) Player at 8.000 166.600 (4 11) Player at 8.000 165.000 (4 11) Player at 8.000 163.400 (4 11) Player at 8.000 161.800 (4 10) Player at 8.000 160.200 (4 10) Player at 8.000 158.600 (4 10) Player at 8.000 157.000 (4 10) Player at 8.022 156.710 (4 10) Player at 8.050 156.709 (4 10) Player at 8.077 156.709 (4 10) Player at 8.105 156.708 (4 10) Player at 8.132 156.708 (4 10) Player at 8.160 156.707 (4 10) Player at 8.187 156.707 (4 10) Player at 8.215 156.706 (4 10) Player at 8.242 156.706 (4 10) Player at 8.270 156.705 (4 10) Player at 8.297 156.705 (4 10) Player at 8.325 156.704 (4 10) Player at 8.352 156.704 (4 10) Player at 8.380 156.703 (4 10) Player at 8.407 156.703 (4 10) Player at 8.435 156.702 (4 10) Player at 8.462 156.702 (4 10) Player at 8.490 156.702 (4 10) Player at 8.517 156.701 (4 10) Player at 8.545 156.701 (4 10) Player at 8.572 156.700 (4 10) Player at 8.600 156.700 (4 10) Player at 8.627 156.699 (4 10) Player at 8.655 156.699 (4 10) Player at 8.682 156.698 (4 10) Player at 8.710 156.698 (4 10) Player at 8.737 156.697 (4 10) Player at 8.765 156.697 (4 10) Player at 8.792 156.696 (4 10) Player at 8.820 156.696 (4 10) Player at 8.847 156.695 (4 10) Player at 8.875 156.695 (4 10) Player at 8.902 156.694 (4 10) Player at 8.930 156.694 (4 10) Player at 8.957 156.693 (4 10) Player at 8.985 156.693 (4 10) Player at 9.012 156.693 (4 10) Player at 9.040 156.692 (4 10) Player at 9.067 156.692 (4 10) Player at 9.095 156.691 (4 10) Player at 9.122 156.691 (4 10) Player at 9.150 156.690 (4 10) Player at 9.177 156.690 (4 10) Player at 9.205 156.689 (4 10) Player at 9.232 156.689 (4 10) Player at 9.260 156.688 (4 10) Player at 9.287 156.688 (4 10) Player at 9.315 156.687 (4 10) Player at 9.342 156.687 (4 10) Player at 9.369 156.686 (4 10) Player at 9.397 156.686 (4 10) Player at 9.424 156.685 (4 10) Player at 9.452 156.685 (4 10) Player at 9.479 156.684 (4 10) Player at 9.507 156.684 (4 10) Player at 9.534 156.684 (4 10) Player at 9.562 156.683 (4 10) Player at 9.589 156.683 (4 10) Player at 9.617 156.682 (4 10) Player at 9.644 156.682 (4 10) Player at 9.672 156.681 (4 10) Player at 9.699 156.681 (4 10) Player at 9.727 156.680 (4 10) Player at 9.754 156.680 (4 10) Player at 9.782 156.679 (4 10) Player at 9.809 156.679 (4 10) Player at 9.837 156.678 (4 10) Player at 9.864 156.678 (4 10) Player at 9.892 156.677 (4 10) Player at 9.919 156.677 (4 10) Player at 9.947 156.676 (4 10) Player at 9.974 156.676 (4 10)
... and it just keeps getting closer to the target in the Y direction, but further away in the X.
I have send/receive collision turned on, and send physics. Collision callback is on, but I don't have a method written for it yet. I've also turned off the layers that the tilemap is on, so the sprite doesn't collide with them.
Any idea what I'm missing?
About the author
Torque Owner Shaz