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

Mu0n micjuneau at gmail.com
Mon Feb 6 08:57:38 CET 2017


[This message has been edited.]

___Failing:___

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. 

___Success:___
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));

(although it only refreshes if I click on the map. I'm guessing I'm
missing some kind of refresh command)

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=53001#p53001


More information about the messages mailing list