public void tick() { if (walking) { animSprite.tick(); } else animSprite.setFrame(0); if (fireRate > 0) { fireRate--; } int xa = 0, ya = 0; if (input.up) { animSprite = up; ya--; } else if (input.down) { animSprite = down; ya++; } if (input.left) { animSprite = left; xa--; } else if (input.right) { animSprite = right; xa++; } if (xa != 0 || ya != 0) { move(xa, ya); walking = true; } else { walking = false; } clear(); updateShooting(); }
public void render(Screen screen) { int flip = 0; sprite = animSprite.getSprite(); screen.renderMob(x - 8, y - 8, sprite, flip); }