From 65195fdab6262d31056c74f922376de3b009943c Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 17 Apr 2011 19:19:56 +0200 Subject: a bigger commit again: - fix pacman movement. now more like real pacman (again). e.g. if you press a direction-key again: the pacman will move in that direction as soon as possible and no repeated keypress is needed - add random colorized blocks (without dieing yet) - add cmdline-option: --nocolorblocks to disable that --- pacman-c++/block.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pacman-c++/block.cpp') diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp index 16f62c4..eb51d89 100644 --- a/pacman-c++/block.cpp +++ b/pacman-c++/block.cpp @@ -7,7 +7,7 @@ QMap Block::m_pixmaps; Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) - : GameEntity(color, parent) + : GameEntity(color, parent), m_neighbours(neighbours) { /* empty object for servers */ if (Constants::server) @@ -20,11 +20,17 @@ Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) m_pixmaps[color] = QPixmap(pixmapName); } setPixmap(m_pixmaps.find(color).value()); - setNeighbours(neighbours); + setNeighbours(m_neighbours); +} + +unsigned int Block::neighbours() +{ + return m_neighbours; } void Block::setNeighbours(unsigned int neighbours) { + m_neighbours = neighbours; setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); } -- cgit v1.2.3