• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kapman

Public Types | Signals | Public Member Functions | Static Public Attributes | List of all members
Ghost Class Reference

#include <ghost.h>

Inheritance diagram for Ghost:
Inheritance graph
[legend]

Public Types

enum  State { HUNTER = 0, PREY = 1, EATEN = 2 }
 
- Public Types inherited from Element
enum  Type {
  KAPMAN = 0, GHOST = 1, PILL = 2, ENERGYZER = 3,
  BONUS = 4
}
 

Signals

void ghostEaten (Ghost *p_ghost)
 
void lifeLost ()
 
void stateChanged ()
 
- Signals inherited from Character
void eaten ()
 
- Signals inherited from Element
void moved (qreal p_x, qreal p_y)
 

Public Member Functions

 Ghost (qreal p_x, qreal p_y, const QString &p_imageId, Maze *p_maze)
 
 ~Ghost ()
 
void doActionOnCollision (Kapman *p_kapman)
 
QString getImageId () const
 
State getState () const
 
void initSpeedInc ()
 
void setState (Ghost::State p_state)
 
void updateMove ()
 
void updateMove (int p_row, int p_col)
 
- Public Member Functions inherited from Character
 Character (qreal p_x, qreal p_y, Maze *p_maze)
 
 ~Character ()
 
void die ()
 
qreal getNormalSpeed () const
 
qreal getSpeed () const
 
qreal getXSpeed () const
 
qreal getYSpeed () const
 
void increaseCharactersSpeed ()
 
void initSpeed ()
 
bool isInLineSight (Character *p_character)
 
void move ()
 
void setXSpeed (qreal p_xSpeed)
 
void setYSpeed (qreal p_ySpeed)
 
- Public Member Functions inherited from Element
 Element (qreal p_x, qreal p_y, Maze *p_maze)
 
 ~Element ()
 
QString getImageId () const
 
int getPoints () const
 
Element::Type getType () const
 
qreal getX () const
 
qreal getY () const
 
void initCoordinate ()
 
void setImageId (const QString &p_imageId)
 
void setX (qreal p_x)
 
void setY (qreal p_y)
 

Static Public Attributes

static const int POINTS = 200
 
- Static Public Attributes inherited from Character
static const qreal HIGH_SPEED = 5.25
 
static const qreal HIGH_SPEED_INC = 0.02
 
static const qreal LOW_SPEED = 3.75
 
static const qreal LOW_SPEED_INC = 0.005
 
static const qreal MEDIUM_SPEED = 4.5
 
static const qreal MEDIUM_SPEED_INC = 0.01
 

Additional Inherited Members

- Protected Member Functions inherited from Character
Cell getNextCell ()
 
void moveOnCenter ()
 
bool onCenter ()
 
- Protected Attributes inherited from Character
qreal m_maxSpeed
 
qreal m_normalSpeed
 
qreal m_speed
 
qreal m_speedIncrease
 
qreal m_xSpeed
 
qreal m_ySpeed
 
- Protected Attributes inherited from Element
QString m_imageId
 
Maze * m_maze
 
int m_points
 
Type m_type
 
qreal m_x
 
qreal m_xInit
 
qreal m_y
 
qreal m_yInit
 

Detailed Description

This class represents a Ghost for kapman.

Definition at line 29 of file ghost.h.

Member Enumeration Documentation

enum Ghost::State

The ghost possible states.

Enumerator
HUNTER 
PREY 
EATEN 

Definition at line 36 of file ghost.h.

Constructor & Destructor Documentation

Ghost::Ghost ( qreal  p_x,
qreal  p_y,
const QString &  p_imageId,
Maze *  p_maze 
)

Creates a new Ghost instance.

Parameters
p_xthe initial x-coordinate
p_ythe initial y-coordinate
p_imageIdpath to the image of the related item
p_mazethe Maze the Ghost is on

Definition at line 29 of file ghost.cpp.

Ghost::~Ghost ( )

Deletes the Ghost instance.

Definition at line 42 of file ghost.cpp.

Member Function Documentation

void Ghost::doActionOnCollision ( Kapman *  p_kapman)
virtual

Manages the collison with the Kapman.

Parameters
p_kapmanthe instance of Kapman which collides with the Ghost

Reimplemented from Element.

Definition at line 210 of file ghost.cpp.

QString Ghost::getImageId ( ) const

Gets the path to the Ghost image.

Returns
the path to the Ghost image

Definition at line 187 of file ghost.cpp.

Ghost::State Ghost::getState ( ) const

Gets the current state of the Ghost.

Returns
the Ghost state

Definition at line 191 of file ghost.cpp.

void Ghost::ghostEaten ( Ghost *  p_ghost)
signal

Emitted when the Ghost has been eaten.

Parameters
p_ghostthe eaten Ghost (this)
void Ghost::initSpeedInc ( )
virtual

Initializes the Ghost speed from the Character speed.

Implements Character.

Definition at line 224 of file ghost.cpp.

void Ghost::lifeLost ( )
signal

Emitted when the Kapman has lost a life.

void Ghost::setState ( Ghost::State  p_state)

Sets the Ghost state to the given value.

Parameters
p_statethe new Ghost state

Definition at line 195 of file ghost.cpp.

void Ghost::stateChanged ( )
signal

Emitted when the Ghost has changed his state.

void Ghost::updateMove ( )
virtual

Updates the Ghost move.

Implements Character.

Definition at line 66 of file ghost.cpp.

void Ghost::updateMove ( int  p_row,
int  p_col 
)

Updates the Ghost with a direction to follow.

Parameters
p_rowx coordinate of the cell to reach
p_coly coordinate of the cell to reach

Definition at line 159 of file ghost.cpp.

Member Data Documentation

const int Ghost::POINTS = 200
static

The value of an Ghost.

Definition at line 43 of file ghost.h.


The documentation for this class was generated from the following files:
  • ghost.h
  • ghost.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapman

Skip menu "kapman"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal