Hello, I am trying to create a game. The movement in this game worked until i started with animations. I don't know why, but now it shows this error: "game cannot be resolved or is not a field. (sorry if this is a dumb question, I am pretty new to programming.)
package hra2.entities.creatures;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import hra2.Game;
import hra2.gfx.Animation;
import hra2.gfx.Assets;
public class Player extends Creature {
//ANIMATIONS
private Animation animLeft;
private Animation animRight;
public Player(Game game, float x, float y) {
super(x, y, 53, 79);
this.game = game;
//ANIMATIONS
animLeft = new Animation(500, Assets.hrac_left);
animRight = new Animation(500, Assets.hrac_right);
}
public void tick() {
//ANIMATIONS
animLeft.tick();
animRight.tick();
//MOVEMENT
getInput();
move();
}
private void getInput() {
xMove = 0;
float nula = 0;
float tisic = 920;
if(game.getKeyManager().left)
xMove = -speed;
if(game.getKeyManager().right)
xMove = speed;
if(x <= nula) {
x += 5;
}
if(x >= tisic) {
x -= 5;
}
}