FxTileLayer2D.getVisible()?
by Joseph Albon · in Torque Game Builder · 03/23/2005 (11:02 am) · 9 replies
Last night I was up late again playing with my RPG. My goal: to create a basic inventory system. I decided to try to use a tile map to display the information. I got all my graphics loaded up and it appeared to work perfectly.
Until I tried to hide the silly thing. I had a keybind to toggle the visibility of the map, but getVisible on the layer always returned false and setVisible didn't see to have any effect. Is that functionality disabled for tile maps, or am I just doing something wrong?
As a workaround I simply set the layer to push it to the back or bring it to the front as needed.
Everything seemed to work fine, I could press my inventory toggle button all day and have the inventory appear and disappear seemingly at will. Until I started walking up and to the right. I could walk left and toggle. Up and left and toggle, down and right and toggle, right and toggle...everything but up and right. Any one seen anything like that? I'm thinking of calling it a feature.
Until I tried to hide the silly thing. I had a keybind to toggle the visibility of the map, but getVisible on the layer always returned false and setVisible didn't see to have any effect. Is that functionality disabled for tile maps, or am I just doing something wrong?
As a workaround I simply set the layer to push it to the back or bring it to the front as needed.
Everything seemed to work fine, I could press my inventory toggle button all day and have the inventory appear and disappear seemingly at will. Until I started walking up and to the right. I could walk left and toggle. Up and left and toggle, down and right and toggle, right and toggle...everything but up and right. Any one seen anything like that? I'm thinking of calling it a feature.
About the author
#2
03/23/2005 (11:17 am)
Wouldn't creating something with the GUI be better suited for an inventory system?
#3
Something like...
Make sure that you're doing this on a tile-layer (fxTileLayer2D) as the parent tilemap (fxTileMap2D) itself doesn't render anything and this setting has no effect.
All tile-layers are independant with the tilemap being a way to handle multiple layers, nothing to do with rendering.
- Melv.
03/23/2005 (11:34 am)
Joseph,Something like...
%layer.setVisible(false);... works perfectly, I just double-checked to make sure. ;)
Make sure that you're doing this on a tile-layer (fxTileLayer2D) as the parent tilemap (fxTileMap2D) itself doesn't render anything and this setting has no effect.
All tile-layers are independant with the tilemap being a way to handle multiple layers, nothing to do with rendering.
- Melv.
#4
@Owen - Maybe better, but this is mostly an experiment.
Since my inventory is grid based anyways I figured a tile map would be the easiest way to implement it since I can find what cell the user is clicking on to use/move an item with built in functionality. It also gives me a very easy way of snapping the items to the grid layout.
03/23/2005 (11:38 am)
@Philip - I can't think of any game I've played that can't handle up arrow + right arrow + i. I'll have to do some checking though.@Owen - Maybe better, but this is mostly an experiment.
Since my inventory is grid based anyways I figured a tile map would be the easiest way to implement it since I can find what cell the user is clicking on to use/move an item with built in functionality. It also gives me a very easy way of snapping the items to the grid layout.
#5
I know I intended to use the tile-layer to change visibility. I even double checked that.
Whether or not that's really what happened is another matter (as I said above, I was up past my bed time again).
Your engine may be the death of me.
03/23/2005 (11:40 am)
Thanks Melv!I know I intended to use the tile-layer to change visibility. I even double checked that.
Whether or not that's really what happened is another matter (as I said above, I was up past my bed time again).
Your engine may be the death of me.
#6
someone also released a drag n drop Torque resource that seemingly should be usable here... a whole new GUI control (but I'd think you can accomplish the same thing with a tilemap
03/23/2005 (11:41 am)
Very true Joseph... I like the idea of a tilemap being used as inventory...someone also released a drag n drop Torque resource that seemingly should be usable here... a whole new GUI control (but I'd think you can accomplish the same thing with a tilemap
#7
As soon as I took that out it worked perfectly.
03/23/2005 (2:58 pm)
Hah! Found my issue. I had the tilemap mounted to the player object so it would move as the player moved.As soon as I took that out it worked perfectly.
#8
My tile-map inventory is fully functional!
I can click on an object in the grid, move it with the mouse, click again and it moves itself.
My weak programmer skills are hugging themselves with great joy.
Got my key mapping issue resolved as well. Seems it was an issue with the "i" key. Changed it to a "b" and it all works now...bizarre.
03/23/2005 (5:25 pm)
Hah hah!My tile-map inventory is fully functional!
I can click on an object in the grid, move it with the mouse, click again and it moves itself.
My weak programmer skills are hugging themselves with great joy.
Got my key mapping issue resolved as well. Seems it was an issue with the "i" key. Changed it to a "b" and it all works now...bizarre.
#9
Lots of grunt work but then it all clicks into place (quite literally in your case) and then you get that warm fuzzy feeling watching over your creation.
Good Luck with your project. :)
- Melv.
03/24/2005 (3:28 am)
I know that feeling well!Lots of grunt work but then it all clicks into place (quite literally in your case) and then you get that warm fuzzy feeling watching over your creation.
Good Luck with your project. :)
- Melv.
Torque Owner Philip Mansfield
Default Studio Name