Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
RogueLegends/GamePanel.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (28 sloc)
736 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "GamePanel.h" | |
#include <iostream> | |
#include <conio.h> | |
//set up the game | |
GamePanel::GamePanel(string levelFileName) { | |
//Initialize the player stats | |
_player.init(1, 100, 20, 10, 0); | |
//load the level [map] | |
_level.load(levelFileName, _player); | |
printf("%s was loaded!\n", levelFileName.c_str()); | |
system("PAUSE"); | |
} | |
void GamePanel::playGame() { | |
bool isDone = false; | |
while (isDone != true) { | |
//prints the lvl | |
_level.print(); | |
//get player input | |
playerMove(); | |
} | |
} | |
//player input in order to move around | |
void GamePanel::playerMove() { | |
char input; | |
std::cout<<("Enter a move command (w/s/a/d): ")<<std::endl; | |
input = _getch(); | |
_level.movePlayer(input, _player); | |
} |