[LibGDX] Connect the dots?

Hey, I started application development about three days ago and I’ve already completed my first application. I feel like I’ve gathered a great deal of information while creating the application and want to further my knowledge.

So, what have I done? I created a game-plan.
However; the problem is… (Similar to before) I don’t have the slightest clue where to begin.

Apparently my google skills have decreased, because I’ve gone from finding retarded amounts of information to slowly not being able to find anything, until I’ve gotten to this point where I can’t find a single link.

Basically I’m trying to find a basic application for “Connecting the dots” in android. Something similar to a lock-screen so I can connect them in a pattern. I have a few general concept ideas about how to do this, but I’m not sure. So I’ll go ahead and post my idea here and let you guys tell me if I’m wrong.

I’ll draw the “dots” in a grid, and this grid will have it’s respective points, for example


[ [0,0] [0,1] [0,2]
  [1,0] [1,1] [1,2]
  [2,0] [2,1] [2,2] ]

Each grid will have it’s own properties, such as “inUse”(boolean) for if it’s been selected or not, and if you go from grid[0,0] to grid[0,1] it will add those to an ArrayList (Making up names here, because I’m clueless, just tossing ideas) in which I can then after I’m done drawing/storing the pattern, display it by looping through the ArrayList from index(0) to index(list.size())… Am I somewhere in the ballpark?

Hey.

How about you make a property called nextNode(Dot dot) or something for every dot. nextNode() will return the dot that has been connected to this dot. You can then easily make a property called getNextNode() and retrieve the dot that is connected to your current dot. Then you can use the x/y coords from the two dots to draw stuff (or whatever you need to do with this information).

It’ll look something like this:


public class Dot {
    public Dot(int x, int y) {
        this.x = x;
        this.y = y;
    }

    private int x, y;
    private boolean inUse;

    private Dot nextNode;

    public void nextNode(Dot nextNode) {
        if (inUse) return;
        this.nextNode = nextNode;
        inUse = true;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public boolean isInUse() {
        return inUse;
    }

    public Dot getNextNode() {
        return nextNode;
    }
}

Thanks, now I just have to figure out the actual connecting behind it! I’ve found two examples that are on the badlogicgames website, but…
It’s been down for me almost two days now.

What you just described is a linkedlist, if you don’t know :wink:

Thanks! I’ll start doing some research on that now.