nsnake
Classic snake game for the terminal
|
Public Types | |
enum | Direction { UP , DOWN , LEFT , RIGHT } |
Public Member Functions | |
Player (int x, int y) | |
bool | isAlive () |
int | getSize () |
int | getX () |
Returns the head's x position. | |
int | getY () |
Returns the head's y position. | |
void | moveTo (int x, int y) |
void | move (Direction direction) |
void | kill () |
void | update (Board *board) |
void | draw (Window *win) |
bool | headHit (int x, int y) |
bool | bodyHit (int x, int y, bool isCheckingHead=false) |
Tells if something at #x and #y collides with any part of the snake. | |
void | increase () |
Definition at line 23 of file Player.hpp.
enum Player::Direction |
Definition at line 26 of file Player.hpp.
Player::Player | ( | int | x, |
int | y ) |
Definition at line 4 of file Player.cpp.
|
inlinevirtual |
Definition at line 32 of file Player.hpp.
bool Player::bodyHit | ( | int | x, |
int | y, | ||
bool | isCheckingHead = false ) |
Tells if something at #x and #y collides with any part of the snake.
Definition at line 146 of file Player.cpp.
void Player::draw | ( | Window * | win | ) |
Definition at line 122 of file Player.cpp.
int Player::getSize | ( | ) |
Definition at line 21 of file Player.cpp.
int Player::getX | ( | ) |
Returns the head's x position.
Definition at line 25 of file Player.cpp.
int Player::getY | ( | ) |
Returns the head's y position.
Definition at line 29 of file Player.cpp.
bool Player::headHit | ( | int | x, |
int | y ) |
Definition at line 141 of file Player.cpp.
void Player::increase | ( | ) |
Definition at line 158 of file Player.cpp.
bool Player::isAlive | ( | ) |
Definition at line 17 of file Player.cpp.
void Player::kill | ( | ) |
Definition at line 42 of file Player.cpp.
void Player::move | ( | Direction | direction | ) |
Definition at line 38 of file Player.cpp.
void Player::moveTo | ( | int | x, |
int | y ) |
Definition at line 33 of file Player.cpp.
void Player::update | ( | Board * | board | ) |
Definition at line 46 of file Player.cpp.