示例#1
0
/**
* @brief Lance la production de tous les WaveElement de la vague courante.
* Cette méthode gère également le cas particulier de fin de partie, i.e lorsqu'il n'y
* a plus de vague à construire.
*/
void EnemyFactory::produceWave(void){
    _waveTimerStep+= 1; /* pas très sur de ça */

    if (_waveTimerStep < (GAME::FPS / 2))
        return;

    _waveTimerStep = 0;
    // Vérifie s'il reste des vagues à produire
    if(_mapWaves.empty()){
        if(_currentMap->getEnemyList().empty()) {

            // Fin de partie : Gagné !
            emit gameWon(QString("Vous avez gagne !!"));

        }
        return;
    }

    // Récupère la vague courante
    if(_mapWaves.first()->isFinished()){

        // Charge la vague suivante
        _mapWaves.pop_front();        

        // Ré-active le bouton de lancement de vague ennemie
        // ... s'il reste encore des vagues à lancer
        if(!_mapWaves.empty()){
            emit setLaunchWaveButtonEnabled(true);
            //.. et affiche le contenu de la prochaine vague
            this->getNextWaveDesc();
            disconnect(_currentMap->getGameTimer(),SIGNAL(timeout()),this,SLOT(produceWave(void)));
        }
//------------------------------------------------------------------------------
void GameLogicClientSoccer::executeCustomCommand(unsigned type, RakNet::BitStream & args)
{
    switch (type)
    {
    case CSCTS_GAME_WON:
        gameWon(args);
        break;
    case CSCTS_GOAL:
        onGoalScored(args);
        break;
    default:
        GameLogicClientCommon::executeCustomCommand(type, args);
    }    
}
示例#3
0
void MainWindow::startGame()
{
    if (_elapsedSteps && QMessageBox::No == QMessageBox::question(this, tr("Sure?"), tr("Do you wish to abandon the current game?"), QMessageBox::Yes, QMessageBox::No))
        return;

    if (ui->graphicsView->scene())
        ui->graphicsView->scene()->deleteLater();

    MemoryGameBoard *board = new MemoryGameBoard(this);
    ui->graphicsView->setScene(board);
    connect(board, SIGNAL(gameWon()), this, SLOT(onGameWon()));
    connect(board, SIGNAL(elapsedStepsChanged(uint)), this, SLOT(onElapsedStepsChanged(uint)));
    board->setBackgroundBrush(QBrush(QColor(255, 255, 255, 255)));
    board->setSceneRect(ui->graphicsView->rect());
    board->startGame();
}
示例#4
0
void GameScreen::createBall()
{
    ball = new Label(this, "ball");
    ball->setPixmap(*ballIcon);
    int width = (this->width() - (this->width() - ui->rightLine->pos().x()));
    ball->setGeometry((width / 2) - (BALLWIDTH / 2), paddle->pos().y() - PADDLEHEIGHT, BALLWIDTH, BALLHEIGHT);
    ball->setEnabled(false);
    ball->show();
    Timer *timer = new Timer(ball, "ball");
    ball->object = timer;
    timer->object = ball;
    timer->setInterval(ballSpeed);

    connect(timer, SIGNAL(lifeLost()), this, SLOT(decrementLives()));
    connect(timer, SIGNAL(gameWon()), this, SLOT(gameIsWon()));
    emit(eventTriggered("Ball created"));
}
示例#5
0
文件: ttt.hpp 项目: beschofield/TTT
int ttt<DEBUG>::moveRandom()
{
	int		i, j, play, row, col;
	std::uniform_int_distribution<int> randomPlay(0, 8);

	if(DEBUG) { std::cout << "ttt<DEBUG>::moveRandom();" << std::endl; }
	if(gameWon() > 0) return(-1);
	while(true) {
		play = randomPlay(mt);
		row = play % 3; 
		col = play / 3;
		if(board[col][row] == ' ') break;
	}
	board[col][row] = (turn++ % 2 == 0 ? 'X' : 'O');
//	history.push_back(board);
	return(0);
}
示例#6
0
MainScene::MainScene(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainScene),
    m_time_counter(new QTimer(this)),
    m_who_am_i(NOT_PLAYER),
    m_click(new QSound(":/sounds/click.wav"))
{
    ui->setupUi(this);
    connect(ui->transferButton, SIGNAL(clicked(bool)),
            this, SLOT(toChangeTurn()));
    connect(ui->menuButton, SIGNAL(clicked(bool)),
            this, SIGNAL(shouldSetting()));
    connect(ui->undoButton, SIGNAL(clicked(bool)),
            this, SLOT(toSendUndo()));
    connect(ui->giveupButton, SIGNAL(clicked(bool)),
            this, SLOT(toSendGiveup()));
    connect(ui->transferButton, SIGNAL(clicked(bool)),
            m_click, SLOT(play()));
    connect(ui->menuButton, SIGNAL(clicked(bool)),
            m_click, SLOT(play()));
    connect(ui->undoButton, SIGNAL(clicked(bool)),
            m_click, SLOT(play()));
    connect(ui->giveupButton, SIGNAL(clicked(bool)),
            m_click, SLOT(play()));

    connect(this, SIGNAL(remainingTimeChanged(int)),
            this, SLOT(updateRemaining(int)));

    m_time_counter->setInterval(TIMER_INTERVAL);
    connect(m_time_counter, SIGNAL(timeout()),
            this, SLOT(reduceRemaining()));

    connect(ui->boardView, SIGNAL(won()),
            this, SIGNAL(gameWon()));
    connect(ui->boardView, SIGNAL(lost()),
            this, SIGNAL(gameLost()));
    connect(ui->boardView, SIGNAL(finished(bool)),
            this, SIGNAL(gameFinished(bool)));
    connect(ui->boardView, SIGNAL(placed(QPoint,bool,bool)),
            this, SIGNAL(shouldPlace(QPoint,bool,bool)));
}
示例#7
0
void GameManager::update(int frameTime)
{
	static bool levelComplete = false;

	if(pause)
	{
		return;
	}

	for(auto &entity : uiEntities)
	{
		entity->update(frameTime);
	}

	//std::cout << "Updating" << std::endl;
	for(std::vector<GameEntity*>::iterator it=physicsEntities.begin(); it!=physicsEntities.end();)
	{
		//Update the item
		(*it)->update(frameTime);

		//Delete it if it's deletable
		if((*it)->isDeletable())
		{
			delete * it;
			//std::cout << "Deleted" << std::endl;
			it = physicsEntities.erase(it);
			//std::cout << "Erased" << std::endl;
		}
		else
		{
			++it;
		}
	}

	if(blockCount <= 0)
	{
		gameWon();
	}
	
	detectCollisions();
}
示例#8
0
void MainWindow::loadGame()
{
    QString fileName = QFileDialog::getOpenFileName(this);
    if (!fileName.isEmpty())
    {
        if (ui->graphicsView->scene())
            ui->graphicsView->scene()->deleteLater();

        MemoryGameBoard *board = new MemoryGameBoard(this);
        ui->graphicsView->setScene(board);
        connect(board, SIGNAL(gameWon()), this, SLOT(onGameWon()));
        connect(board, SIGNAL(elapsedStepsChanged(uint)), this, SLOT(onElapsedStepsChanged(uint)));
        board->setBackgroundBrush(QBrush(QColor(255, 255, 255, 255)));
        board->setSceneRect(ui->graphicsView->rect());

        QFile f(fileName);
        f.open(QIODevice::ReadOnly);
        QDataStream stream(&f);
        board->loadData(stream);
        f.close();
    }
}
示例#9
0
文件: Node.cpp 项目: paulobruno/AiUfc
// returns true if this node or a descendent is the goal
bool Node::depthVisit(std::vector<Node*>* vector, std::vector<bool>* visitedNodes)
{
    visitedNodes->at(stateNumber) = true;
    //showFile();


    if (gameWon())
    {
        vector->pop_back();
        return true;
    }



    if (Node* n = shiftLeft())
    {
        if (n->notVisited(visitedNodes))
        {
            child.push_back(n);
            vector->push_back(n);
            //n->setHeight(height+1);

            // if this child or a descendant is the goal stop returns true
            if (vector->back()->depthVisit(vector, visitedNodes))
            {
                vector->pop_back();
                return true;
            }
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftUp())
    {
        if (n->notVisited(visitedNodes))
        {
            child.push_back(n);
            vector->push_back(n);
            //n->setHeight(height+1);

            // if this child or a descendant is the goal stop returns true
            if (vector->back()->depthVisit(vector, visitedNodes))
            {
                vector->pop_back();
                return true;
            }
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftRight())
    {
        if (n->notVisited(visitedNodes))
        {
            child.push_back(n);
            vector->push_back(n);
            //n->setHeight(height+1);

            // if this child or a descendant is the goal stop returns true
            if (vector->back()->depthVisit(vector, visitedNodes))
            {
                vector->pop_back();
                return true;
            }
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftDown())
    {
        if (n->notVisited(visitedNodes))
        {
            child.push_back(n);
            vector->push_back(n);
            //n->setHeight(height+1);

            // if this child or a descendant is the goal stop returns true
            if (vector->back()->depthVisit(vector, visitedNodes))
            {
                vector->pop_back();
                return true;
            }
        }
        else
        {
            delete n;
        }
    }


    vector->pop_back();
    return false;
}
示例#10
0
文件: Node.cpp 项目: paulobruno/AiUfc
bool Node::aStarVisit(std::deque<Node*>* deque, std::vector<bool>* visitedNodes)
{
    visitedNodes->at(stateNumber) = true;
    showFile();


    if (gameWon())
    {
        return true;
    }
    

    if (Node* n = shiftLeft())
    {
        if (n->notVisited(visitedNodes))
        {
            //n->setHeight(height+1);
            deque->push_back(n);
            child.push_back(n);
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftUp())
    {
        if (n->notVisited(visitedNodes))
        {
            //n->setHeight(height+1);
            deque->push_back(n);
            child.push_back(n);
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftRight())
    {
        if (n->notVisited(visitedNodes))
        {
            //n->setHeight(height+1);
            deque->push_back(n);
            child.push_back(n);
        }
        else
        {
            delete n;
        }
    }

    if (Node* n = shiftDown())
    {
        if (n->notVisited(visitedNodes))
        {
            //n->setHeight(height+1);
            deque->push_back(n);
            child.push_back(n);
        }
        else
        {
            delete n;
        }
    }
	
	
    return false;
}
示例#11
0
文件: main.cpp 项目: uetchy/temp_hero
// Game loop
void gameLoop() {
	int c; // char

	// Init frames
	Frame viewFrame(COLS-2, LINES-2, RFOrientation::TOP_LEFT);
	Frame textFrame(COLS-2, 4, RFOrientation::BOTTOM_LEFT);
	Frame inventoryFrame(18, 4, RFOrientation::BOTTOM_RIGHT);
	Frame statusFrame(15, 4, RFOrientation::TOP_RIGHT);

	int hasText = 0;
	int showedHint = 0;
	int showedNothingMessage = 0;
	plA = player.c_area;
	plX = player.x;
	plY = player.y;

	renderMap(viewFrame, area, &player);
	viewFrame.update();
	renderInventory(&inventoryFrame, &player);
	renderStatus(&statusFrame, &player);

	while(1) {
		c = getch();
		if (c == KEY_UP){
			if (isValid(area, player.c_area, player.x, player.y - 1) &&
					area[player.c_area][player.x][player.y].doorInfo[D_UP] == DC_OPEN &&
					player.direction == D_UP) {
				player.y = player.y - 1;
			}
			player.direction = D_UP;
		} else if (c == KEY_RIGHT){
			if (isValid(area, player.c_area, player.x + 1, player.y) &&
					area[player.c_area][player.x][player.y].doorInfo[D_RIGHT] == DC_OPEN &&
					player.direction == D_RIGHT) {
				player.x = player.x + 1;
			} else if (isValid(area, player.c_area, player.x + 1, player.y) &&
								 area[player.c_area][player.x][player.y].doorInfo[D_RIGHT] == DC_LOCKED &&
								 player.hasKey) {
				area[player.c_area][player.x][player.y].doorInfo[D_RIGHT] = DC_OPEN;
				player.hasKey = 0;
			}
			player.direction = D_RIGHT;
		}else if (c == KEY_DOWN){
			if ( isValid(area, player.c_area, player.x, player.y + 1) && area[player.c_area][player.x][player.y].doorInfo[D_DOWN] == DC_OPEN ) {
				if (player.direction == D_DOWN) {
					player.y = player.y + 1;
				}
			} else if (isValid(area, player.c_area, player.y + 1, player.y) &&
								 area[player.c_area][player.x][player.y].doorInfo[D_DOWN] == DC_LOCKED &&
								 player.hasKey) {
				area[player.c_area][player.x][player.y].doorInfo[D_DOWN] = DC_OPEN;
				player.hasKey = 0;
			}
			player.direction = D_DOWN;
		} else if (c == KEY_LEFT){
			if ( isValid(area, player.c_area, player.x - 1, player.y) && area[player.c_area][player.x][player.y].doorInfo[D_LEFT] == DC_OPEN ) {
				if (player.direction == D_LEFT) {
					player.x = player.x - 1;
				}
			}
			player.direction = D_LEFT;
		}

		hasText = 0;

		// Render view
		if (c == 'z') {
			textFrame.clear();
			if (area[player.c_area][player.x][player.y].hasKey) {
				textFrame.println("キーを見つけた...!");
				hasText = 1;
				player.hasKey = 1;
				area[player.c_area][player.x][player.y].hasKey = 0;
			} else if (area[player.c_area][player.x][player.y].hint != "" && !showedHint) {
				textFrame.println("ヒントを見つけた...\n");
				textFrame.println(area[player.c_area][player.x][player.y].hint.c_str());
				showedHint = 1;
				showedNothingMessage = 1;
				hasText = 1;
			} else if (area[player.c_area][player.x][player.y].hasPotion && player.hasPotion) {
				textFrame.println("ポーション見つけたが、持てない...");
				hasText = 1;
			} else if (area[player.c_area][player.x][player.y].hasPotion) {
				textFrame.println("ポーション見つけた...!");
				hasText = 1;
				player.hasPotion = 1;
				area[player.c_area][player.x][player.y].hasPotion = 0;
			} else if (area[player.c_area][player.x][player.y].canJump) {
				viewFrame.move(0, 0);
				viewFrame.print(filledWith(viewFrame, "□"), 10);
				player.c_area = 1;
				player.x = 7;
				player.y = 2;
			} else if (!showedNothingMessage) {
				textFrame.println("何も無いようだ...");
				showedNothingMessage = 1;
				hasText = 1;
			} else {
				showedNothingMessage = 0;
				hasText = 0;
				showedHint = 0;
			}
		} else if (c == 's') {
			textFrame.clear();
			if (player.hasPotion) {
				textFrame.println("ポーション使う...?");
				textFrame.println("z = はい");
				textFrame.println("x = いいえ");
				while(1) {
					c = getch();
					if (c == 'z') {
						textFrame.clear();
						textFrame.println("ポーション使いました...");
						textFrame.println("HP全回しました");
						player.hp = 15;
						hasText = 1;
						player.hasPotion = 0;
						break;
					} else if (c == 'x'){
						textFrame.clear();
						textFrame.println("ポーション使うのをやめた...");
						textFrame.println("HP全回しました、なんてウソです");
						hasText = 1;
						break;
					}
				}
			} else if (!player.hasPotion) {
				textFrame.println("ポーションない...");
				hasText = 1;
			}
		}

		area[player.c_area][player.x][player.y].playerVisited = 1;

		renderMap(viewFrame, area, &player);
		viewFrame.update();
		if (hasText) textFrame.update();

		renderInventory(&inventoryFrame, &player);
		renderStatus(&statusFrame, &player);

		// 前回描画した時からプレイヤーは移動したか?
		if (isPlayerMoved(plA, plX, plY, player.c_area, player.x, player.y)) {
			// Zakoがいるなら戦闘
			int eob = checkEncountGauge(&viewFrame, &inventoryFrame, &statusFrame);
			if (eob == EOB_PLAYER_LOST) {
				gameOver(&viewFrame);
				return;
			}
		}

		// 特殊ボス会敵
		if (area[player.c_area][player.x][player.y].uniqueBossId == 1 && !player.beatenHBoss) {
			int eob = battleSequence(&viewFrame);
			if (eob == EOB_PLAYER_LOST) {
				gameOver(&viewFrame);
				return;
			} else if (eob == EOB_PLAYER_BEATEN_BOSS) {
				gameWon(&viewFrame);
				return;
			}
		} else if (area[player.c_area][player.x][player.y].uniqueBossId == 0) {
			int eob = battleSequence(&viewFrame);
			if (eob == EOB_PLAYER_LOST) {
				gameOver(&viewFrame);
				return;
			} else if (eob == EOB_PLAYER_BEATEN_BOSS) {
				gameWon(&viewFrame);
				return;
			}
		}

		plA = player.c_area;
		plX = player.x;
		plY = player.y;
	}
}
示例#12
0
void FlowContextController::stableRatioChanged(double ratio)
{
    const double EPS = 1E-8;
    if (ratio > 1 - EPS)
        emit gameWon();
}
示例#13
0
BOOL Game::update()
{
	BOOL updateObjects = FALSE;
	BOOL checkForWinning = FALSE;
	BOOL checkForLosing = FALSE;
	BOOL checkCollisions = FALSE;
	BOOL stopMovement = TRUE;

	switch (itsCurrentState)
	{
		case GAMESTATE_PREGAME :
			// since the pregame section is so different, we will call our own method
			pregameUpdate();
			break;
		case GAMESTATE_INPROGRESS :
			updateObjects = TRUE;
			checkForWinning = TRUE;
			checkForLosing = TRUE;
			checkCollisions = TRUE;
			stopMovement = FALSE;
			break;
		case GAMESTATE_WON :
		{
			updateObjects = TRUE;
			Room *room = itsPlayer->getRoom();
			// we need to change the walls a color for that ending flashiness
			if (itsLastTickTime - itsWinTime >= theWinAnimationLength)
			{	
				for (UINT i=0;i<room->getWalls()->length();i++)
				{
					Wall *wall = (Wall *)(room->getWalls()->elementAt(i));
					wall->setChangesColor(FALSE);
				}
			}
			else
			{
				// since the player will be holding the chalice, we can tell
				// the walls to change colors, and they will change to the color
				// of the chalice, which will make them appear to animate
				for (UINT i=0;i<room->getWalls()->length();i++)
				{
					Wall *wall = (Wall *)(room->getWalls()->elementAt(i));
					wall->setChangesColor(TRUE,1);
				}
			}
			// hack to put the player in the right place for the ending
			itsPlayer->setX(Game::theScreenHeight-64);
			itsPlayer->setY(Game::theScreenWidth/2-16);
		}
		break;
		case GAMESTATE_LOST :
			updateObjects = TRUE;
			stopMovement = FALSE;
			break;
		case GAMESTATE_PAUSED :
			stopMovement = FALSE;
			break;
	}

	theEventDispatcher.update(itsLastTickTime);


	if (updateObjects)
	{
		SimpleArray *objects = NULL;
		if (itsWorld != NULL)
		objects = itsWorld->getObjects();
		for (UINT i=0;i<objects->length();i++)
		{
			((GameObject *)(objects->elementAt(i)))->update(itsLastTickTime);
			if (stopMovement)
			{
				((GameObject *)(objects->elementAt(i)))->stopMoving(itsLastTickTime);
			}
		}
		for (i=0;i<itsWorld->getRooms()->length();i++)
		{
			((Room *)(itsWorld->getRooms()->elementAt(i)))->checkForObjectsLeaving();
		}
	}
	if (checkForWinning && gameWon())
	{
		itsNewStateRequest.itsNewState = GAMESTATE_WON;
		itsNewStateRequest.isActiveRequest = TRUE;
	}
	if (checkForLosing && gameLost())
	{
		itsNewStateRequest.itsNewState = GAMESTATE_LOST;
		itsNewStateRequest.isActiveRequest = TRUE;
	}
	if (checkCollisions)
		return checkForCollisions();
	else
		return TRUE;
}
示例#14
0
void GameShell::action()
{
    loadMap();
    bob.draw(screen);
    zombie.draw(screen);
    updateLifebar(screen);
    refresh();
    bool playing = true; // is the player alive?
    while(true)
    {
        int start = SDL_GetTicks();
        actions.handleEvents();
        if(playing == false)
        {
            if(actions.exitGame() == true)
            {
                break;
            }
        }
        else
        {
            if(actions.exitGame() == true)
            {
                break;
            }

            else
            if(actions.direction.x != 0 || actions.direction.y != 0)
            {
                if(col->detect(bob.coord, actions.direction, tiles) == false)
                {
                    repaintTile(bob.coord);
                    bob.move(actions.direction, screen);
                    repaintTile(zombie.coord);
                    if(bob.coord.x == exit.x && bob.coord.y == exit.y)
                    {
                        gameWon();
                        playing = false;
                    }

                    else
                    {
                        if(near_exit(bob) == true || near_player(bob) == true) // The zombie will start the chase
                        {
                            int zombie_old_x = zombie.coord.x;
                            int zombie_old_y = zombie.coord.y;
                            Tile* t = findPath(tiles[0][(zombie.coord.x + zombie.coord.y * (SCREEN_WIDTH / TILE_WIDTH))/32],
                                       tiles[0][(bob.coord.x + bob.coord.y * (SCREEN_WIDTH / TILE_WIDTH))/32]);


                            if (t == NULL)
                                std::cout << "t e NULL :(\n";
                            else
                            {
                                // update zombie coordinates
                                zombie.coord.x = t->coord.x;
                                zombie.coord.y = t->coord.y;
                                std::cout<< "PREV COORDS: X = " <<zombie_old_x<<" | Y = "<<zombie_old_y<<"\n";
                                std::cout<< "NEW COORDS: X = " <<zombie.coord.x<<" | Y = "<<zombie.coord.y<<"\n";


                                // set the frame according to the direction
                                if(zombie.coord.x - zombie_old_x == TILE_WIDTH)
                                {
                                    zombie.last_frame = 1;
                                    std::cout<<"RIGHT\n";
                                }
                                else
                                if(zombie.coord.x - zombie_old_x == -TILE_WIDTH)
                                {
                                    zombie.last_frame = 3;
                                    std::cout<<"LEFT\n";
                                }
                                else
                                if(zombie.coord.y - zombie_old_y == -TILE_HEIGHT)
                                {
                                    zombie.last_frame = 0;
                                    std::cout<<"UP\n";
                                }
                                else
                                if(zombie.coord.y - zombie_old_y == TILE_HEIGHT)
                                {
                                    zombie.last_frame = 2;
                                    std::cout<<"DOWN\n";
                                }
                            }
                        }

                        else // The zombie will patrol
                        {
                            SDL_Rect temp = zombie.move(screen);
                            repaintTile(zombie.coord);

                            if (col->detect(zombie.coord, temp, tiles) == false)
                            {
                                zombie.coord.x += temp.x * TILE_WIDTH;
                                zombie.coord.y += temp.y * TILE_HEIGHT;
                            }
                        }

                        zombie.draw(screen);
                        bob.draw(screen);

                        // zombie attacks the player
                        if(bob.coord.x == zombie.coord.x && bob.coord.y == zombie.coord.y)
                        {
                            deductHealth(zombie.damage);
                            // repair the 3 tiles which are under the lifebar
                            SDL_Rect repair;
                            repair.x = (SCREEN_WIDTH - BAR_WIDTH) / 2 - 14;
                            repair.y = 0;
                            for(int i = 0; i < 4; i++)
                            {
                                repaintTile(repair);
                                repair.x += TILE_WIDTH;
                            }

                            // update the player's lifebar
                            updateLifebar(screen);
                        }
                    }
                }

                refresh();
            }

            else
            {
                if(actions.use_item == true)
                {
                    if (bob.inventory.cursor != NULL)
                    {
                        bob.inventory.cursor->val->use(bob);
                        bob.inventory.Delete();
                        if (bob.inventory.cursor != NULL)
                            bob.inventory.draw(bkgtiles, tileset, screen, bob.inventory.cursor->val->type);
                        else
                            bob.inventory.draw(bkgtiles, tileset, screen, 9);
                    }

                    updateLifebar(screen);
                }

                if(actions.left_inv_arrow == true && bob.inventory.cursor != NULL)
                {
                    bob.inventory.moveLeft(bkgtiles, tileset, screen);
                    bob.inventory.draw(bkgtiles, tileset, screen, bob.inventory.cursor->val->type);
                }

                if(actions.right_inv_arrow == true && bob.inventory.cursor != NULL)
                {
                    bob.inventory.moveRight(bkgtiles, tileset, screen);
                    bob.inventory.draw(bkgtiles, tileset, screen,  bob.inventory.cursor->val->type);
                }

                refresh();

                int layer_numb = layerNumber - 1;
                int tile_numb = bob.coord.y / 32 * 20 + (bob.coord.x / 32);
                if((tiles[layer_numb][tile_numb])->hasItem() == true)
                {
                    bob.pick(tiles[layer_numb][tile_numb]);
                    int type = (tiles[layer_numb][tile_numb])->type;
                    (tiles[layer_numb][tile_numb])->type = TRANSPARENCY;

                    repaintTile((tiles[layer_numb][tile_numb])->coord);
                    bob.draw(screen);

                    SDL_Rect dest;
                    dest.x = 14 * TILE_WIDTH;
                    dest.y = 0;
                    repaintTile(dest);

                    bob.inventory.draw(bkgtiles, tileset, screen, type);
                    refresh();
                }
            }


            actions.reset();
        }

        if(bob.health <= 0 && playing == true)
        {
            SDL_Rect bloodpos;
            bloodpos.x = bloodpos.y = 0;
            bloodpos.w = bloodpos.h = TILE_HEIGHT;
            repaintTile(zombie.coord);
            zombie.draw(screen);
            SDL_BlitSurface(tileset, &bkgtiles[5], screen, &zombie.coord);
            gameOver();
            playing = false;
            refresh();
        }

        if(1000/FPS > SDL_GetTicks() - start)
        {
            SDL_Delay(1000/FPS - (SDL_GetTicks() - start));
        }
    }
}