Android Open Source - Sneik Node






From Project

Back to project page Sneik.

License

The source code is released under:

Apache License

If you think the Android project Sneik listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.plastboks.gameobjects;
/*from w  w  w .  ja v  a  2  s  .c  om*/
import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Vector2;
import net.plastboks.screens.GameScreen;
import net.plastboks.shared.Directions;

/**
 * Created by alex on 12/17/14.
 */

public class Node {
    public Vector2 v;
    public Directions dir;
    private Circle boundingCircle;
    private float circleRadius = 3.5f;

    public Node(Vector2 v, Directions d) {
        this.v = v;
        this.dir = d;
        boundingCircle = new Circle();
        boundingCircle.set(v.x, v.y, circleRadius);
    }

    /* x, y getter and setters */
    public float getX() { return v.x; }
    public float getY() { return v.y; }
    public void setX(float x) {
        v.x = x;
        if (v.x > GameScreen.GAME_WIDTH) { v.x = 0; }
        if (v.x < 0) { v.x = GameScreen.GAME_WIDTH; }
        boundingCircle.set(v.x, v.y, circleRadius);
    }
    public void setY(float y) {
        v.y = y;
        if (v.y > GameScreen.GAME_HEIGHT) { v.y = 0; }
        if (v.y < 0) { v.y = GameScreen.GAME_HEIGHT; }
        boundingCircle.set(v.x, v.y, circleRadius);
    }

    /* Direction getter and setter */
    public Directions getDir() { return dir; }
    public void setDir(Directions d) { dir = d; }

    public Circle getBoundingCircle() { return boundingCircle; }
}




Java Source Code List

net.plastboks.gameobjects.Artificial.java
net.plastboks.gameobjects.Autonomous.java
net.plastboks.gameobjects.Bird.java
net.plastboks.gameobjects.Creature.java
net.plastboks.gameobjects.Mouse.java
net.plastboks.gameobjects.Node.java
net.plastboks.gameobjects.Snake.java
net.plastboks.gameworld.GamePlay.java
net.plastboks.gameworld.GameRenderer.java
net.plastboks.gameworld.GameWorld.java
net.plastboks.screens.GameScreen.java
net.plastboks.shared.Directions.java
net.plastboks.sneik.IOSLauncher.java
net.plastboks.sneik.SneikGame.java
net.plastboks.sneik.android.AndroidLauncher.java
net.plastboks.sneik.client.HtmlLauncher.java
net.plastboks.sneik.desktop.DesktopLauncher.java
net.plastboks.sneikhelpers.AssetLoader.java
net.plastboks.sneikhelpers.InputHandler.java