#include <ctime>
#include <iostream>
#include "windows.h"
using namespace std;
class Game {
public:
void Move ( );
void MoveGo ( );
void SetConsole ( int ic_x, int ic_y );
int Random ( int ic_numberA, int ic_numberB );
Game ( int ic_window_width, int ic_window_heigth, int ic_speed );
~Game ( );
private:
int i_window_width,
i_window_height,
i_window_right,
i_window_down,
i_random_x,
i_random_y,
i_formerly_x,
i_formerly_y,
i_direction_id,
i_speed;
};
int main ( ) {
system ( "mode con cols=100 lines=30" );
srand ( time ( NULL ) );
Game game ( 100, 30, 10 );
game.MoveGo ( );
return 0;
}
Game::Game ( int ic_window_width, int ic_window_height, int ic_speed ) {
i_window_width = ic_window_width;
i_window_height = ic_window_height;
i_window_right = i_window_width - 1;
i_window_down = i_window_height - 1;
i_random_x = Random ( 0, i_window_right );
i_random_y = Random ( 0, i_window_down );
i_direction_id = Random ( 1, 4 );
i_speed = ic_speed;
}
Game::~Game ( ) {
}
int Game::Random ( int ic_numberA, int ic_numberB ) {
return ic_numberA + rand
C++【观察系列】混乱的“蜜蜂”
最新推荐文章于 2023-05-10 23:48:58 发布