• 大小: 35KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-20
  • 语言: C/C++
  • 标签: C++小游戏  C++  RPG  

资源简介

VS2013 C++小游戏,类型是RPG可以打怪升级做任务

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “Fight.h“

CFight::CFight()
{
m_pFightMonster = NULL;
m_pFightPlayer = NULL;

m_iFightButton = 0;
m_iFightState = PEACE;

m_iPlayerAnimation = ZERO;
m_iMonsterCry = ZERO;
m_iRecovery = ZERO;
m_iMonsterFight = ZERO;

m_iFightBagButton = 0;
m_iFightSpellButton = 0;
m_iFightFace = COMBATINTERFACE;

m_bFightAckSpell = false;
m_iSpellAre = 0;
}
CFight::~CFight()
{
}
//获取玩家和怪物
void CFight::setPlayerMonster(CGamePlayer *pPlayer CMonster *pMonster)
{
m_pFightMonster = pMonster;

m_pFightMonster->m_iHpBk = m_pFightMonster->m_iHp;

m_pFightPlayer = pPlayer;
}
//战斗渲染
void CFight::RenderFight()
{
if (m_iFightFace == COMBATINTERFACE)
{
ButtonAttRender();
}
//战斗背包
else if (m_iFightFace == BAGINTERFACE)
{
ButtonBagRender(m_pFightPlayer->m_pPlayerBag);
}
//战斗技能
else if (m_iFightFace == SKILLINTERFACE)
{
ButtonSkillRender(m_pFightPlayer->getVecSpell());
}
}
//战斗数据更新
void CFight::updata()
{
if (m_iFightFace == COMBATINTERFACE)
{
ButtonAttUpdata();
}
else if (m_iFightFace == BAGINTERFACE)
{
ButtonBagUpdata();
}
else if (m_iFightFace == SKILLINTERFACE)
{
ButtonSkillUpdata(m_pFightPlayer->getVecSpell());
}
}

//攻击渲染
void CFight::ButtonAttRender()
{
cout << “怪物信息:“ << endl;
cout << “Name“ << “ “ << “Hp“ << “ “ << “Mp“ << “ “
<< “Ack“ << “ “ << “Def“ << endl;

cout << m_pFightMonster->m_cName << “ “ << m_pFightMonster->m_iHp << “ “ << m_pFightMonster->m_iMp << “ “
<< m_pFightMonster->m_iAck << “ “ << m_pFightMonster->m_iDef << endl;

if (m_iFightState == PEACE)
{
Fight();
}
else if (m_iFightState == FIGHT)
{
m_iPlayerAnimation++;
if (m_iPlayerAnimation >= ZERO && m_iPlayerAnimation <= TEN)
{
if (m_bFightAckSpell == false)
{
FightPeace();
}
else
{
FightSpell();
}

}
else if (m_iPlayerAnimation >= 11 && m_iPlayerAnimation <= 20)
{
if (m_bFightAckSpell == false)
{
FightPlayer();
}
else
{
FightSpellTwo();
}
}
else if (m_iPlayerAnimation >= 21)
{
if (m_bFightAckSpell == false)
{
FightPlayerAtt();
}
else
{
FightSpellThree();
}
}
}
else if (m_iFightState == INJURED)
{
m_iMonsterCry++;
m_iRecovery++;
FightMonsterErr();
}
else if (m_iFightState == MONSTERFIGHT)
{
m_iMonsterFight++;
FightMonsterAtt();
}

if (m_iFightButton == FIGHT_ACK)
{
cout << “■                                                                                ■“ << endl;
cout << “■         → 攻击                                技能                            ■“ << endl;
cout << “■                                                                                ■“ << endl;
cout << “■            背包                                逃跑                            ■“ << endl;
cout << “■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■“ << endl;
}
else if (m_iFightButton == 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3157  2018-09-05 20:35  RPG3.0\RPG3.0\data\map.txt

     文件        411  2018-09-11 09:45  RPG3.0\RPG3.0\data\monster.txt

     文件        806  2018-09-07 09:41  RPG3.0\RPG3.0\data\npc.txt

     文件        171  2018-09-13 10:41  RPG3.0\RPG3.0\data\pet.txt

     文件       1379  2018-09-12 15:35  RPG3.0\RPG3.0\data\prop.txt

     文件        541  2018-09-11 10:31  RPG3.0\RPG3.0\data\task.txt

     文件      37380  2018-09-13 16:01  RPG3.0\RPG3.0\Fight.cpp

     文件       1521  2018-09-12 10:47  RPG3.0\RPG3.0\Fight.h

     文件       2875  2018-09-13 14:19  RPG3.0\RPG3.0\GameDialog.cpp

     文件        370  2018-09-06 19:46  RPG3.0\RPG3.0\GameDialog.h

     文件       6084  2018-09-13 14:59  RPG3.0\RPG3.0\GameMap.cpp

     文件        869  2018-09-10 16:07  RPG3.0\RPG3.0\GameMap.h

     文件       3522  2018-09-12 14:25  RPG3.0\RPG3.0\GameMenu.cpp

     文件        149  2018-09-05 12:32  RPG3.0\RPG3.0\GameMenu.h

     文件        691  2018-09-06 20:42  RPG3.0\RPG3.0\GameMgr.cpp

     文件        267  2018-09-06 20:42  RPG3.0\RPG3.0\GameMgr.h

     文件       2745  2018-09-13 10:23  RPG3.0\RPG3.0\GamePlayer.cpp

     文件       2378  2018-09-13 14:03  RPG3.0\RPG3.0\GamePlayer.h

     文件       2060  2018-09-11 10:46  RPG3.0\RPG3.0\GamePlayer_Attr.cpp

     文件       3471  2018-09-13 13:34  RPG3.0\RPG3.0\GamePlayer_Bag.cpp

     文件       1728  2018-09-10 10:23  RPG3.0\RPG3.0\GamePlayer_Equ.cpp

     文件       3892  2018-09-13 15:58  RPG3.0\RPG3.0\GamePlayer_Pet.cpp

     文件       1620  2018-09-12 09:45  RPG3.0\RPG3.0\GamePlayer_Spell.cpp

     文件       1599  2018-09-12 09:33  RPG3.0\RPG3.0\GamePlayer_Task.cpp

     文件       4101  2018-09-14 08:52  RPG3.0\RPG3.0\GameShop.cpp

     文件        631  2018-09-13 14:53  RPG3.0\RPG3.0\GameShop.h

     文件       1886  2018-09-13 14:55  RPG3.0\RPG3.0\GameShop_Sell.cpp

     文件        609  2018-09-11 10:23  RPG3.0\RPG3.0\Monster.cpp

     文件        446  2018-09-11 10:16  RPG3.0\RPG3.0\Monster.h

     文件       1584  2018-09-11 09:49  RPG3.0\RPG3.0\MonsterMgr.cpp

............此处省略31个文件信息

评论

共有 条评论