[ad_1]
I’m having an issue with the final a part of the GameRenderer class. I name batcher.draw() and obtain this error:
The methodology draw(Texture, float, float, float, float) within the sort SpriteBatch isn’t relevant for the arguments (Object, float, float, float, float)
This solely occurs once I strive to attract animation; pictures work superb. How do I repair this?
This is my GameRenderer class, which throws the error.
public class GameRenderer {
personal SpriteBatch batcher = new SpriteBatch();
public void render(float runTime) {
// Begin SpriteBatch
batcher.start();
// The chook wants transparency.
batcher.enableBlending();
// Draw chook at its coordinates. Retrieve the Animation object from
// AssetLoader
// Pass within the runTime variable to get the present body.
batcher.draw(AssetLoader.chookAnimation.getKeyFrame(runTime),
x, y, width, top);
// End SpriteBatch
batcher.finish();
}
}
Just in case, right here is my AssetLoader class:
public class AssetLoader {
public static Animation chookAnimation;
public static void load() {
Texture texture = new Texture(Gdx.information.inner("knowledge/texture.png"));
texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
TextureArea birdDown = new TextureArea(texture, 136, 0, 17, 12);
birdDown.flip(false, true);
TextureArea chook = new TextureArea(texture, 153, 0, 17, 12);
chook.flip(false, true);
TextureArea birdUp = new TextureArea(texture, 170, 0, 17, 12);
birdUp.flip(false, true);
TextureArea[] birds = { birdDown, chook, birdUp };
chookAnimation = new Animation(0.06f, birds);
chookAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);
}
}
The class the place i name AssetLoader.load()
public class ZBGame extends Game {
@Override
public void create() {
AssetLoader.load();
/* Other stuff */
}
}
[ad_2]