Anyone can give me an idea to make signer effect when i click/hit/select an object. Like common RTS or RPG game. If we select an object, it will appear signer on it such as rectangle effect or cyrcle with certain color. Later I think it is made from rectagle or cyrcle but i don't see any method to make an rectagle or cyrcle in jme. May be i just haven't found it. Any one can give me what the solution to make it? :?
Check out this post in the StrategicHandler thread. I have not tested the code, but the example is there.
http://www.jmonkeyengine.com/jmeforum/index.php?topic=5365.msg45476#msg45476
hmm it's sound nice. But when i try to implement the example from link above there are error.
if ( MouseInput.get().isButtonDown(0) ) {
mouseScreenPos = new Vector2f();
mouseScreenPos.set(strategicHandler.getMouseManager().getMouse().getHotSpotPosition().x, [b]strategicHandler.getMouseManager().getMouse().getHotSpotPosition().y);[/b]
if (!dragLeft) {
mouseFirstDownPos = mouseScreenPos;
dragLeft = true;
}else{
if(mouseFirstDownPos!=null){
updateSelectionSquare();
}
}
} else {
if([b]dragLeft[/b]){
dragLeft = false;
clearSelectionSquare();
//here you find the Spatials inside the square
findSpatialInTheSquare(mouseFirstDownPos, mouseScreenPos);
mouseFirstDownPos = null;
for(Boneco boneco : [b]player.getBonecosSelecionados()[/b]){
boneco.colocaProjecaoSelecao();
}
}
}
The errors are codes which bold.
- there are not fuction or procedure getMouseManager().getMouse().getHotSpotPosition().y strategicHandler. i try to download StrategicHandler and so does it.
- i still confuse with variable dragleft here.i think it flag to check if mouse drag or not. But i also have trouble to check if mouse dragged or not
- I don't know what player here is represent.Is it represent player with type Object?Or the other?Because i have player Node [li]
Sorry, cannot help you much with this… just hoped to point you in the right direction… However I think I was misleading you instead
On second look, I think the code is for selecting multiple units with a selection box, not actually for placing a marker under a unit… sorry about that. However since you want to select multiple units probably also, it might still prove useful :roll:
Concerning the points your brought out - StrategicHandler is not part of jME core so, yes, you have to download it. However the strategicHandler does not include the MouseManager either - it is a separate download on the same googleCode project site as StrategicHandler: http://code.google.com/p/jmeaddons/
I do not think that StrategicHandler is very important in the line where it is called - it is just populating a Vector2f - I assume you could just assign your world coordinates there to achieve the same result. Just get the coordinates from your own mouse, do not go through the StrategicHandler.