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

granatier

Public Slots | Signals | Public Member Functions | List of all members
Player Class Reference

#include <player.h>

Inheritance diagram for Player:
Inheritance graph
[legend]

Public Slots

void slot_refillBombArmory ()
 

Signals

void bombDropped (Player *player, qreal x, qreal y, bool newBomb, int throwDistance)
 
void bonusUpdated (Player *player, Granatier::Bonus::Type bonusType, int percentageElapsed)
 
void directionChanged ()
 
void dying ()
 
void falling ()
 
void gameUpdated ()
 
void resurrectBonusTaken ()
 
void resurrected ()
 
void stopped ()
 
- Signals inherited from Character
void dead ()
 
- Signals inherited from Element
void moved (qreal p_x, qreal p_y)
 

Public Member Functions

 Player (qreal p_x, qreal p_y, const QString &p_playerID, const PlayerSettings *p_playerSettings, Arena *p_arena)
 
 ~Player ()
 
void addBonus (Bonus *p_bonus)
 
void addPoint ()
 
void decrementBombArmory ()
 
void die ()
 
int direction ()
 
void emitGameUpdated ()
 
qreal getAskedXSpeed () const
 
qreal getAskedYSpeed () const
 
int getBombPower () const
 
QString getDesktopFilePath () const
 
QString getGraphicsFile () const
 
QString getPlayerName () const
 
void goDown ()
 
void goLeft ()
 
void goRight ()
 
void goUp ()
 
bool hasBadBonus ()
 
bool hasKickBomb ()
 
bool hasShield ()
 
bool hasThrowBomb ()
 
void init ()
 
bool isAlive () const
 
void keyPressed (QKeyEvent *keyEvent)
 
void keyReleased (QKeyEvent *keyEvent)
 
void move (qreal x, qreal y)
 
void pause ()
 
int points () const
 
void resume ()
 
void resurrect ()
 
void setShortcuts (const Shortcuts &keys)
 
bool shield (int n_ExplosionID)
 
int sign (const qreal value)
 
int signZeroPositive (const qreal value)
 
void updateMove ()
 
- Public Member Functions inherited from Character
 Character (qreal p_x, qreal p_y, Arena *p_arena)
 
 ~Character ()
 
void die ()
 
qreal getNormalSpeed () const
 
qreal getSpeed () const
 
qreal getXSpeed () const
 
qreal getYSpeed () const
 
void initSpeed ()
 
bool isInLineSight (Character *p_character) const
 
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, Arena *p_arena)
 
 ~Element ()
 
virtual void doActionOnCollision (Player *p_player)
 
QString getImageId () const
 
Granatier::Element::Type getType () const
 
qreal getX () const
 
qreal getY () const
 
void initCoordinate ()
 
void setArena (Arena *p_arena)
 
void setImageId (const QString &p_imageId)
 
void setInitialCoordinates (qreal p_x, qreal p_y)
 
void setX (qreal p_x)
 
void setY (qreal p_y)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from Character
Shortcuts m_key
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from Character
qreal m_maxSpeed
 
qreal m_normalSpeed
 
qreal m_speed
 
qreal m_xSpeed
 
qreal m_ySpeed
 
- Protected Attributes inherited from Element
Arena * m_arena
 
QString m_imageId
 
Granatier::Element::Type m_type
 
qreal m_x
 
qreal m_xInit
 
qreal m_y
 
qreal m_yInit
 
- Properties inherited from QObject
 objectName
 

Detailed Description

This class represents the main character of the game.

Definition at line 33 of file player.h.

Constructor & Destructor Documentation

Player::Player ( qreal  p_x,
qreal  p_y,
const QString &  p_playerID,
const PlayerSettings *  p_playerSettings,
Arena *  p_arena 
)

Creates a new Player instance.

Parameters
p_xthe initial x-coordinate
p_ythe initial y-coordinate
p_playerIDthe Player ID for PlayerSettings
p_playerSettingsthe PlayerSettings
p_arenathe Arena the Player is on

Definition at line 35 of file player.cpp.

Player::~Player ( )

Deletes the Player instance.

Definition at line 60 of file player.cpp.

Member Function Documentation

void Player::addBonus ( Bonus *  p_bonus)

Manages the points won.

Parameters
p_bonusreference to the bonus taken

Definition at line 514 of file player.cpp.

void Player::addPoint ( )

adds a point

Definition at line 799 of file player.cpp.

void Player::bombDropped ( Player *  player,
qreal  x,
qreal  y,
bool  newBomb,
int  throwDistance 
)
signal

Emitted when the player drops a bomb.

void Player::bonusUpdated ( Player *  player,
Granatier::Bonus::Type  bonusType,
int  percentageElapsed 
)
signal

Emitted when the player has taken a bonus.

Parameters
playerthe player which info changed
bonusTypethe bonus that was taken
percentageElapsedthe bad bonus time that has elapsed
void Player::decrementBombArmory ( )

decrements the bomb armory

Definition at line 829 of file player.cpp.

void Player::die ( )

Implements the Character function.

Definition at line 709 of file player.cpp.

int Player::direction ( )
Returns
the direction the player is moving/looking

Definition at line 819 of file player.cpp.

void Player::directionChanged ( )
signal

Emitted when the direction changed.

void Player::dying ( )
signal

Emitted when the player is dying.

void Player::emitGameUpdated ( )

Emits a signal to PlayerItem in order to manage collisions.

Definition at line 804 of file player.cpp.

void Player::falling ( )
signal

Emitted when the player is falling in a hole.

void Player::gameUpdated ( )
signal

Signals to PlayerItem that the game has been updated.

qreal Player::getAskedXSpeed ( ) const
Returns
the asked x speed value

Definition at line 809 of file player.cpp.

qreal Player::getAskedYSpeed ( ) const
Returns
the asked y speed value

Definition at line 814 of file player.cpp.

int Player::getBombPower ( ) const
Returns
the bomb power

Definition at line 824 of file player.cpp.

QString Player::getDesktopFilePath ( ) const

Gets the path to the Player Desktop file.

Returns
the path to the Player Desktop file

Definition at line 75 of file player.cpp.

QString Player::getGraphicsFile ( ) const

Gets the file for the Player SVG.

Returns
the file for the Player SVG

Definition at line 70 of file player.cpp.

QString Player::getPlayerName ( ) const

Gets the Player name.

Returns
the Player name

Definition at line 80 of file player.cpp.

void Player::goDown ( )
virtual

Makes the Player ask to go down.

Implements Character.

Definition at line 121 of file player.cpp.

void Player::goLeft ( )
virtual

Makes the Player ask to go to the left.

Implements Character.

Definition at line 149 of file player.cpp.

void Player::goRight ( )
virtual

Makes the Player ask to go to the right.

Implements Character.

Definition at line 135 of file player.cpp.

void Player::goUp ( )
virtual

Makes the Player ask to go up.

Implements Character.

Definition at line 107 of file player.cpp.

bool Player::hasBadBonus ( )
Returns
true if the player has a bad bonus

Definition at line 700 of file player.cpp.

bool Player::hasKickBomb ( )
Returns
true if the player has the kick bonus

Definition at line 695 of file player.cpp.

bool Player::hasShield ( )
Returns
true if the player has the shield bonus

Definition at line 681 of file player.cpp.

bool Player::hasThrowBomb ( )
Returns
true if the player has the throw bonus

Definition at line 690 of file player.cpp.

void Player::init ( )

Initializes the Player.

Definition at line 85 of file player.cpp.

bool Player::isAlive ( ) const

returns if the player is alive

Definition at line 729 of file player.cpp.

void Player::keyPressed ( QKeyEvent *  keyEvent)

Manages the keys for moving and dropping bombs.

Definition at line 939 of file player.cpp.

void Player::keyReleased ( QKeyEvent *  keyEvent)

Manages the keys for moving and dropping bombs.

Definition at line 996 of file player.cpp.

void Player::move ( qreal  x,
qreal  y 
)

Moves the Player function of its current coordinates and speed.

Definition at line 506 of file player.cpp.

void Player::pause ( )

pause the timer

Definition at line 94 of file player.cpp.

int Player::points ( ) const

returns the points

Definition at line 794 of file player.cpp.

void Player::resume ( )

resume the timer

Definition at line 99 of file player.cpp.

void Player::resurrect ( )

resurrects the player

Definition at line 734 of file player.cpp.

void Player::resurrectBonusTaken ( )
signal

Emitted when the player has taken the resurrect bonus.

void Player::resurrected ( )
signal

Emitted when the player has resurrected.

void Player::setShortcuts ( const Shortcuts &  keys)

Shortcuts for moving and dropping bombs.

Definition at line 65 of file player.cpp.

bool Player::shield ( int  n_ExplosionID)

Manages the points won.

Parameters
n_ExplosionIDthe ID from the explosion which hit the player
Returns
true if there is an unused shield, false otherwise

Definition at line 660 of file player.cpp.

int Player::sign ( const qreal  value)

Returns the sign of a value with 0 for zero.

Definition at line 1053 of file player.cpp.

int Player::signZeroPositive ( const qreal  value)

Returns the sign of a value with a positive sign for zero.

Definition at line 1048 of file player.cpp.

void Player::slot_refillBombArmory ( )
slot

refills the bomb armory after a bomb is exploded

Definition at line 838 of file player.cpp.

void Player::stopped ( )
signal

Emitted when the player stops moving.

void Player::updateMove ( )
virtual

Updates the Player move.

Implements Character.

Definition at line 178 of file player.cpp.


The documentation for this class was generated from the following files:
  • player.h
  • player.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

granatier

Skip menu "granatier"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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