diff options
| author | manuel <manuel@mausz.at> | 2011-04-03 16:28:52 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-03 16:28:52 +0200 |
| commit | 818383fec4f220a2410177b58518797e81d8eab3 (patch) | |
| tree | 695236d9cec1c9fda09a22ec6df0cc0cd2298cc5 | |
| parent | c3abe9924ffa2b223988cbfc206abcd88c5d4094 (diff) | |
| download | foop-818383fec4f220a2410177b58518797e81d8eab3.tar.gz foop-818383fec4f220a2410177b58518797e81d8eab3.tar.bz2 foop-818383fec4f220a2410177b58518797e81d8eab3.zip | |
basic pacman qt setup
| -rw-r--r-- | .gitignore | 9 | ||||
| -rw-r--r-- | pacman-c++/main.cpp | 293 | ||||
| -rw-r--r-- | pacman-c++/pacman.pro | 5 | ||||
| -rw-r--r-- | pacman-c++/pacman.qrc | 5 | ||||
| -rw-r--r-- | pacman-c++/pics/pacman10-hp-sprite-2.png | bin | 0 -> 6857 bytes | |||
| -rw-r--r-- | pacman-c++/pixmapitem.cpp | 44 | ||||
| -rw-r--r-- | pacman-c++/pixmapitem.h | 22 | ||||
| -rw-r--r-- | pacman-google/src/js/pacman10-hp.3.js | 19 |
8 files changed, 394 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c901713 --- /dev/null +++ b/.gitignore | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | pacman-c++/pacman.pro.user | ||
| 2 | pacman-c++/pacman | ||
| 3 | pacman-c++/Makefile | ||
| 4 | pacman-c++/qrc_* | ||
| 5 | pacman-c++/*.o | ||
| 6 | pacman-c++/*.moc | ||
| 7 | pacman-build-debug | ||
| 8 | pacman-build-release | ||
| 9 | .*.swp | ||
diff --git a/pacman-c++/main.cpp b/pacman-c++/main.cpp new file mode 100644 index 0000000..5fa9c1c --- /dev/null +++ b/pacman-c++/main.cpp | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | #include "pixmapitem.h" | ||
| 2 | #include <QtCore> | ||
| 3 | #include <QtGui> | ||
| 4 | |||
| 5 | //![15] | ||
| 6 | class StateSwitchEvent: public QEvent | ||
| 7 | { | ||
| 8 | public: | ||
| 9 | StateSwitchEvent() | ||
| 10 | : QEvent(Type(StateSwitchType)) | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 14 | StateSwitchEvent(int rand) | ||
| 15 | : QEvent(Type(StateSwitchType)), | ||
| 16 | m_rand(rand) | ||
| 17 | { | ||
| 18 | } | ||
| 19 | |||
| 20 | enum { StateSwitchType = QEvent::User + 256 }; | ||
| 21 | |||
| 22 | int rand() const { return m_rand; } | ||
| 23 | |||
| 24 | private: | ||
| 25 | int m_rand; | ||
| 26 | }; | ||
| 27 | //![15] | ||
| 28 | |||
| 29 | //![16] | ||
| 30 | class QGraphicsRectWidget : public QGraphicsWidget | ||
| 31 | { | ||
| 32 | public: | ||
| 33 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *, | ||
| 34 | QWidget *) | ||
| 35 | { | ||
| 36 | painter->fillRect(rect(), Qt::blue); | ||
| 37 | } | ||
| 38 | }; | ||
| 39 | //![16] | ||
| 40 | |||
| 41 | class StateSwitchTransition: public QAbstractTransition | ||
| 42 | { | ||
| 43 | public: | ||
| 44 | StateSwitchTransition(int rand) | ||
| 45 | : QAbstractTransition(), | ||
| 46 | m_rand(rand) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | protected: | ||
| 51 | //![14] | ||
| 52 | virtual bool eventTest(QEvent *event) | ||
| 53 | { | ||
| 54 | return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType)) | ||
| 55 | && (static_cast<StateSwitchEvent *>(event)->rand() == m_rand); | ||
| 56 | } | ||
| 57 | //![14] | ||
| 58 | |||
| 59 | virtual void onTransition(QEvent *) {} | ||
| 60 | |||
| 61 | private: | ||
| 62 | int m_rand; | ||
| 63 | }; | ||
| 64 | |||
| 65 | //![10] | ||
| 66 | class StateSwitcher : public QState | ||
| 67 | { | ||
| 68 | Q_OBJECT | ||
| 69 | public: | ||
| 70 | StateSwitcher(QStateMachine *machine) | ||
| 71 | : QState(machine), m_stateCount(0), m_lastIndex(0) | ||
| 72 | { } | ||
| 73 | //![10] | ||
| 74 | |||
| 75 | //![11] | ||
| 76 | virtual void onEntry(QEvent *) | ||
| 77 | { | ||
| 78 | int n; | ||
| 79 | while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex) | ||
| 80 | { } | ||
| 81 | m_lastIndex = n; | ||
| 82 | machine()->postEvent(new StateSwitchEvent(n)); | ||
| 83 | } | ||
| 84 | virtual void onExit(QEvent *) {} | ||
| 85 | //![11] | ||
| 86 | |||
| 87 | //![12] | ||
| 88 | void addState(QState *state, QAbstractAnimation *animation) { | ||
| 89 | StateSwitchTransition *trans = new StateSwitchTransition(++m_stateCount); | ||
| 90 | trans->setTargetState(state); | ||
| 91 | addTransition(trans); | ||
| 92 | trans->addAnimation(animation); | ||
| 93 | } | ||
| 94 | //![12] | ||
| 95 | |||
| 96 | private: | ||
| 97 | int m_stateCount; | ||
| 98 | int m_lastIndex; | ||
| 99 | }; | ||
| 100 | |||
| 101 | //![13] | ||
| 102 | QState *createGeometryState(QObject *w1, const QRect &rect1, | ||
| 103 | QObject *w2, const QRect &rect2, | ||
| 104 | QObject *w3, const QRect &rect3, | ||
| 105 | QObject *w4, const QRect &rect4, | ||
| 106 | QState *parent) | ||
| 107 | { | ||
| 108 | QState *result = new QState(parent); | ||
| 109 | result->assignProperty(w1, "geometry", rect1); | ||
| 110 | result->assignProperty(w2, "geometry", rect2); | ||
| 111 | result->assignProperty(w3, "geometry", rect3); | ||
| 112 | result->assignProperty(w4, "geometry", rect4); | ||
| 113 | |||
| 114 | return result; | ||
| 115 | } | ||
| 116 | //![13] | ||
| 117 | |||
| 118 | int main(int argc, char **argv) | ||
| 119 | { | ||
| 120 | QApplication app(argc, argv); | ||
| 121 | |||
| 122 | #if 0 | ||
| 123 | QWidget window; | ||
| 124 | QPalette palette; | ||
| 125 | palette.setBrush(QPalette::Window, Qt::black); | ||
| 126 | window.setPalette(palette); | ||
| 127 | |||
| 128 | QPushButton *button1 = new QPushButton("A", &window); | ||
| 129 | button1->setObjectName("button1"); | ||
| 130 | |||
| 131 | QPushButton *button2 = new QPushButton("B", &window); | ||
| 132 | button2->setObjectName("button2"); | ||
| 133 | |||
| 134 | QPushButton *button3 = new QPushButton("C", &window); | ||
| 135 | button3->setObjectName("button3"); | ||
| 136 | |||
| 137 | QPushButton *button4 = new QPushButton("D", &window); | ||
| 138 | button4->setObjectName("button4"); | ||
| 139 | |||
| 140 | #else | ||
| 141 | //![1] | ||
| 142 | //QGraphicsRectWidget *button1 = new QGraphicsRectWidget; | ||
| 143 | QGraphicsRectWidget *button2 = new QGraphicsRectWidget; | ||
| 144 | QGraphicsRectWidget *button3 = new QGraphicsRectWidget; | ||
| 145 | QGraphicsRectWidget *button4 = new QGraphicsRectWidget; | ||
| 146 | button2->setZValue(1); | ||
| 147 | button3->setZValue(2); | ||
| 148 | button4->setZValue(3); | ||
| 149 | |||
| 150 | //QPixmap pixmap(":/pacman10-hp-sprite-2"); | ||
| 151 | |||
| 152 | QGraphicsScene scene(0, 0, 300, 300); | ||
| 153 | scene.setBackgroundBrush(Qt::black); | ||
| 154 | |||
| 155 | PixmapItem *button1 = new PixmapItem("google-pacman-sprite", &scene); | ||
| 156 | button1->setSprite(2, 2, 16, 16); | ||
| 157 | |||
| 158 | //scene.addItem(button2); | ||
| 159 | //scene.addItem(button3); | ||
| 160 | //scene.addItem(button4); | ||
| 161 | //![1] | ||
| 162 | QGraphicsView window(&scene); | ||
| 163 | window.setFrameStyle(0); | ||
| 164 | window.setAlignment(Qt::AlignLeft | Qt::AlignTop); | ||
| 165 | window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
| 166 | window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
| 167 | #endif | ||
| 168 | |||
| 169 | #if 0 | ||
| 170 | //![2] | ||
| 171 | QStateMachine machine; | ||
| 172 | |||
| 173 | QState *group = new QState(); | ||
| 174 | group->setObjectName("group"); | ||
| 175 | QTimer timer; | ||
| 176 | timer.setInterval(1250); | ||
| 177 | timer.setSingleShot(true); | ||
| 178 | QObject::connect(group, SIGNAL(entered()), &timer, SLOT(start())); | ||
| 179 | //![2] | ||
| 180 | |||
| 181 | //![3] | ||
| 182 | QState *state1; | ||
| 183 | QState *state2; | ||
| 184 | QState *state3; | ||
| 185 | QState *state4; | ||
| 186 | QState *state5; | ||
| 187 | QState *state6; | ||
| 188 | QState *state7; | ||
| 189 | |||
| 190 | state1 = createGeometryState(button1, QRect(100, 0, 50, 50), | ||
| 191 | button2, QRect(150, 0, 50, 50), | ||
| 192 | button3, QRect(200, 0, 50, 50), | ||
| 193 | button4, QRect(250, 0, 50, 50), | ||
| 194 | group); | ||
| 195 | //![3] | ||
| 196 | state2 = createGeometryState(button1, QRect(250, 100, 50, 50), | ||
| 197 | button2, QRect(250, 150, 50, 50), | ||
| 198 | button3, QRect(250, 200, 50, 50), | ||
| 199 | button4, QRect(250, 250, 50, 50), | ||
| 200 | group); | ||
| 201 | state3 = createGeometryState(button1, QRect(150, 250, 50, 50), | ||
| 202 | button2, QRect(100, 250, 50, 50), | ||
| 203 | button3, QRect(50, 250, 50, 50), | ||
| 204 | button4, QRect(0, 250, 50, 50), | ||
| 205 | group); | ||
| 206 | state4 = createGeometryState(button1, QRect(0, 150, 50, 50), | ||
| 207 | button2, QRect(0, 100, 50, 50), | ||
| 208 | button3, QRect(0, 50, 50, 50), | ||
| 209 | button4, QRect(0, 0, 50, 50), | ||
| 210 | group); | ||
| 211 | state5 = createGeometryState(button1, QRect(100, 100, 50, 50), | ||
| 212 | button2, QRect(150, 100, 50, 50), | ||
| 213 | button3, QRect(100, 150, 50, 50), | ||
| 214 | button4, QRect(150, 150, 50, 50), | ||
| 215 | group); | ||
| 216 | state6 = createGeometryState(button1, QRect(50, 50, 50, 50), | ||
| 217 | button2, QRect(200, 50, 50, 50), | ||
| 218 | button3, QRect(50, 200, 50, 50), | ||
| 219 | button4, QRect(200, 200, 50, 50), | ||
| 220 | group); | ||
| 221 | //![4] | ||
| 222 | state7 = createGeometryState(button1, QRect(0, 0, 50, 50), | ||
| 223 | button2, QRect(250, 0, 50, 50), | ||
| 224 | button3, QRect(0, 250, 50, 50), | ||
| 225 | button4, QRect(250, 250, 50, 50), | ||
| 226 | group); | ||
| 227 | group->setInitialState(state1); | ||
| 228 | //![4] | ||
| 229 | |||
| 230 | //![5] | ||
| 231 | QParallelAnimationGroup animationGroup; | ||
| 232 | QSequentialAnimationGroup *subGroup; | ||
| 233 | |||
| 234 | QPropertyAnimation *anim = new QPropertyAnimation(button4, "geometry"); | ||
| 235 | anim->setDuration(1000); | ||
| 236 | anim->setEasingCurve(QEasingCurve::OutElastic); | ||
| 237 | animationGroup.addAnimation(anim); | ||
| 238 | //![5] | ||
| 239 | |||
| 240 | //![6] | ||
| 241 | subGroup = new QSequentialAnimationGroup(&animationGroup); | ||
| 242 | subGroup->addPause(100); | ||
| 243 | anim = new QPropertyAnimation(button3, "geometry"); | ||
| 244 | anim->setDuration(1000); | ||
| 245 | anim->setEasingCurve(QEasingCurve::OutElastic); | ||
| 246 | subGroup->addAnimation(anim); | ||
| 247 | //![6] | ||
| 248 | |||
| 249 | subGroup = new QSequentialAnimationGroup(&animationGroup); | ||
| 250 | subGroup->addPause(150); | ||
| 251 | anim = new QPropertyAnimation(button2, "geometry"); | ||
| 252 | anim->setDuration(1000); | ||
| 253 | anim->setEasingCurve(QEasingCurve::OutElastic); | ||
| 254 | subGroup->addAnimation(anim); | ||
| 255 | |||
| 256 | subGroup = new QSequentialAnimationGroup(&animationGroup); | ||
| 257 | subGroup->addPause(200); | ||
| 258 | anim = new QPropertyAnimation(button1, "geometry"); | ||
| 259 | anim->setDuration(1000); | ||
| 260 | anim->setEasingCurve(QEasingCurve::OutElastic); | ||
| 261 | subGroup->addAnimation(anim); | ||
| 262 | |||
| 263 | //![7] | ||
| 264 | StateSwitcher *stateSwitcher = new StateSwitcher(&machine); | ||
| 265 | stateSwitcher->setObjectName("stateSwitcher"); | ||
| 266 | group->addTransition(&timer, SIGNAL(timeout()), stateSwitcher); | ||
| 267 | stateSwitcher->addState(state1, &animationGroup); | ||
| 268 | stateSwitcher->addState(state2, &animationGroup); | ||
| 269 | //![7] | ||
| 270 | stateSwitcher->addState(state3, &animationGroup); | ||
| 271 | stateSwitcher->addState(state4, &animationGroup); | ||
| 272 | stateSwitcher->addState(state5, &animationGroup); | ||
| 273 | stateSwitcher->addState(state6, &animationGroup); | ||
| 274 | //![8] | ||
| 275 | stateSwitcher->addState(state7, &animationGroup); | ||
| 276 | //![8] | ||
| 277 | |||
| 278 | //![9] | ||
| 279 | machine.addState(group); | ||
| 280 | machine.setInitialState(group); | ||
| 281 | machine.start(); | ||
| 282 | //![9] | ||
| 283 | #endif | ||
| 284 | |||
| 285 | window.resize(300, 300); | ||
| 286 | window.show(); | ||
| 287 | |||
| 288 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | ||
| 289 | |||
| 290 | return app.exec(); | ||
| 291 | } | ||
| 292 | |||
| 293 | #include "main.moc" | ||
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro new file mode 100644 index 0000000..976ad61 --- /dev/null +++ b/pacman-c++/pacman.pro | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | SOURCES += main.cpp \ | ||
| 2 | pixmapitem.cpp | ||
| 3 | HEADERS += pixmapitem.h | ||
| 4 | RESOURCES += pacman.qrc | ||
| 5 | |||
diff --git a/pacman-c++/pacman.qrc b/pacman-c++/pacman.qrc new file mode 100644 index 0000000..c209878 --- /dev/null +++ b/pacman-c++/pacman.qrc | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | <RCC> | ||
| 2 | <qresource prefix="/"> | ||
| 3 | <file alias="google-pacman-sprite">pics/pacman10-hp-sprite-2.png</file> | ||
| 4 | </qresource> | ||
| 5 | </RCC> | ||
diff --git a/pacman-c++/pics/pacman10-hp-sprite-2.png b/pacman-c++/pics/pacman10-hp-sprite-2.png new file mode 100644 index 0000000..7354b9d --- /dev/null +++ b/pacman-c++/pics/pacman10-hp-sprite-2.png | |||
| Binary files differ | |||
diff --git a/pacman-c++/pixmapitem.cpp b/pacman-c++/pixmapitem.cpp new file mode 100644 index 0000000..9c2f941 --- /dev/null +++ b/pacman-c++/pixmapitem.cpp | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #include "pixmapitem.h" | ||
| 2 | #include <QPainter> | ||
| 3 | |||
| 4 | PixmapItem::PixmapItem(const QString &fileName, QGraphicsItem *parent) | ||
| 5 | : QGraphicsObject(parent), m_x(0), m_y(0) | ||
| 6 | { | ||
| 7 | m_pix = ":/" + fileName; | ||
| 8 | m_width = m_pix.width(); | ||
| 9 | m_height = m_pix.height(); | ||
| 10 | } | ||
| 11 | |||
| 12 | PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene) | ||
| 13 | : QGraphicsObject(), m_x(0), m_y(0) | ||
| 14 | { | ||
| 15 | m_pix = ":/" + fileName; | ||
| 16 | m_width = m_pix.width(); | ||
| 17 | m_height = m_pix.height(); | ||
| 18 | scene->addItem(this); | ||
| 19 | } | ||
| 20 | |||
| 21 | void PixmapItem::setSprite(int x, int y, int width, int height) | ||
| 22 | { | ||
| 23 | m_x = x; | ||
| 24 | m_y = y; | ||
| 25 | m_width = width; | ||
| 26 | m_height = height; | ||
| 27 | } | ||
| 28 | |||
| 29 | QSizeF PixmapItem::size() const | ||
| 30 | { | ||
| 31 | return QSizeF(m_width, m_height); | ||
| 32 | } | ||
| 33 | |||
| 34 | QRectF PixmapItem::boundingRect() const | ||
| 35 | { | ||
| 36 | return QRectF(QPointF(0, 0), size()); | ||
| 37 | } | ||
| 38 | |||
| 39 | void PixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) | ||
| 40 | { | ||
| 41 | painter->drawPixmap(0, 0, m_pix, m_x, m_y, m_width, m_height); | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
diff --git a/pacman-c++/pixmapitem.h b/pacman-c++/pixmapitem.h new file mode 100644 index 0000000..4ea3748 --- /dev/null +++ b/pacman-c++/pixmapitem.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #ifndef __PIXMAPITEM__H__ | ||
| 2 | #define __PIXMAPITEM__H__ | ||
| 3 | |||
| 4 | #include <QtGui/QGraphicsObject> | ||
| 5 | #include <QtGui/QGraphicsScene> | ||
| 6 | |||
| 7 | class PixmapItem : public QGraphicsObject | ||
| 8 | { | ||
| 9 | public: | ||
| 10 | PixmapItem(const QString &fileName, QGraphicsItem *parent = 0); | ||
| 11 | PixmapItem(const QString &fileName, QGraphicsScene *scene); | ||
| 12 | void setSprite(int x, int y, int width, int height); | ||
| 13 | QSizeF size() const; | ||
| 14 | QRectF boundingRect() const; | ||
| 15 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); | ||
| 16 | private: | ||
| 17 | QPixmap m_pix; | ||
| 18 | int m_x, m_y; | ||
| 19 | int m_width, m_height; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #endif | ||
diff --git a/pacman-google/src/js/pacman10-hp.3.js b/pacman-google/src/js/pacman10-hp.3.js index fe3ef91..604c64d 100644 --- a/pacman-google/src/js/pacman10-hp.3.js +++ b/pacman-google/src/js/pacman10-hp.3.js | |||
| @@ -1803,10 +1803,12 @@ function () { | |||
| 1803 | return [c, b] | 1803 | return [c, b] |
| 1804 | }; | 1804 | }; |
| 1805 | E.prototype.b = function () { | 1805 | E.prototype.b = function () { |
| 1806 | // this calculates the sprite position | ||
| 1806 | this.k(); | 1807 | this.k(); |
| 1807 | var b = [0, 0]; | 1808 | var b = [0, 0]; |
| 1808 | b = g.gameplayMode == 8 || g.gameplayMode == 14 ? [0, 3] : this.ghost ? this.r() : this.s(); | 1809 | b = g.gameplayMode == 8 || g.gameplayMode == 14 ? [0, 3] : this.ghost ? this.r() : this.s(); |
| 1809 | if (this.elBackgroundPos[0] != b[0] || this.elBackgroundPos[1] != b[1]) { | 1810 | if (this.elBackgroundPos[0] != b[0] || this.elBackgroundPos[1] != b[1]) { |
| 1811 | console.log("changeElementBkPos: b=" + b) | ||
| 1810 | this.elBackgroundPos[0] = b[0]; | 1812 | this.elBackgroundPos[0] = b[0]; |
| 1811 | this.elBackgroundPos[1] = b[1]; | 1813 | this.elBackgroundPos[1] = b[1]; |
| 1812 | b[0] *= 16; | 1814 | b[0] *= 16; |
| @@ -1857,6 +1859,7 @@ function () { | |||
| 1857 | b.style.backgroundImage = "url(src/pacman10-hp-sprite-2.png)"; | 1859 | b.style.backgroundImage = "url(src/pacman10-hp-sprite-2.png)"; |
| 1858 | b.style.backgroundPosition = -c + "px " + -d + "px"; | 1860 | b.style.backgroundPosition = -c + "px " + -d + "px"; |
| 1859 | b.style.backgroundRepeat = "no-repeat" | 1861 | b.style.backgroundRepeat = "no-repeat" |
| 1862 | console.log("prepareElement: id=" + b.id + ", bgpos=", b.style.backgroundPosition) | ||
| 1860 | } else { | 1863 | } else { |
| 1861 | b.style.overflow = "hidden"; | 1864 | b.style.overflow = "hidden"; |
| 1862 | c = "display: block; position: relative; left: " + -c + "px; top: " + -d + "px"; | 1865 | c = "display: block; position: relative; left: " + -c + "px; top: " + -d + "px"; |
| @@ -1865,10 +1868,15 @@ function () { | |||
| 1865 | }; | 1868 | }; |
| 1866 | g.changeElementBkPos = function (b, c, d, f) { | 1869 | g.changeElementBkPos = function (b, c, d, f) { |
| 1867 | if (f) { | 1870 | if (f) { |
| 1871 | console.log("changeElementBkPos: c=" + c + ", d=" + d) | ||
| 1868 | c = g.getCorrectedSpritePos(c); | 1872 | c = g.getCorrectedSpritePos(c); |
| 1869 | d = g.getCorrectedSpritePos(d) | 1873 | d = g.getCorrectedSpritePos(d) |
| 1874 | console.log("changeElementBkPos: c=" + c + ", d=" + d) | ||
| 1875 | } | ||
| 1876 | if (g.useCss) { | ||
| 1877 | b.style.backgroundPosition = -c + "px " + -d + "px"; | ||
| 1878 | console.log("changeElementBkPos: id=" + b.id + ", bgpos=", b.style.backgroundPosition) | ||
| 1870 | } | 1879 | } |
| 1871 | if (g.useCss) b.style.backgroundPosition = -c + "px " + -d + "px"; | ||
| 1872 | else if (b.childNodes[0]) { | 1880 | else if (b.childNodes[0]) { |
| 1873 | b.childNodes[0].style.left = -c + "px"; | 1881 | b.childNodes[0].style.left = -c + "px"; |
| 1874 | b.childNodes[0].style.top = -d + "px" | 1882 | b.childNodes[0].style.top = -d + "px" |
| @@ -2366,7 +2374,12 @@ function () { | |||
| 2366 | for (var b = g.playerCount; b < g.playerCount + 4; b++) g.actors[b].B() | 2374 | for (var b = g.playerCount; b < g.playerCount + 4; b++) g.actors[b].B() |
| 2367 | }; | 2375 | }; |
| 2368 | g.moveActors = function () { | 2376 | g.moveActors = function () { |
| 2369 | for (var b in g.actors) g.actors[b].move() | 2377 | for (var b in g.actors) |
| 2378 | { | ||
| 2379 | if (g.actors[b].ghost) | ||
| 2380 | continue; | ||
| 2381 | g.actors[b].move() | ||
| 2382 | } | ||
| 2370 | }; | 2383 | }; |
| 2371 | g.ghostDies = function (b, c) { | 2384 | g.ghostDies = function (b, c) { |
| 2372 | g.playSound("eating-ghost", 0); | 2385 | g.playSound("eating-ghost", 0); |
| @@ -3197,4 +3210,4 @@ function () { | |||
| 3197 | g.prepareSound() | 3210 | g.prepareSound() |
| 3198 | }; | 3211 | }; |
| 3199 | g.init(); | 3212 | g.init(); |
| 3200 | }(); \ No newline at end of file | 3213 | }(); |
