Create account / Log in

Non-stacking piece always on top?

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Non-stacking piece always on top?

Postby Juuso » June 28th, 2011, 1:58 pm

Hi,

Is there any way to make a non-stacking piece to be shown always on top even if a larger piece underneath it is selected?

Or other way round, is there some solution to make a stacking piece which ignores map grid when moving?

Thanks beforehand,

- Juuso
Juuso
 
Posts: 30
Joined: January 21st, 2010, 3:33 pm

Re: [messages] [Module Design] Non-stacking piece always on

Postby Tim M » June 28th, 2011, 2:59 pm

use game piece layers and assign the non stacking piece to the top most game
piece layer




________________________________
From: Juuso
To: messages@vassalengine.org
Sent: Tue, June 28, 2011 8:58:06 AM
Subject: [messages] [Module Design] Non-stacking piece always on top?

Hi,

Is there any way to make a non-stacking piece to be shown always on top
even if a larger piece underneath it is selected?

Or other way round, is there some solution to make a stacking piece
which ignores map grid when moving?

Thanks beforehand,

- Juuso

_______________________________________________
Read this topic online here:
viewtopic.php?p=23557#p23557
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1812
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: Non-stacking piece always on top?

Postby Juuso » June 30th, 2011, 5:42 am

Could you please clarify how this is done? I am not an experienced user of Vassal and can't find out how you can assing non-stacking piece to layer (I have only used layer-traits this far and added only pictures as layers). Thank you in advance.
Juuso
 
Posts: 30
Joined: January 21st, 2010, 3:33 pm

Re: Non-stacking piece always on top?

Postby Juuso » June 30th, 2011, 6:24 am

Also another related question.

Can it be done so that a piece stacks (and follows grid) on one map window and does ignore grid and stacking on other?
Juuso
 
Posts: 30
Joined: January 21st, 2010, 3:33 pm

Re: Non-stacking piece always on top?

Postby shilinski » June 30th, 2011, 7:05 pm

First off, there is a confusing part we need to get out of the way. Pieces have a Layer trait. Maps also have a Layer trait, which is a completely different concept, and if you don't know any better, you can confuse the two. We are going to talk about Map Layers here and not Piece Layers. We create map layers and assign pieces to those layers to have them rendered properly above and below each other.

Edit a module, click on your Main Map entry, and choose "add game piece layers." (Again this has nothing to do with the Layer piece trait.) The default property name for a layer is "Layer." You could change this to anything, for example "mainMapLayer", but let's leave it as "Layer." Now add some layer names. Suppose we create 3 layers, top, middle, bottom. They should appear in reverse order in the display. From top to bottom, we want them to read "bottom", "middle", and "top".

Now we need to assign ALL pieces that could appear on the main map to one of these layers, even the stacking ones. To do this, edit a piece (preferably a piece prototype) and add a Marker trait. (No, not the Layer trait!) Suppose it is something we want on the bottom, so in the marker we set property name to "Layer" and the value to "bottom". The property name is important. If we had used "mainMapLayer" to define the map layers, the property name must then be "mainMapLayer". You must do this for all your pieces, assigning them to top, middle, or bottom, even the stackers. Miss one and you will get unpredictable results. In general, I'd assign almost everything to middle, the stuff that must be on the bottom to bottom, and the markers that should be on top of everything to top.

Now when rendered on the screen, the top pieces will always appear above the middle pieces, which will appear above the bottom pieces. This is a bread and butter feature in Vassal. I believe I have used it in all the dozens of modules I have made.

One last thing. If you right-click the Game Piece Layers item you created in your main map, you should notice that you can also create a layers control. This gives you some options on managing your layers. One thing I often do here is to create a button that temporarily hides all the pieces on the map except for terrain pieces in the bottom layer. It's really helpful to see what is underneath the pieces.
shilinski
 
Posts: 169
Joined: December 22nd, 2007, 8:46 am
Location: Laurel, Maryland

Re: Non-stacking piece always on top?

Postby Juuso » June 30th, 2011, 9:36 pm

Big thanks, this will surely help. Thank you for explaining this thoroughly.
Juuso
 
Posts: 30
Joined: January 21st, 2010, 3:33 pm

Re: Non-stacking piece always on top?

Postby Juuso » July 1st, 2011, 7:42 am

Ok, made the modifications and this helped. Also solved a couple of my other problems related to stacking that I did not had time yet to ask. Thank you thousand times!
Juuso
 
Posts: 30
Joined: January 21st, 2010, 3:33 pm

Re: Non-stacking piece always on top?

Postby ijthompson » July 1st, 2011, 3:23 pm

I agree, that was very helpful. Thank you, shellinski. :)
User avatar
ijthompson
 
Posts: 66
Joined: April 23rd, 2011, 10:33 pm
Location: Toronto, Canada


Return to Module Design

Who is online

Users browsing this forum: Cundiff and 5 guests