Suggestion: fxStaticSprite2D::getFrame()
by Jason Cahill · in Torque Game Builder · 03/27/2005 (11:42 pm) · 4 replies
Scenario:
I have a tile map that I am using for my game board. To make nice movements between tiles, I nuke the tile, enable a hidden sprite (which moves), and when it arrives at the destination, I disable the sprite and set the tile image.
To do this, I get get the tile frame from the tile layer: getWord(getTileType(%x SPC %y), 2). I then set this as the frame for my sprite: %sprite.setFrame(). When I reach the destination there is no way to do the reverse:
%frame = %sprite.getFrame();
%tilelayer.setStaticTile(...);
Result:
Can't do it.
Expect:
fxStaticSprite2D::getFrame() - string - returns the frame number for the current sprite, or "", if the sprite is not using a celled image map.
Work-around:
Cache the frame as a property on the sprite.
I have a tile map that I am using for my game board. To make nice movements between tiles, I nuke the tile, enable a hidden sprite (which moves), and when it arrives at the destination, I disable the sprite and set the tile image.
To do this, I get get the tile frame from the tile layer: getWord(getTileType(%x SPC %y), 2). I then set this as the frame for my sprite: %sprite.setFrame(). When I reach the destination there is no way to do the reverse:
%frame = %sprite.getFrame();
%tilelayer.setStaticTile(...);
Result:
Can't do it.
Expect:
fxStaticSprite2D::getFrame() - string - returns the frame number for the current sprite, or "", if the sprite is not using a celled image map.
Work-around:
Cache the frame as a property on the sprite.
About the author
#2
03/28/2005 (9:02 am)
You have a set method, but no get method. I can work-around the fact that you don't have a get method, by double storing the information. I'm just asking for you to have a "getFrame" accessor. This is a suggestion, not a "bug".
#3
OKay, I understand now. Sorry, it wasn't obvious to me what you meant. Yes, you are quite correct, it would be nice to add an accessor for static tiles.
Will do!
Thanks,
- Melv.
03/28/2005 (12:33 pm)
Jason,OKay, I understand now. Sorry, it wasn't obvious to me what you meant. Yes, you are quite correct, it would be nice to add an accessor for static tiles.
Will do!
Thanks,
- Melv.
#4
Added the following calls to fxStaticSprite2D...
getImageMap() - Current ImageMap.
getFrame() - Current Frame.
Expect these in the next update.
- Melv.
03/30/2005 (7:24 am)
Jason,Added the following calls to fxStaticSprite2D...
getImageMap() - Current ImageMap.
getFrame() - Current Frame.
Expect these in the next update.
Quote:fxStaticSprite2D::getFrame() - string - returns the frame number for the current sprite, or "", if the sprite is not using a celled image map.Not sure why you'd want nothing if the imagemap wasn't a "celled" one. I presume you just mean if no imagemap is assigned perhaps, it's just that imagemaps have a "cell" mode.
- Melv.
Associate Melv May
Probably me being a little sick and a little dumb.
- Melv.