void MainWindow::on_chatstart_pressed() { chat = new chatinit(mainconvos); chat->show(); connect(chat, SIGNAL(regen()), this, SLOT(anger())); chat->raise(); chat->activateWindow(); }
void Enemy::canGoY(float dt, const Physics &phys) { pos.y += vel.y * dt; for (float changeY = phys.testY(*this); changeY!=0; changeY = phys.testY(*this)) { pos.y += phys.testY(*this); if (phys.gravAngle%180 == 0) vel.setY(0, phys.gravAngle); else hitWall = true; } if (phys.testBoundsY(*this) != 0) { // when fallen into the pit anger(phys); dead = true; // indicate death to reset } }
// helper functions for update() void Enemy::canGoX(float dt, const Physics &phys) { pos.x += vel.x * dt; float changeX = phys.testX(*this); while (changeX!=0) { // as long as there are collisions with the level, keep checking pos.x += changeX; if (phys.gravAngle%180 == 0) hitWall = true; else vel.setY(0, phys.gravAngle); changeX = phys.testX(*this); } changeX = phys.testBoundsX(*this); if (changeX != 0) { anger(phys); dead = true; // indicate death to reset } }