nsnake
Classic snake game for the terminal
|
Controls how many Fruits are there and how they're spawned. More...
#include <FruitManager.hpp>
Public Member Functions | |
FruitManager (int amount) | |
Creates a Fruit container that has at most #amount fruits at once on the screen. More... | |
bool | eatenFruit (Player *player) |
Tells if the #player has eaten a fruit this frame. | |
void | update (Player *player, Board *board) |
Updates internal fruits, adding them to the #board and making sure it doesn't touch #player. More... | |
int | getAmount () |
Returns the maximum size we can store within this manager. More... | |
void | add (int x, int y) |
Creates a fruit, adding it at #x, #y. More... | |
void | addRandomly (Board *board, Player *player) |
Creates a fruit randomly within boundaries of #board, making sure that it's not inside #player. More... | |
void | draw (Window *win) |
Controls how many Fruits are there and how they're spawned.
Definition at line 22 of file FruitManager.hpp.
FruitManager::FruitManager | ( | int | amount | ) |
Creates a Fruit container that has at most #amount fruits at once on the screen.
Definition at line 4 of file FruitManager.cpp.
void FruitManager::add | ( | int | x, |
int | y | ||
) |
Creates a fruit, adding it at #x, #y.
Definition at line 37 of file FruitManager.cpp.
Creates a fruit randomly within boundaries of #board, making sure that it's not inside #player.
Definition at line 41 of file FruitManager.cpp.
int FruitManager::getAmount | ( | ) |
Returns the maximum size we can store within this manager.
Definition at line 33 of file FruitManager.cpp.
Updates internal fruits, adding them to the #board and making sure it doesn't touch #player.
Definition at line 24 of file FruitManager.cpp.