public void update() {
		key.update();
		if (update) {
			if (state == State.GAME && able) {
				c.update();
				p.update();
				if (players == 2) {
					p2.update();
				}
			}
			if (enemyKilled >= enemyCount) {
				enemyKilled = 0;
				enemyCount += 1;
				round = true;
				roundNum++;
				newEnemy = true;
				for (int i = 0; i < ea.size(); i++) {
					EntityA tempEnt = ea.get(i);
					if (tempEnt instanceof Bullet) {
						c.removeEntity(tempEnt);
					}
				}
				for (int i = 0; i < eb.size(); i++) {
					EntityB tempEnt = eb.get(i);
					c.removeEntity(tempEnt);
				}
			}
			if (!round && newEnemy) {
				c.addEnemy(enemyCount);
				newEnemy = false;
			}
			if (upCounter == random.nextInt(60) + 30) {
				c.addEntity(new PowerUp(random.nextInt(width * scale), 0, tex, this, 2));
				upCounter = 0;
			}
			if (downCounter == random.nextInt(30) + 15) {
				c.addEntity(new PowerDown(random.nextInt(width * scale), 0, tex, this, 2));
				downCounter = 0;
			}
			p.setOff(x, y);
			if (key.up) {
				y -= speed;
			}
			if (key.down) {
				y += speed;
			}
			if (key.left) {
				x -= speed;
			}
			if (key.right) {
				x += speed;
			}
			if (!dead1) {
				if (!rapidFire) {
					if (key.enter && !isShooting) {
						c.addEntity(new Bullet(p.getXnXoff(), p.getYnYoff(), tex, this, c));
						Sound.shot.play();
						isShooting = true;
					}
				}
				if (rapidFire) {
					if (key.enter) {
						c.addEntity(new Bullet(p.getXnXoff(), p.getYnYoff(), tex, this, c));
						Sound.shot.play();
					}
				}
			}
			if (players == 1) {
				if (health <= 0) {
					dead1 = true;
					state = State.END;
				}
			}
			if (players == 2) {
				if (health <= 0) {
					dead1 = true;
				}
				if (health2 <= 0) {
					dead2 = true;
				}
				if (dead1 && dead2) {
					state = State.END;
				}
			}
			if (players == 2) {
				p2.setOff(x2, y2);
				if (key.up2) {
					y2 -= speed;
				}
				if (key.down2) {
					y2 += speed;
				}
				if (key.left2) {
					x2 -= speed;
				}
				if (key.right2) {
					x2 += speed;
				}
				if (!dead2) {
					if (!rapidFire2) {
						if (key.space && !isShooting) {
							c.addEntity(new Bullet(p2.getXnXoff(), p2.getYnYoff(), tex, this, c));
							Sound.shot.play();
							isShooting = true;
						}
					}
					if (rapidFire2) {
						if (key.space) {
							c.addEntity(new Bullet(p2.getXnXoff(), p2.getYnYoff(), tex, this, c));
							Sound.shot.play();
						}
					}
				}
			}
		}
		if (key.p && !paused) {
			paused = true;
			update = false;
		}
		if (key.esc && paused) {
			paused = false;
			update = true;
		}
	}