New answers tagged

0

So if I understood, you want to get the cell that is clicked so you can color it. private void fillTouchedCell() { if (Gdx.input.isTouched()) { Cell c = getCellAtTouch(); if (c != null) { //cell clicked, we cant fill it with color c.fill(Color.RED); } } } private Cell getCellAtTouch() { unpojectedTouch.set(Gdx.input.getX(), ...


0

Ok this is how i would do it. public void handleInput () { mouse_x = Gdx.input.getX(); mouse_y = Gdx.input.getY(); rou_mouse = new Vector2(mouse_x/cellWidth, mouse_y/cellHeight); set_px (rou_mouse, new Element_stone()); } The new vector2 arguments should give what cell number ...


3

Well, finding 3+ is easy if you realize that regardless of their respective positions to each other, at least one of them will always have at least two neighbors. Once you've found a location in the grid that is part of a triplet, use a floodfill algorithm to locate the entire cluster. You won't be able to assign this to a "dedicated variable" but you can ...



Top 50 recent answers are included