Java 类com.badlogic.gdx.math.Rectangle 实例源码

项目:guitar-finger-trainer    文件:LevelScreen.java   
LevelScreen(GftGame game) {
    this.game = game;

    this.guiCam = new OrthographicCamera(800, 480);
    this.guiCam.position.set(800 / 2, 480 / 2, 0);

    this.backBounds = new Rectangle(7, 432, 48, 48);
    this.autoMoveToNextBounds = new Rectangle(0, 0, 800, 62);

    this.levelBounds = new ArrayList<Rectangle>();
    int line = 0;
    int column = 0;
    for(int i = 0; i < LEVELS; i++) {
        this.levelBounds.add(i, new Rectangle(370 + 75 * column++, 240 - 70 * line, 57, 57));
        if(column == 5) {
            column = 0;
            line++;
        }
    }

    this.touchPoint = new Vector3();
}
项目:FlappySpinner    文件:GameButton.java   
public GameButton(float WIDTH, float HEIGHT, String drawable, boolean isCheckable) {
    audioManager = AudioManager.getInstance();
    skin = new Skin();
    skin.addRegions(AssetsManager.getTextureAtlas());

    Button.ButtonStyle buttonStyle = new Button.ButtonStyle();
    buttonStyle.up = skin.getDrawable(drawable);
    buttonStyle.down = skin.getDrawable(drawable + "_pressed");
    if (isCheckable) {
        buttonStyle.checked = skin.getDrawable(drawable + "_pressed");
    }
    setStyle(buttonStyle);
    setSize(WIDTH, HEIGHT);

    rectangle = new Rectangle(getX(),getY(),getWidth(),getHeight());
    addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            audioManager.playSound(audioManager.getButtonSound());
        }
    });
}
项目:cocos2d-java    文件:QuadTreeV2.java   
public void addObject(IQuadTreeObject obj) {
    tempObjects.add(obj);

    //update max aabb
    final Rectangle rect = obj.getRectangle();
    final float x0 = rect.x;
    final float y0 = rect.y;
    final float x1 = rect.x + rect.width;
    final float y1 = rect.y + rect.height;

    minX = minX > x0 ? x0 : minX;
    minY = minY > y0 ? y0 : minY;
    maxX = maxX < x1 ? x1 : maxX;
    maxY = maxY < y1 ? y1 : maxY;

    System.out.println("QuadTree : updateRootBounds [" + 
    minX +"," + minY + "," + maxX + "," + maxY + "]");
}
项目:guitar-finger-trainer    文件:TrainingScreen.java   
TrainingScreen(GftGame game) {
    this.game = game;

    this.guiCam = new OrthographicCamera(800, 480);
    this.guiCam.position.set(800 / 2, 480 / 2, 0);

    this.backBounds = new Rectangle(7, 432, 48, 48);
    this.playPauseBounds = new Rectangle(7, 7, 48, 48);
    this.restartBounds = new Rectangle(62, 7, 48, 48);
    this.backFowardtBounds = new Rectangle(127, 7, 48, 48);
    this.soundBounds = new Rectangle(192, 7, 48, 48);
    this.minusBounds = new Rectangle(590, 7, 48, 48);
    this.plusBounds = new Rectangle(699, 7, 48, 48);

    this.touchPoint = new Vector3();

    this.grid = new Grid(this.game);
    this.grid.loadTraining();

    this.bottomBar = new BottomBar(this.game);

    this.firstRun = 3;
    this.lastUpdateTime = TimeUtils.millis();
    this.bpm = MINUTE_IN_MILLIS / SettingsUtil.bpm;
}
项目:Klooni1010    文件:GameLayout.java   
void update(BaseScorer scorer) {
    float cupSize = Math.min(scoreHeight, scorer.cupTexture.getHeight());
    final Rectangle area = new Rectangle(
            marginWidth, pieceHolderHeight + boardHeight,
            availableWidth, scoreHeight);

    scorer.cupArea.set(
            area.x + area.width * 0.5f - cupSize * 0.5f, area.y,
            cupSize, cupSize);

    scorer.currentScoreLabel.setBounds(
            area.x, area.y,
            area.width * 0.5f - cupSize * 0.5f, area.height);

    scorer.highScoreLabel.setBounds(
            area.x + area.width * 0.5f + cupSize * 0.5f, area.y,
            area.width * 0.5f - cupSize * 0.5f, area.height);
}
项目:Mindustry    文件:Renderer.java   
public Renderer() {
    Core.cameraScale = baseCameraScale;
    Effects.setEffectProvider((name, color, x, y, rotation) -> {
        if(Settings.getBool("effects")){
            Rectangle view = Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight)
                    .setCenter(camera.position.x, camera.position.y);
            Rectangle pos = Tmp.r2.setSize(name.size).setCenter(x, y);
            if(view.overlaps(pos)){
                new EffectEntity(name, color, rotation).set(x, y).add();
            }
        }
    });

    clearColor = Hue.lightness(0.4f);
    clearColor.a = 1f;
}
项目:libgdx_ui_editor    文件:EditingZone.java   
@Override
public void draw (Batch batch, float parentAlpha) {
    Rectangle scissors = new Rectangle();
    Rectangle clipBounds = new Rectangle(getX(),getY(),getWidth(),getHeight());
    ScissorStack.calculateScissors(getStage().getCamera(), batch.getTransformMatrix(), clipBounds, scissors);
    ScissorStack.pushScissors(scissors);

    drawBg(batch, parentAlpha);

    batch.draw(texture,
            getX() + getWidth() / 2 - texture.getRegionWidth() / 2 + shift.x,
            getY() + getHeight() / 2 - texture.getRegionHeight() / 2 + shift.y,
            texture.getRegionWidth() / 2f,
            texture.getRegionHeight() / 2f,
            texture.getRegionWidth(), texture.getRegionHeight(),
            currZoom, currZoom, 0);

    drawSplits(batch, parentAlpha);

    batch.flush();
    ScissorStack.popScissors();
}
项目:Klooni1010    文件:PieceHolder.java   
public boolean pickPiece() {
    Vector2 mouse = new Vector2(
            Gdx.input.getX(),
            Gdx.graphics.getHeight() - Gdx.input.getY()); // Y axis is inverted

    final float perPieceWidth = area.width / count;
    for (int i = 0; i < count; ++i) {
        if (pieces[i] != null) {
            Rectangle maxPieceArea = new Rectangle(
                    area.x + i * perPieceWidth, area.y, perPieceWidth, area.height);

            if (maxPieceArea.contains(mouse)) {
                heldPiece = i;
                return true;
            }
        }
    }

    heldPiece = -1;
    return false;
}
项目:feup-lpoo-armadillo    文件:WaterModel.java   
/**
 * Water Model's constructor.
 * Creates a water model from the given object, into the given world.
 *
 * @param world The world the water model will be in.
 * @param rect  The rectangle to create the water model with.
 */
public WaterModel(World world, Rectangle rect) {
    // Body and Fixture variables
    BodyDef bdef = new BodyDef();
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();

    bdef.type = BodyDef.BodyType.StaticBody;
    bdef.position.set(PIXEL_TO_METER * (rect.getX() + rect.getWidth() / 2), PIXEL_TO_METER * (rect.getY() + rect.getHeight() / 2));

    this.body = world.createBody(bdef);

    shape.setAsBox((rect.getWidth() / 2) * PIXEL_TO_METER, (rect.getHeight() / 2) * PIXEL_TO_METER);
    fdef.shape = shape;
    fdef.filter.categoryBits = FLUID_BIT;
    fdef.isSensor = true;
    fdef.density = 1f;
    fdef.friction = 0.1f;
    fdef.restitution = 0f;
    body.createFixture(fdef);

    body.setUserData(new BuoyancyController(world, body.getFixtureList().first()));

}
项目:blueirisviewer    文件:Images.java   
public void resize(int w, int h)
{
    screenWidth.set(w);
    screenHeight.set(h);
    if (BlueIrisViewer.bivSettings != null)
    {
        double sqrt = Math.sqrt(numCams);
        cols = (int) Math.ceil(sqrt);
        rows = (int) sqrt;
        if (cols * rows < numCams)
            rows++;
        HandleOverrideGridSize();
        imageWidth = (float) w / cols;
        imageHeight = (float) h / rows;
        aImageWidth.set((int) Math.ceil(imageWidth));
        aImageHeight.set((int) Math.ceil(imageHeight));
    }
    blueIrisLayoutModelRect = new Rectangle(0, h, mainImageWidth, mainImageHeight);
    ScaleRectangleToFitScreenCentered(blueIrisLayoutModelRect);
    PrecalculateBlueIrisLayoutRectangles();
}
项目:GangsterSquirrel    文件:Box2DWorldCreator.java   
/**
 * Reads the enemy type and spawn position out of an enemy object on the map and then spawns it in the current level
 * @param object the map object that has been read in the map file
 * @param rectangle the rectangular shape of the object, contains position used for selecting the spawn position
 */
private void addEnemy(MapObject object, Rectangle rectangle) {

    MapProperties properties = object.getProperties();

    if (properties != null && properties.containsKey("enemy_type")) {
        String enemyType = properties.get("enemy_type", String.class);

        switch (enemyType) {
            case "Frog":
                playScreen.spawnEnemy(FrogEnemy.class, (int) (rectangle.getX() / MainGameClass.TILE_PIXEL_SIZE), (int) (rectangle.getY() / MainGameClass.TILE_PIXEL_SIZE));
                break;
            case "Monkey":
                playScreen.spawnEnemy(MonkeyEnemy.class, (int) (rectangle.getX() / MainGameClass.TILE_PIXEL_SIZE), (int) (rectangle.getY() / MainGameClass.TILE_PIXEL_SIZE));
                break;
            case "Boss":
                playScreen.spawnEnemy(BossEnemy.class, (int) (rectangle.getX() / MainGameClass.TILE_PIXEL_SIZE), (int) (rectangle.getY() / MainGameClass.TILE_PIXEL_SIZE));
                break;
            default:
                break;
        }
    }
}
项目:Klooni1010    文件:Band.java   
public Band(final Klooni game, final GameLayout layout, final BaseScorer scorer) {
    this.scorer = scorer;
    bandTexture = Theme.getBlankTexture();

    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font");

    scoreLabel = new Label("", labelStyle);
    scoreLabel.setAlignment(Align.center);
    infoLabel = new Label("pause menu", labelStyle);
    infoLabel.setAlignment(Align.center);

    scoreBounds = new Rectangle();
    infoBounds = new Rectangle();
    layout.update(this);
}
项目:GDX-Engine    文件:AnimatedSprite.java   
public void PlayAnimation(Animation animation, Rectangle newRegionOnTexture)
  {
if (animation == null && this.animation == null)
          throw new GdxRuntimeException("No animation is currently playing.");
      // If this animation is already running, do not restart it.
      if (this.animation == animation)
          return;

      // Start the new animation.
      this.animation = animation;
      this.frameIndex = 0;
      this.animationTimeline = 0.0f;

      this.setRegionX((int) newRegionOnTexture.x);
      this.setRegionY((int) newRegionOnTexture.y);
      this.setRegionWidth((int) newRegionOnTexture.getWidth());
      this.setRegionHeight((int) newRegionOnTexture.getHeight());
      onAnimationChanged();
  }
项目:summer17-android    文件:InteractiveTileObject.java   
public InteractiveTileObject(World world, TiledMap map, Rectangle bounds){
    this.world = world;
    this.map = map;
    this.bounds = bounds;

    BodyDef bdef = new BodyDef();
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();

    bdef.type = BodyDef.BodyType.StaticBody;
    bdef.position.set((bounds.getX() + bounds.getWidth() / 2) / NoObjectionGame.PPM, (bounds.getY() + bounds.getHeight() / 2 )/ NoObjectionGame.PPM);

    body = world.createBody(bdef);
    shape.setAsBox(bounds.getWidth() / 2 / NoObjectionGame.PPM, bounds.getHeight() / 2 / NoObjectionGame.PPM);
    fdef.shape = shape;
    fixture = body.createFixture(fdef);
}
项目:GDX-Engine    文件:GameService.java   
public GameService(SpriteBatch batch, IGameAsset asset,
    BaseGameSetting setting, OrthographicCamera camera,
    ISceneManager sceneManager) {
this.batch = batch;
this.asset = asset;
this.setting = setting;

if (asset == null)
    this.asset = new DefaultGameAsset();
if (setting == null)
    this.setting = new DefaultGameSetting();
this.camera = camera;
this.setChangeScene(sceneManager);
Rectangle.tmp.set(0, 0, getWindowSize().x, getWindowSize().y);

services = new IService[MAX_SERVICES];
   }
项目:miniventure    文件:MyUtils.java   
public static Rectangle moveRectInside(Rectangle toMove, Rectangle outer, float padding) {
    if(toMove.width >= outer.width)
        toMove.x = outer.x - (toMove.width - outer.width) / 2;
    else {
        if(toMove.x < outer.x)
            toMove.x = outer.x + padding;
        if(toMove.x + toMove.width > outer.x + outer.width)
            toMove.x = outer.x + outer.width - toMove.width - padding;
    }

    if(toMove.height >= outer.height)
        toMove.y = outer.y - (toMove.height - outer.height) / 2;
    else {
        if(toMove.y < outer.y)
            toMove.y = outer.y + padding;
        if(toMove.y + toMove.height > outer.y + outer.height)
            toMove.y = outer.y + outer.height - toMove.height - padding;
    }

    return toMove;
}
项目:GDX-Engine    文件:GameService.java   
@SuppressWarnings("incomplete-switch")
   @Override
   public void draw(Texture texture, Vector2 position, Vector2 origin,
    Vector2 size, float scale, float rotation, Rectangle source,
    Flip flip) {
boolean flipX = false;
boolean flipY = false;
switch (flip) {
case Both:
    flipX = true;
    flipY = true;
    break;
case Horizontal:
    flipX = true;
    break;
case Vertical:
    flipY = true;
}
batch.draw(texture, position.x, position.y, origin.x, origin.y, size.x,
    size.y, scale, scale, rotation, (int) source.getX(),
    (int) source.getY(), (int) source.getWidth(),
    (int) source.getHeight(), flipX, flipY);

   }
项目:KyperBox    文件:QuadTree.java   
/**
 * create a quadtree collision manager with a default max_depth of 4 and a
 * max_object count of 10.
 * 
 * @param x
 * @param y
 * @param width
 * @param height
 */
public QuadTree(float x, float y, float width, float height) {
    check_object = new BasicGameObject();
    check_object.init(null);
    remove_objects = new IntArray();
    culling = true;
    follow_x  =0;
    follow_y  =0;
    bounds = new Rectangle(x - PAD, y - PAD, width + PAD * 2, height + PAD * 2);
    objects =  new Array<GameObject>();
    follow_view = false;
    final QuadTree m = this;
    quad_pool = new Pool<QuadTree.Quad>() {
        @Override
        protected Quad newObject() {
            return new Quad(m);
        }
    };
    max_depth = 4;
    max_objects = 10;
    root = quad_pool.obtain();
    root.init(null, 0, bounds.x, bounds.y, bounds.width, bounds.height);
    ret_list = new Array<GameObject>();
}
项目:MMORPG_Prototype    文件:PixelCollisionMapTests.java   
private void whenObjectsAreNearEachOtherSHouldBeAbleToBeYShiftedProperely(int shiftY)
{
    int width = 8;
    int height = 8;
    ShiftableCollisionMap<PixelCollisionMapTestObject> collisionMap = new PixelCollisionMap<>(width, height);
    Rectangle firstObjectStartBounds = new Rectangle(2, 2, 2, 2);
    Rectangle secondObjectStartBounds = new Rectangle(2, 4, 2, 2);
    PixelCollisionMapTestObject firstObject = new PixelCollisionMapTestObject(firstObjectStartBounds);
    PixelCollisionMapTestObject secondObject = new PixelCollisionMapTestObject(secondObjectStartBounds);
    collisionMap.insert(firstObject);
    collisionMap.insert(secondObject);
    int shiftX = 0;
    collisionMap.update(shiftX, shiftY);
    assertThereIsPlacedObject(collisionMap, firstObjectStartBounds, firstObject);
    assertThereIsPlacedObject(collisionMap, secondObjectStartBounds, secondObject);
    assertNullAroundObject(collisionMap, new Rectangle(2, 2, 2, 4));
}
项目:miniventure    文件:Player.java   
@NotNull
private Array<WorldObject> getInteractionQueue() {
    Array<WorldObject> objects = new Array<>();

    // get level, and don't interact if level is not found
    Level level = Level.getEntityLevel(this);
    if(level == null) return objects;

    Rectangle interactionBounds = getInteractionRect();

    objects.addAll(level.getOverlappingEntities(interactionBounds, this));

    Tile tile = level.getClosestTile(interactionBounds);
    if(tile != null)
        objects.add(tile);

    return objects;
}
项目:cocos2d-java    文件:QuadTreeV2.java   
public boolean insert(IQuadTreeObject obj, int currDepth) {
    Rectangle rect = obj.getRectangle();
    switch(type) {
    case 0:
        if(rect.x > x0 && rect.y > y0) {
            objs.add(obj);
            return true;
        }
        break;
    case 1:
        if(rect.x + rect.width < x1 && rect.y > y0) {
            objs.add(obj);
            return true;
        }
        break;
    case 2:
        if(rect.x + rect.width < x1 && rect.y + rect.height < y1) {
            objs.add(obj);
            return true;
        }
        break;
    case 3:
        if(rect.x > x0 && rect.y + rect.height < y1) {
            objs.add(obj);
            return true;
        }
        break;
    }
    return false;
}
项目:summer17-android    文件:Sheep.java   
public Sheep(int x, int y) {
    super(x, y);
    sheep = new Texture("sheeprunning.png");
    sheepDead = new Texture("sheepsquish.png");
    sheepAnimation = new Animation(new TextureRegion(sheep), 4, 0.5f);
    sheep2Animation = new Animation(new TextureRegion(sheepDead), 15, 0.5f);
    bounds1 = new Rectangle(x, y, 70, 45);
    jump = Gdx.audio.newSound(Gdx.files.internal("jump_07.mp3"));
}
项目:MMORPG_Prototype    文件:PixelCollisionMapTests.java   
private void shiftTest(final int shiftX, final int shiftY)
{
    int width = 10;
    int height = 10;
    ShiftableCollisionMap<PixelCollisionMapTestObject> collisionMap = new PixelCollisionMap<>(width, height);
    Rectangle startBounds = new Rectangle(5, 5, 2, 2);
    PixelCollisionMapTestObject object = new PixelCollisionMapTestObject(new Rectangle(startBounds));
    collisionMap.insert(object);
    collisionMap.update(shiftX, shiftY);
    assertNullAroundObject(collisionMap, startBounds);
    assertThereIsPlacedObject(collisionMap, startBounds, object);
}
项目:cocos2d-java    文件:QuadTree.java   
public QuadTreeNode(QuadTree tree, int type, float x0, float y0, float x1, float y1) {
    this.tree = tree;

    this.x0 = x0;
    this.y0 = y0;
    this.x1 = x1;
    this.y1 = y1;
    _rect = new Rectangle(x0, y0, x1 - x0, y1 - y0);
    this.type = type;
    centerX = (x0 + x1) / 2;
    centerY = (y0 + y1) / 2; 
}
项目:cocos2d-java    文件:QuadTree.java   
public void slowQuery(Rectangle rect, final Array<IQuadTreeObject> ret) {
    for(int i = 0, n = tempObjects.size; i < n; ++i) {
        final IQuadTreeObject o = tempObjects.get(i);
        if(rect.overlaps(o.getRectangle())) {
            ret.add(o);
        }
    }
}
项目:GangsterSquirrel    文件:DeathTile.java   
public DeathTile(PlayScreen screen, Rectangle bounds) {
    super(screen, bounds, true);
    this.playScreen = screen;

    fixture.setUserData(this);
    createFilterMask();
}
项目:cocos2d-java    文件:Camera.java   
/**
     * Is this aabb visible in frustum
     */
    public boolean isVisibleInFrustum(Rectangle aabb) {
        if(_frustumDirty) {
//          _frustum.
            _frustumDirty = false;
        }
        return true;
    }
项目:school-game    文件:PhysicsTileMapBuilder.java   
/**
 * Erzeugt aus einem RectangleMapObject ein rechteckiges PolygonShape.
 *
 * Rotationen werden NICHT unterstützt.
 *
 * @param rectObject das MapObject
 * @return die entsprechende Form
 */
public static PolygonShape createRectangle(RectangleMapObject rectObject)
{
    Rectangle rectangle = rectObject.getRectangle();

    Vector2 center = new Vector2(rectangle.x + rectangle.width * 0.5f, rectangle.y + rectangle.height * 0.5f);

    return Physics.createRectangle(rectangle.width, rectangle.height, center);
}
项目:libgdx_ui_editor    文件:SelectGroup.java   
public SelectGroup(){
    cubRect = new Rectangle();
    childRect = new Rectangle();
    setCullingArea(cubRect);
    cubDra = DrawableUtil.getRectLineDrawable("icon/select.9.png");
    selection = new Selection<Actor>();
    addListener(dragListener);
}
项目:GangsterSquirrel    文件:Jumpable.java   
public Jumpable(PlayScreen screen, Rectangle bounds) {
    super(screen, bounds, true);
    playScreen = screen;

    fixture.setUserData(this);
    createFilterMask();
}
项目:blueirisviewer    文件:Images.java   
private void PrecalculateBlueIrisLayoutRectangles()
{
    for (int i = 0; i < blueIrisRectsProportional.size(); i++)
    {
        Rectangle propRect = blueIrisRectsProportional.get(i);
        float x = (propRect.x * blueIrisLayoutModelRect.width) + blueIrisLayoutModelRect.x;
        float y = (propRect.y * blueIrisLayoutModelRect.height) + blueIrisLayoutModelRect.y;
        Rectangle preCalcRect = new Rectangle(x, y, propRect.width * blueIrisLayoutModelRect.width, propRect.height
                * blueIrisLayoutModelRect.height);
        blueIrisRectsPrecalc.set(i, preCalcRect);
    }
}
项目:miniventure    文件:Level.java   
public Array<Tile> getOverlappingTiles(Rectangle entityRect) {
    int tileMinX = (int) entityRect.x / Tile.SIZE;
    int tileMaxX = (int) (entityRect.x + entityRect.width) / Tile.SIZE;
    int tileMinY = (int) entityRect.y / Tile.SIZE;
    int tileMaxY = (int) (entityRect.y + entityRect.height) / Tile.SIZE;

    Array<Tile> overlappingTiles = new Array<>();
    for(int x = Math.max(0, tileMinX); x <= Math.min(width-1, tileMaxX); x++)
        for(int y = Math.max(0, tileMinY); y <= Math.min(height-1, tileMaxY); y++)
            overlappingTiles.add(tiles[x][y]);

    return overlappingTiles;
}
项目:FlappyChapa    文件:Tube.java   
public boolean collides(Rectangle bird){

        if(bird.overlaps(boundsTop) || bird.overlaps(boundsBot)){
            return true;
        }

        return false;
    }
项目:FlappyChapa    文件:Anto.java   
public boolean collides(Rectangle bird){

        if(bird.overlaps(boundsTop)){
            return true;
        }

        return false;
    }
项目:Klooni1010    文件:PieceHolder.java   
private void updatePiecesStartLocation() {
    float perPieceWidth = area.width / count;
    Piece piece;
    for (int i = 0; i < count; ++i) {
        piece = pieces[i];
        if (piece == null)
            continue;

        // Set the absolute position on screen and the cells' cellSize
        // Also clamp the cell size to be the picked size as maximum, or
        // it would be too big in some cases.
        piece.pos.set(area.x + i * perPieceWidth, area.y);
        piece.cellSize = Math.min(Math.min(
                perPieceWidth / piece.cellCols,
                area.height / piece.cellRows), pickedCellSize);

        // Center the piece on the X and Y axes. For this we see how
        // much up we can go, this is, (area.height - piece.height) / 2
        Rectangle rectangle = piece.getRectangle();
        piece.pos.y += (area.height - rectangle.height) * 0.5f;
        piece.pos.x += (perPieceWidth - rectangle.width) * 0.5f;

        originalPositions[i] = new Rectangle(
                piece.pos.x, piece.pos.y,
                piece.cellSize, piece.cellSize);

        // Now that we have the original positions, reset the size so it animates and grows
        piece.cellSize = 0f;
    }
}
项目:project-divine-intervention    文件:Player.java   
public Player(EntityManager ent, float x, float y, CharacterSheet c, int playerNum){
    super(ent, null, x,y);
    this.playerNum = playerNum;
    target = new Vector2();
    anim = new Animation(c);
    size = new Vector2(c.idle[0].getRegionWidth(), c.idle[0].getRegionHeight());
    body = new Rectangle(x, y, size.x, size.y);
    dir = 1f;
}
项目:conquest    文件:Grabber.java   
public Grabber(Array<Tile> tiles, ConquestCamera cam, Manager manager, Pathway pathway, Player player) {
    this.tiles = tiles;
    rect = new Rectangle();
    this.cam = cam;

    this.manager = manager;
    this.pathway = pathway;
    this.player = player;

    mode = Mode.FIRST;
}
项目:summer17-android    文件:Pig.java   
public Pig(int x, int y) {
    super(x, y);
    pig = new Texture("PigRun.png");
    pigDead = new Texture("PigDead.png");
    pigAnimation = new Animation(new TextureRegion(pig),4,0.5f);
    pig1Animation = new Animation(new TextureRegion(pigDead),27,0.5f);
    pigBounds = new Rectangle(x,y,70,45);
}
项目:Flappy-Baranus    文件:Tube.java   
public Tube(float x){
    topTube = new Texture("toptube.png");
    bottomTube = new Texture("bottomtube.png");
    rand = new Random();

    posTopTube = new Vector2(x, rand.nextInt(FLUCTUATION) + TUBE_GAP + LOWEST_OPENING);
    posBotTube = new Vector2(x, posTopTube.y - TUBE_GAP - bottomTube.getHeight());

    boundsTop = new Rectangle(posTopTube.x, posTopTube.y, topTube.getWidth(), topTube.getHeight());
    boundsBot = new Rectangle(posBotTube.x, posBotTube.y, bottomTube.getWidth(), bottomTube.getHeight());

}
项目:GDX-Engine    文件:DefaultGameAsset.java   
@Override
public TextureRegion loadTextureRegion(String textureFile, Rectangle rec)
{
    Texture texture = loadTexture(textureFile, Format.RGBA4444, true);
    TextureRegion tr = new TextureRegion(texture, (int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height);
    //flip for system of y-axis down
    if(Game.isYdown())
        tr.flip(false, true);
    return tr;
}