Example usage for com.badlogic.gdx.math Circle Circle

List of usage examples for com.badlogic.gdx.math Circle Circle

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Circle Circle.

Prototype

public Circle() 

Source Link

Document

Constructs a new circle with all values set to zero

Usage

From source file:com.andgate.pokeadot.GameScreen.java

License:Open Source License

private Pokable generateRandomPokable() {
    Circle newCircle = new Circle();
    newCircle.radius = MathUtils.random(Constants.MINIMUM_CIRCLE_RADIUS, Constants.MAXIMUM_CIRCLE_RADIUS);
    newCircle.x = MathUtils.random(0.0f + newCircle.radius, game.worldWidth - newCircle.radius);
    newCircle.y = MathUtils.random(Constants.BUTTON_LENGTH + newCircle.radius,
            game.worldHeight - newCircle.radius);

    /*Color newColor = new Color();
    newColor.r = MathUtils.random(0.5f, 1.0f);
    newColor.g = MathUtils.random(0.5f, 1.0f);
    newColor.b = MathUtils.random(0.5f, 1.0f);
    newColor.a = 1.0f;*///from   w w w. ja v a 2  s  .c  om

    HSL newHSL = new HSL();
    newHSL.h = MathUtils.random(0.0f, 1.0f);
    newHSL.s = 0.7f;
    newHSL.l = 0.7f;

    Color newColor = newHSL.toRGB();

    float newLifeSpan = MathUtils.random(Constants.MINIMUM_LIFE_TIME, Constants.MAXIMUM_LIFE_TIME);

    return new Pokable(game, newCircle, newColor, newLifeSpan);
}

From source file:com.belocraft.gameobjects.Bird.java

public Bird(float x, float y, int width, int height) {
    this.width = width;
    this.height = height;
    position = new Vector2(x, y);
    velocity = new Vector2(0, 0);
    acceleration = new Vector2(0, 460);
    boundingCircle = new Circle();
    this.originalY = y;
    isAlive = true;/*from   www .  j  a v a  2s  .co  m*/
}

From source file:com.mygdx.game.objects.Entity.java

public Entity(float x, float y, int width, int height) {
    position = new Vector2(x, y);
    velocity = new Vector2(0, 0);
    cl = new Circle();
    setWidth(width);/*from   ww w .  j  av a2 s .co  m*/
    setHeight(height);
    addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int we) {
            action();
            Gdx.app.log("Unit", "Work");
            return true;
        }
    });
}

From source file:com.o2d.pkayjava.editor.plugins.ninepatch.EditingZone.java

License:Apache License

public int splitCollision(float x, float y) {
    Circle touchCircle = new Circle();
    touchCircle.radius = 5f;//from www.ja v  a 2 s  .  co  m
    touchCircle.setPosition(x, y);

    if (touchCircle.contains(splitPositions[0], touchCircle.y)) {
        return 0;
    }
    if (touchCircle.contains(splitPositions[1], touchCircle.y)) {
        return 1;
    }
    if (touchCircle.contains(touchCircle.x, splitPositions[2])) {
        return 2;
    }
    if (touchCircle.contains(touchCircle.x, splitPositions[3])) {
        return 3;
    }

    return -1;
}

From source file:com.turbogerm.helljump.game.items.CoinItem.java

License:Open Source License

public CoinItem(ItemData itemData, int startStep, AssetManager assetManager) {
    super(itemData, getImageName(itemData), startStep, assetManager);

    mCoinScore = getCoinScore(itemData);

    mCollisionCircle = new Circle();

    setPickedUpText(String.format("+%d PTS", mCoinScore));

    updatePositionImpl();/*from  w w  w.ja  v  a  2s  .  c  o m*/
}

From source file:com.turbogerm.helljump.game.items.ShieldItem.java

License:Open Source License

public ShieldItem(ItemData itemData, int startStep, AssetManager assetManager) {
    super(itemData, ResourceNames.ITEM_SHIELD_IMAGE_NAME, startStep, assetManager);

    mCollisionCircle = new Circle();

    setPickedUpText("SHIELD");

    updatePositionImpl();// www  . j av  a 2s.  c o m
}

From source file:com.turbogerm.helljump.game.items.SignetItem.java

License:Open Source License

public SignetItem(ItemData itemData, int startStep, AssetManager assetManager) {
    super(itemData, ResourceNames.ITEM_SIGNET_IMAGE_NAME, startStep, assetManager);

    mCollisionCircle = new Circle();

    setPickedUpText("");

    updatePositionImpl();/*from w w w .  ja  va 2  s .c o  m*/
}

From source file:com.zippynk.tritone.TritoneApp.java

License:Mozilla Public License

@Override
public void create() {
    batch = new SpriteBatch();
    playIMG = new Texture("Play.png");
    playIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    pauseIMG = new Texture("Pause.png");
    pauseIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    progressBackgroundIMG = new Texture("ProgressBackground.png");
    progressBackgroundIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    progressForegroundIMG = new Texture("ProrgressForeground.png");
    progressForegroundIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    rewindIMG = new Texture("Rewind.png");
    rewindIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    fastForwardIMG = new Texture("FastForward.png");
    fastForwardIMG.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    defaultArt = new Texture("DefaultAlbumCover.png");
    defaultArt.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    //camera = new OrthographicCamera();
    //viewport = new FitViewport(640, 480, camera);
    clickListener = new ClickListener();
    currentXScaleFactor = (float) Gdx.graphics.getWidth() / 640;
    currentYScaleFactor = (float) Gdx.graphics.getHeight() / 480;
    if (currentXScaleFactor > currentYScaleFactor) {
        currentSmallerScaleFactor = currentYScaleFactor;
    } else {//from  w  w w  .  j  a va2  s .c om
        currentSmallerScaleFactor = currentXScaleFactor;
    }
    playPauseButton = new Circle();
    playPauseButton.set(320 * currentXScaleFactor, 100 * currentYScaleFactor, 50 * currentSmallerScaleFactor);
    rewindButton = new Circle();
    rewindButton.set(170 * currentXScaleFactor, 100 * currentYScaleFactor, 50 * currentSmallerScaleFactor);
    fastForwardButton = new Circle();
    fastForwardButton.set(470 * currentXScaleFactor, 100 * currentYScaleFactor, 50 * currentSmallerScaleFactor);
    songs.add(new Song("Korobeiniki.mp3", 56));
    songs.add(new Song("In the Hall of the Mountain King.mp3", 154));
    songs.add(new Song("The Liberty Bell.mp3", 221));
    songs.add(new Song("Washington Post March.mp3", 130));
    songs.add(new Song("Winter.mp3", 197));
    songs.add(new Song("Arirang.ogg", 88));
    songs.add(new Song("Promenade.ogg", 100));
    songs.add(new Song("Vltava.ogg", 770));

    currentSongIndex = 0;
    Gdx.input.setInputProcessor(this);
    fillQueue();
}

From source file:de.voodoosoft.gameroots.client.gdx.view.input.VirtualJoystick.java

License:Apache License

/**
 * Creates a new <code>VirtualJoystick</code> for the specified input source.
 * /*w ww.java2 s  .com*/
 * @param input input source
 */
public VirtualJoystick(Input input) {
    this.input = input;

    knobDirection = new Vector2();
    tmpCheckVector = new Vector2();
    joystickCircle = new Circle();
    epsilon = 0.0001f;
    yDown = true;
}

From source file:net.dermetfan.same.components.shapes.CircleComponent.java

License:Apache License

public CircleComponent() {
    this(new Circle());
}