package com.example.flappybird.states; /**
 * GamePanel.java
 * Main game panel
 *
 * @author  Paul Krishnamurthy
 */

import com.example.flappybird.*;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;

public abstract class GameState {
	////////////////////
	// Game variables //
	////////////////////

	// Player score
	protected int score;

	// Distance between pipes
	protected int pipeDistTracker;

	// If score was greater than previous highscore
	protected boolean scoreWasGreater;

	// Arraylist of Pipe objects
	public static ArrayList<Pipe> pipes;

	// Game bird
	public static Bird gameBird;

	// Game panel
	public GamePanel gamePanel;

	public GameState(GamePanel panel) {
		this.gamePanel = panel;
	}

	/**
	 * Restarts game by resetting game variables
	 */
	public void restart () {
		// Reset game statistics
		score = 0;
		pipeDistTracker = 0;
		scoreWasGreater = false;

		// Game bird
		gameBird = new Bird(172, 250);

		// Remove old pipes
		pipes = new ArrayList<Pipe>();
	}

	public abstract void paintGameState(Graphics g);
	public abstract void handleKeyboardEvent(KeyEvent e);
	public abstract void handleMouseEvent(MouseEvent e);
}
