[messages] [Module Design] Custom java class that deals with GamePieces

Mu0n micjuneau at gmail.com
Mon Feb 6 08:54:48 CET 2017


Using the protected PieceSlot.getExpandedPiece() method, even with an
empty derived class (I get null pointers unfortunately in my vassal
crash report). 

I made my own PieceSlotHack class that extends PieceSlot. It's pretty
much empty (not 100% that this is ok, do I have to implement stuff in
it?). I made sure it used the same package (VASSAL.build.widget) as
PieceSlot and was put in its properly named folder in my IDE. No
compilation errors. I used your piece of code for findSlot, but using my
PieceSlotHack instead of the default one. 

Access a piece already manually placed on the map with and move it
around to a new fixed position:

GamePiece pieces[] = Map.activeMap.getPieces();
pieces[0].setPosition(new Point(300,100));

Read this topic online here:

More information about the messages mailing list