Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (798)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (865)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [LibGDX] Connect the dots?  (Read 2857 times)
0 Members and 1 Guest are viewing this topic.
Offline CTucker1327
« Posted 2014-05-23 12:10:07 »

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

1  
2  
3  
[ [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<GridCell> (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?
Offline hwinwuzhere
« Reply #1 - Posted 2014-05-23 15:38:15 »

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:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
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;
    }
}

There are two kinds of people in this world: Those who can extrapolate from incomplete data,
Offline CTucker1327
« Reply #2 - Posted 2014-05-23 17:40:20 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Opiop
« Reply #3 - Posted 2014-05-23 18:20:42 »

What you just described is a linkedlist, if you don't know Wink
Offline CTucker1327
« Reply #4 - Posted 2014-05-23 19:18:45 »

Thanks! I'll start doing some research on that now.
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (45 views)
2019-09-04 15:33:17

hadezbladez (4025 views)
2018-11-16 13:46:03

hadezbladez (1468 views)
2018-11-16 13:41:33

hadezbladez (4048 views)
2018-11-16 13:35:35

hadezbladez (780 views)
2018-11-16 13:32:03

EgonOlsen (4098 views)
2018-06-10 19:43:48

EgonOlsen (4685 views)
2018-06-10 19:43:44

EgonOlsen (2762 views)
2018-06-10 19:43:20

DesertCoockie (3657 views)
2018-05-13 18:23:11

nelsongames (3867 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!