complete head file

master
bridgeL 6 years ago
parent 5117b704d7
commit ac6228fb52

@ -0,0 +1,19 @@
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\vc142.pdb
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\vc142.idb
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\player.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\mover.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\monster.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\map.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\game.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\app.obj
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\debug\projectfinal1.pdb
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\cl.command.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\cl.read.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\cl.write.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link-cvtres.read.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link-cvtres.write.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link-rc.read.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link-rc.write.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link.command.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link.read.1.tlog
e:\2019 编程语言学习\c\2019\c++课程学习\eatbean\projectfinal2\projectfinal1\debug\projectfinal1.tlog\link.write.1.tlog

@ -0,0 +1,2 @@
 game.cpp
ProjectFinal1.vcxproj -> E:\2019 编程语言学习\C\2019\C++课程学习\eatbean\ProjectFinal2\Debug\ProjectFinal1.exe

@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0
Debug|Win32|E:\2019 编程语言学习\C\2019\C++课程学习\eatbean\ProjectFinal2\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -125,6 +125,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="app.cpp" /> <ClCompile Include="app.cpp" />
<ClCompile Include="game.cpp" /> <ClCompile Include="game.cpp" />
<ClCompile Include="map.cpp" />
<ClCompile Include="monster.cpp" /> <ClCompile Include="monster.cpp" />
<ClCompile Include="mover.cpp" /> <ClCompile Include="mover.cpp" />
<ClCompile Include="player.cpp" /> <ClCompile Include="player.cpp" />

@ -30,6 +30,9 @@
<ClCompile Include="monster.cpp"> <ClCompile Include="monster.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="map.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="game.h"> <ClInclude Include="game.h">

@ -14,3 +14,5 @@
#define MONSTER_ESCAPE_STATUS 100 #define MONSTER_ESCAPE_STATUS 100
#define MAP_POINT_SIZE 10 #define MAP_POINT_SIZE 10
#define MOVER_SIZE 10

@ -2,12 +2,24 @@
#include "game.h" #include "game.h"
#include "define.h" #include "define.h"
Game::Game()
{
}
void Game::Load() void Game::Load()
{ {
Start(); Start();
End(Loop()); End(Loop());
} }
void Game::Start()
{
}
void Game::End(bool result)
{
}
bool Game::Loop() bool Game::Loop()
{ {
char key; char key;
@ -55,6 +67,23 @@ bool Game::Loop()
return false; return false;
} }
void Game::Pause()
{
// 暂停界面
char key;
while (1)
{
key = GetKey();
if (key == 'p')
break;
}
// 恢复之前界面
}
char Game::GetKey() char Game::GetKey()
{ {
char key = 0; char key = 0;

@ -17,7 +17,6 @@ public:
// сно╥╪сть // сно╥╪сть
void Load(); void Load();
private:
// сно╥©╙й╪╫ГцФ // сно╥©╙й╪╫ГцФ
void Start(); void Start();

@ -0,0 +1,44 @@
#include "map.h"
#include "define.h"
Map::Map()
{
loadimage(&img, _T("default_map.png"), MAP_POINT_SIZE, MAP_POINT_SIZE, true);
for (int i = 0; i < MAP_WIDTH; i++)
{
for (int j = 0; j < MAP_HEIGHT; j++)
{
map[i * MAP_HEIGHT + j] = false;
}
}
}
bool Map::GetOnePoint(int x, int y)
{
return false;
}
void Map::SetOnePoint(int x, int y)
{
}
void Map::SetImage(IMAGE _img)
{
}
void Map::ClearOnePoint(int x, int y)
{
}
bool Map::IsEmpty()
{
return false;
}
void Map::DrawOnePoint(int x, int y)
{
}
void Map::DrawAllPoint()
{
}

@ -1,6 +1,41 @@
#include "monster.h" #include "monster.h"
#include "define.h" #include "define.h"
Monster::Monster()
{
status = 0;
}
int Monster::GetStatus()
{
return status;
}
void Monster::SetStatus(int _status)
{
status = _status;
}
bool Monster::TryEatPlayer(Player player)
{
double px, py;
px = player.GetX();
py = player.GetY();
if (px - x < 0.1 && px - x > -0.1 &&
py - y < 0.1 && py - y > -0.1) // ÅжϹÖÎïÊÇ·ñÓöµ½Íæ¼Ò
{
if (status == 0)
return true;
else if (status > 0)
{
player.EatMonster();
status = -1;
}
}
return false;
}
void Monster::MonsterMove(const Map& wall, Player player, const Map& bean, const Map& goldBean) void Monster::MonsterMove(const Map& wall, Player player, const Map& bean, const Map& goldBean)
{ {
int dir; int dir;
@ -25,6 +60,18 @@ void Monster::MonsterMove(const Map& wall, Player player, const Map& bean, const
// .... // ....
} }
int Monster::Chase(const Map& wall, Player player)
{
return 0;
}
int Monster::Escape(const Map& wall, Player player) int Monster::Escape(const Map& wall, Player player)
{ {
int dir = Chase(wall, player); int dir = Chase(wall, player);
@ -41,3 +88,14 @@ int Monster::Escape(const Map& wall, Player player)
return dir; return dir;
} }
int Monster::WaitingBorn(const Map& wall)
{
return 0;
}

@ -3,4 +3,79 @@
void Mover::Move(int dir) void Mover::Move(int dir)
{ {
if (dir == DIR_NONE)
return;
ClearDraw();
switch (dir)
{
case DIR_UP: y -= speed; break;
case DIR_DOWN: y += speed; break;
case DIR_LEFT: x -= speed; break;
case DIR_RIGHT: x += speed; break;
}
Draw();
}
void Mover::NextXY(int dir, double& nx, double& ny)
{
nx = x;
ny = y;
switch (dir)
{
case DIR_UP: ny -= speed; break;
case DIR_DOWN: ny += speed; break;
case DIR_LEFT: nx -= speed; break;
case DIR_RIGHT: nx += speed; break;
}
}
void Mover::Draw()
{
}
void Mover::ClearDraw()
{
}
Mover::Mover()
{
loadimage(&img, _T("default_mover.png"), MOVER_SIZE, MOVER_SIZE, true);
x = 1;
y = 1;
speed = 0.1;
}
double Mover::GetX()
{
return x;
}
double Mover::GetY()
{
return y;
}
double Mover::GetSpeed()
{
return speed;
}
void Mover::SetXY(double _x, double _y)
{
x = _x;
y = _y;
}
void Mover::SetSpeed(double _speed)
{
speed = _speed;
}
void Mover::SetImage(IMAGE _img)
{
img = _img;
} }

@ -4,7 +4,7 @@
class Mover class Mover
{ {
private: protected:
IMAGE img; IMAGE img;
double x, y; double x, y;
double speed; double speed;

@ -1 +1,38 @@
#include "player.h" #include "player.h"
Player::Player()
{
score = 0;
}
int Player::GetScore()
{
return 0;
}
void Player::SetScore(int _score)
{
}
bool Player::PlayerMove(const Map& wall, int dir)
{
return false;
}
bool Player::TryEatBean(Map& bean)
{
return false;
}
bool Player::TryEatGoldBean(Map& goldBean)
{
return false;
}
void Player::EatMonster()
{
}
void Player::DrawScore()
{
}

@ -21,6 +21,7 @@ public:
// 根据当前位置判断是否能吃到豆子若能吃到增加自己的得分清除掉被删除的豆子并返回true // 根据当前位置判断是否能吃到豆子若能吃到增加自己的得分清除掉被删除的豆子并返回true
bool TryEatBean(Map& bean); bool TryEatBean(Map& bean);
bool TryEatGoldBean(Map& goldBean); bool TryEatGoldBean(Map& goldBean);
void EatMonster();
void DrawScore(); void DrawScore();

Loading…
Cancel
Save