Constuck 13 Share Posted December 29, 2016 Hey guys, I've been working on this all day and I can't find out how to do it. How can I iterate through all visible tiles to check which one my mouse is hovering over? I know: getMap().getPolygon(t.getTile()).contains(getMouse().getPosition()) will tell me if my mouse is hovering over TileReference t, and I know: getMap().isTileOnScreen(t.getTile()) will tell me if the tile is visible, but I need to figure out how to get every Tile/TileReference around the player. I've tried getMap().getTileGrid(getClient().getPlane())[x][y] for x's and y's near the player but it doesn't seem to work unless I put in x=0 y=0. Any ideas? Link to comment Share on other sites More sharing options...
DefCon 121 Share Posted December 29, 2016 try filling in the x and y with the Client class's getBaseX() and getBaseY() methods. Link to comment Share on other sites More sharing options...
slasso 27 Share Posted December 29, 2016 Try this. http://pastebin.com/cUfn2PQg Link to comment Share on other sites More sharing options...
Constuck 13 Author Share Posted December 29, 2016 Slasso's method worked. Thanks so much! Link to comment Share on other sites More sharing options...
slasso 27 Share Posted December 29, 2016 Streams are the best Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.