class PointsBar { protected int m_points; protected final int MAX_POINTS = Config.gameWidth - 2*Config.boundaryX; protected final int m_points_for_hit = 10; protected final int m_points_for_miss = 20; public PointsBar() { m_points = MAX_POINTS / 2; } ///////////////////////////////////////////////// public void increment() { m_points += m_points_for_hit; if (m_points >= MAX_POINTS) { // HOOK: this means that the user has maxed out their points and might get a special perk } m_points = min(MAX_POINTS, m_points); } public void decrement() { m_points -= m_points_for_miss; m_points = max(0, m_points); } ///////////////////////////////////////////////// public boolean empty() { return m_points <= m_points_for_miss; } ///////////////////////////////////////////////// public void draw() { // stroke(lineColor); // strokeWeight(lineWeight); noStroke(); fill(150, 100); rect(Config.boundaryX, Config.gameHeight - 90, m_points, 40); stroke(80); noFill(); rect(Config.boundaryX, Config.gameHeight - 90, MAX_POINTS, 40); } }