LibGdx, Texture an Object

Posted by Gigi10012 on Game Development See other posts from Game Development or by Gigi10012
Published on 2014-06-06T15:42:46Z Indexed on 2014/06/06 15:43 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

I want to set texture to an Object, this is my playerobject class:

private boolean up;

private float speed;
private float fallacceleration = 20;
private float acceleration = 15;
private float maxSpeed = 300;
SpriteBatch batch;

public Player()
{
    x = MyGdxGame.WIDTH - 9*MyGdxGame.WIDTH/10;
    y = MyGdxGame.HEIGHT - 3 * MyGdxGame.HEIGHT/10;

    shapex = new float[4];
    shapey = new float[4];

    radians = 2*MathUtils.PI;

    batch = new SpriteBatch();
}

private void setShape()
{
            //Simple Arrow Shape
    ......
}
public void update(float dt)
{

    setShape();
}


public void draw(ShapeRenderer sr)
{

    sr.setColor(0F, 0F, 0F, 1F);

    sr.begin(ShapeType.Line);

    //Drawing Shape
            ..............
    sr.end();
}

What I have to do to add texture to that object? (I'm using LibGdx)

© Game Development or respective owner

Related posts about textures

Related posts about libgdx