Banana

Banana 🍌

Bananas are designed as collectible items. Currently, their behavior upon collection is to be destroyed. In the next chapter, this will be updated to provide the player with a bonus score.

game/banana.h
#pragma once

#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Sprite.hpp>

#include "engine/circle_collider.h"
#include "engine/node.h"

namespace game {

class Banana : public ng::Node {
 public:
  explicit Banana(ng::App* app);

  bool GetIsCollected() const;
  void Collect();

 protected:
  void Draw(sf::RenderTarget& target) override;

 private:
  sf::Sprite sprite_;
  bool is_collected_ = false;
};

}  // namespace game

Last updated