nsnake
Classic snake game for the terminal
Public Types | Public Member Functions | List of all members
Player Class Reference

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. More...
 
void increase ()
 

Detailed Description

Definition at line 23 of file Player.hpp.

Member Function Documentation

bool Player::bodyHit ( int  x,
int  y,
bool  isCheckingHead = false 
)

Tells if something at #x and #y collides with any part of the snake.

Note
#isHead is a huge HACK to allow me to check if the head collides with the body. Ignore it.

Definition at line 146 of file Player.cpp.


The documentation for this class was generated from the following files: