summaryrefslogtreecommitdiffstats
path: root/pacman-c++/block.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-17 19:19:56 +0200
committermanuel <manuel@mausz.at>2011-04-17 19:19:56 +0200
commit65195fdab6262d31056c74f922376de3b009943c (patch)
treee76a6141ae0603494dab0830baa41ec29a55f74e /pacman-c++/block.cpp
parent8187d48b30defcb11c61ba5365fe974151849e38 (diff)
downloadfoop-65195fdab6262d31056c74f922376de3b009943c.tar.gz
foop-65195fdab6262d31056c74f922376de3b009943c.tar.bz2
foop-65195fdab6262d31056c74f922376de3b009943c.zip
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
Diffstat (limited to 'pacman-c++/block.cpp')
-rw-r--r--pacman-c++/block.cpp10
1 files changed, 8 insertions, 2 deletions
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 @@
7QMap<Color::Color, QPixmap> Block::m_pixmaps; 7QMap<Color::Color, QPixmap> Block::m_pixmaps;
8 8
9Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent) 9Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent)
10 : GameEntity(color, parent) 10 : GameEntity(color, parent), m_neighbours(neighbours)
11{ 11{
12 /* empty object for servers */ 12 /* empty object for servers */
13 if (Constants::server) 13 if (Constants::server)
@@ -20,11 +20,17 @@ Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent)
20 m_pixmaps[color] = QPixmap(pixmapName); 20 m_pixmaps[color] = QPixmap(pixmapName);
21 } 21 }
22 setPixmap(m_pixmaps.find(color).value()); 22 setPixmap(m_pixmaps.find(color).value());
23 setNeighbours(neighbours); 23 setNeighbours(m_neighbours);
24}
25
26unsigned int Block::neighbours()
27{
28 return m_neighbours;
24} 29}
25 30
26void Block::setNeighbours(unsigned int neighbours) 31void Block::setNeighbours(unsigned int neighbours)
27{ 32{
33 m_neighbours = neighbours;
28 setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height); 34 setSprite(neighbours * Constants::sprite_offset, 0, Constants::field_size.width, Constants::field_size.height);
29} 35}
30 36