GameWorld.cpp
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#include "stdafx.h"
// 常数定义
const int GameWorld::Width=640;
const int GameWorld::Height=480;
const int GameWorld::MsPerFrame=20;
const double GameWorld::PI=3.1415926535897932;
// 构造函数
GameWorld::GameWorld(HWND hwnd)
:GameWindow(hwnd)
{
Time=GetTickCount();
ZeroMemory(&FPS, sizeof(FPS));
FPS.LastTime = Time;
kFPS = 1.0;
srand(time(0));
BufKey=0;
CurKey=0;
Level = 1;
pScreen = new Display(this);
pPlayer = new Player(this, Width/2, Height/2);
pPlayerBulletSystem = new BulletSystem(this);
pEnermyBulletSystem = new BulletSystem(this);
pEnermySystem = new EnermySystem(this);
pCollisionSystem = new CollisionSystem(this);
}
// 释构函数
GameWorld::~GameWorld()
{
delete pScreen;
}
// 刷新游戏
void GameWorld::Update()
{
int t=GetTickCount();
if( t-Time < MsPerFrame )
return;
Time=t;
// 难度升级
if(pPlayer->Score >= Level*300)
{
pEnermySystem->AddDifficulty();
Level++;
}
// 清空屏幕
pScreen->Clear();
pCollisionSystem->Update();
pEnermyBulletSystem->Update();
pPlayerBulletSystem->Update();
pEnermySystem->Update();
pPlayer->Update();
后面还有 131 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
