Is this a bug ??
by Bruno · in Torque Game Builder · 08/09/2006 (1:52 pm) · 7 replies
Hi.,
Ok, i'm a bit puzzled by this, but i'm not sure if this would be a bug, seems something that would have been spotted a long time ago.,
Anyways, this is what i'm doing.
Take a look at this shot :
http://iluminategames.com/bug/normal.jpg
In that shot you can see a game board, of the size(5x5), and on the sides(up\left\top), when the mouse goes over a box the piece that we can put in the board shows up.
I do this by calling the PickTile funtion on the layer, and if i'm on a valid position(up\left\top) i render the piece that the player is about to place.
Now, the problem, check this image :
http://iluminategames.com/bug/m_buggy.jpg
Has you can see, the mouse is not on top of the layer, but still PickTile returns as if it was, and actually the problem is that it seems the layer is being wrapped, repeated all over, as he reads the tiles as if they were being repeated.
Here, i enabled the wrapping so you guys can see :
http://iluminategames.com/bug/buggy.jpg
By debugging values into the console, i found that PickTile is returning the cell(2,2) for example while in the correct position, and still (2,2) outside of the layer as if the layer was wrapped.
However setStaticTile(2,2) only renders in the right position, and not as if it was wrapped.
Anyone experienced this situation ?
thanks,
Bruno
Ok, i'm a bit puzzled by this, but i'm not sure if this would be a bug, seems something that would have been spotted a long time ago.,
Anyways, this is what i'm doing.
Take a look at this shot :
http://iluminategames.com/bug/normal.jpg
In that shot you can see a game board, of the size(5x5), and on the sides(up\left\top), when the mouse goes over a box the piece that we can put in the board shows up.
I do this by calling the PickTile funtion on the layer, and if i'm on a valid position(up\left\top) i render the piece that the player is about to place.
Now, the problem, check this image :
http://iluminategames.com/bug/m_buggy.jpg
Has you can see, the mouse is not on top of the layer, but still PickTile returns as if it was, and actually the problem is that it seems the layer is being wrapped, repeated all over, as he reads the tiles as if they were being repeated.
Here, i enabled the wrapping so you guys can see :
http://iluminategames.com/bug/buggy.jpg
By debugging values into the console, i found that PickTile is returning the cell(2,2) for example while in the correct position, and still (2,2) outside of the layer as if the layer was wrapped.
However setStaticTile(2,2) only renders in the right position, and not as if it was wrapped.
Anyone experienced this situation ?
thanks,
Bruno
About the author
#2
08/09/2006 (2:02 pm)
After typing that, it returns 0 on both X and Y.
#3
08/09/2006 (2:05 pm)
I'm resizing the layer in code too, but i don't think that should have anything to do with this
#4
Are you sure there are no tile layers being left over from past tests? Don't forget to resize the boundaries of the tile layer to the size of the grid.
08/09/2006 (2:26 pm)
How are you calling picktile? I just tried a quick test and on my one, if there's no tile present then it returns an empty string. Im typing into the console:echo($map.picktile(scenewindow2d.getMousePosition()))
Are you sure there are no tile layers being left over from past tests? Don't forget to resize the boundaries of the tile layer to the size of the grid.
#5
%x1 and %y1 returns empty if the mouse is not over the layer itself, but in this case, i'm not in the layer
but he stills returns as if it was, as if the wrapping was set, and it isn't, i'm even setting it off to make sure.
%this.mousepos = %worldpos;
%tileP = backL2.pickTile(%this.mousepos);
%x1 = getWord( %tileP, 0 );
%y1 = getWord( %tileP, 1 );
(edit)
Nope, no tile layers are left, and even if they were, i'm specifically using backL2.pickTile, so it can only pick tiles of this layer, and the layer itself has the normal size, i checked with getTileCount or whatever is the function called..
08/09/2006 (2:26 pm)
I'm calling it in the ordinary way%x1 and %y1 returns empty if the mouse is not over the layer itself, but in this case, i'm not in the layer
but he stills returns as if it was, as if the wrapping was set, and it isn't, i'm even setting it off to make sure.
%this.mousepos = %worldpos;
%tileP = backL2.pickTile(%this.mousepos);
%x1 = getWord( %tileP, 0 );
%y1 = getWord( %tileP, 1 );
(edit)
Nope, no tile layers are left, and even if they were, i'm specifically using backL2.pickTile, so it can only pick tiles of this layer, and the layer itself has the normal size, i checked with getTileCount or whatever is the function called..
#6
08/09/2006 (2:46 pm)
Really not sure what the problem could be. I've put your code in my test and it still works fine. If it is a bug, it must be to do with the way you've set your level up.
#7
I resized the layer to a much bigger size than i need in the editor, and i just use the tiles i want, all the tiles above the size of the board i ignore.
Not the ideial solution but it works.
I think this has something to do with resizing the layer in code.
Btw, if a layer is made in the editor, like (20x8) and we try to resize it by code to (10x4) it works, but if we
try to resize it to a value bigger than the original file (22x10) , it doens't work either, it's ignored.
08/09/2006 (3:31 pm)
Well, i fixed it, but not as i should.I resized the layer to a much bigger size than i need in the editor, and i just use the tiles i want, all the tiles above the size of the board i ignore.
Not the ideial solution but it works.
I think this has something to do with resizing the layer in code.
Btw, if a layer is made in the editor, like (20x8) and we try to resize it by code to (10x4) it works, but if we
try to resize it to a value bigger than the original file (22x10) , it doens't work either, it's ignored.
Torque Owner Apurva Amin
echo("X: " SPC $myMap.getWrapX() SPC "Y: " SPC $myMap.getWrapY());This will show whether the tile layer has been wrapped.