失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > C++/数据结构——课程设计——回合制对战小游戏

C++/数据结构——课程设计——回合制对战小游戏

时间:2019-04-15 22:21:23

相关推荐

C++/数据结构——课程设计——回合制对战小游戏

数据结构的课程设计,基于easyx绘图库做的一个回合制对战小游戏。

easyx安装教程:Easyx库安装教程_我叫RT的博客-CSDN博客_easyx怎么安装/weixin_43919932/article/details/102996507系统流程图:

流程图

运行截图:

素材文件:

素材文件留言私发

源码:

//main.cpp如下:#pragma warning(disable : 4996)#include<iostream>#include<Windows.h>#include <conio.h>#include<graphics.h>#include<mmsystem.h>//多媒体设备借口头文件#include<stdlib.h>#include"LuFu.h"#include"SaQi.h"#include"Skill_Action.h"#pragma comment(lib,"winmm.lib")//加载静态库#define MAXSIZE 50using namespace std;struct Hero_date{int HP_a = -1;int MP_a = -1;int State_a = -1;int HP_b = -1;int MP_b = -1;int State_b = -1;};typedef struct Stack{Hero_date Date[MAXSIZE];int Top=0;}Hero_Stack;//声明-------------------------------void InitWind();//初始化窗口void Turn_Protract(int Num);void Ui_Protract(IMAGE& UI,SaQi& Hero_1,LuFu& Hero_2);int GetMouse(SaQi& Hero);void Music_Loding();void Bgm(int Bgm_Num, bool Repeat_key);void AI_Enemy(LuFu & Hero, SaQi& Hero_1,Skill_Action& S);void Turn_Back(Hero_Stack & L,SaQi & Hero_1,LuFu & Hero_2);void Exit_();//栈bool S_Empty(Hero_Stack& L);bool S_Full(Hero_Stack& L);void S_Push(Hero_Stack& L, int HP_a, int MP_a, int State_a, int HP_b, int MP_b, int State_b);void S_Pop(Hero_Stack& L);Hero_date Get_S_Date(Hero_Stack& L);int Time = 0;Hero_date Hero_Save;int main(){fflush(stdin);//创建窗口InitWind();Music_Loding();Bgm(1, true);//变量定义int Turn = 0;bool Turn_Key = false;IMAGE Ui_1;IMAGE Bei_Jing;Skill_Action Skill;SaQi Hero_1;LuFu Hero_2;//对象Hero_Stack L;//栈 用来保存cout << endl << endl;//加载背景loadimage(&Ui_1, _T("./material/menu/ui界面.jpg"), 1280, 720);loadimage(&Bei_Jing, _T("./material/menu/1.jpg"), 1280, 720);putimage(0, 0, &Ui_1);S_Push(L, Hero_1.GetHP(), Hero_1.GetMP(), Hero_1.GetState(), Hero_2.GetHP(), Hero_2.GetMP(), Hero_2.GetState());while (true)//主循环--------------------{if (Turn_Key){if (L.Top!=1){Turn_Back(L, Hero_1, Hero_2);Turn--;cout << endl;}else{cout << "时空摆锤还未落下,回溯失败......" << endl;}Turn_Key = false;}BeginBatchDraw();//双缓冲绘图Ui_Protract(Ui_1, Hero_1, Hero_2);//主体UI绘制Turn_Protract(Turn);//回合数绘制EndBatchDraw();//结束缓冲if (!Hero_1.GetDeath() || !Hero_2.GetDeath()){Hero_2.GetDeath() ? cout << endl << "挑战失败,游戏结束!" << endl : cout << "挑战成功,游戏结束!";Exit_();}else if(!Hero_1.GetState()&&Hero_1.GetDeath()&&Hero_2.GetDeath()){switch (GetMouse(Hero_1)){case 1:if (Hero_1.GetMP() >= 10){Hero_2.HitHP(Hero_1.A_1_Judgment());Skill.A_Skill_Protract(11, 1);}else{cout << Hero_1.GetName() << "用尽了全力 但是 无事发生......" << endl;}break;case 2:if (Hero_1.GetMP() >= 30){Hero_2.HitHP(Hero_1.A_2_Judgment());//Hero_1.TickAttack(Hero_2.Get_X() + 200, Hero_2.Get_Y());Hero_2.SetState(1);//麻痹 1Skill.A_Skill_Protract(7, 3);}else{cout << Hero_1.GetName() << "用尽了全力 但是 无事发生......" << endl;}break;case 3:if (Hero_1.GetMP() >= 10 && Hero_1.GetHP() > 20){Hero_2.HitHP(Hero_1.A_3_Judgment());//Hero_1.TickAttack(Hero_2.Get_X() + 200, Hero_2.Get_Y());Skill.A_Skill_Protract(8, 2);}else{cout << Hero_1.GetName() << "用尽了全力 但是 无事发生......" << endl;}break;case 4:if (Hero_1.GetHP() > 20){//待定Hero_1.A_4_Judement();Skill.A_Skill_Protract(8, 4);}else{cout << Hero_1.GetName() << "用尽了全力 但是 无事发生......" << endl;}break;case 5:cout << Hero_1.GetName() << "使用" << "【红色药剂】" << endl;Hero_1.AddHP(50);break;case 6:cout << Hero_1.GetName() << "使用" << "【蓝色色药剂】" << endl;Hero_1.AddMP(50);break;case 7:Turn_Key = true;break;case 8:cout << "逃跑成功!" << endl;Exit_();break;default:break;}}else{cout << Hero_1.GetName() << "被眩晕了" << "无法战斗" << endl;Hero_1.SetState(0);}BeginBatchDraw();//双缓冲绘图Ui_Protract(Ui_1, Hero_1, Hero_2);//主体UI绘制Hero_1.Prop_1(false);Hero_1.Prop_2(false);Hero_1.Prop_3(false);Hero_1.Prop_4(false);Turn_Protract(Turn);//回合数绘制EndBatchDraw();//结束缓冲if (Hero_1.GetDeath() && Hero_2.GetDeath()&&!Turn_Key) {AI_Enemy(Hero_2, Hero_1, Skill);//敌人ai}if (!Turn_Key){Turn++;}cout << "栈顶信息:" <<L.Top<<" " << L.Date[L.Top - 1].HP_a << " " << L.Date[L.Top - 1].MP_a << " " << L.Date[L.Top - 1].HP_b << " " << L.Date[L.Top - 1].MP_b << " " << L.Date[L.Top - 1].State_a << " " << L.Date[L.Top - 1].State_b << endl;if (!Turn_Key){S_Push(L, Hero_1.GetHP(), Hero_1.GetMP(), Hero_1.GetState(), Hero_2.GetHP(), Hero_2.GetMP(), Hero_2.GetState());cout << "回合:" << Turn << endl;}cout << "......" << endl << endl;if (!Hero_2.GetDeath()){cout << Hero_2.GetName() << "受到了致命一击,挣扎着缓慢站起,嘴边呼着忽短忽长的热气,踉跄的走了几步,但是终究还是倒下了...... 远处落日的余晖也已经走到半山腰了......" << endl;}}fflush(stdin);return 0;}//初始化窗口void InitWind(){initgraph(1280, 720, EW_SHOWCONSOLE);//显示dos与创建窗口 窗口为280*720 //system("mode con cols=60 lines=20");//设置dos大小SetConsoleTitle("对局信息");//set dos标题MoveWindow(GetConsoleWindow(), 0, 0, 500, 400, TRUE);//设置dos位置HWND HD = GetHWnd();SetWindowText(HD, "蓝小蓝战记");}//鼠标操作int GetMouse(SaQi & Hero){MOUSEMSG Msg;//结构体flushmessage();while (true){if (MouseHit()){Msg = GetMouseMsg();switch (Msg.uMsg){case WM_MOUSEMOVE:if (Msg.x >= 265 && Msg.y >= 590 && Msg.x <= 440 && Msg.y <= 720){Hero.A_1_Protract_Ui(false);}else{Hero.A_1_Protract_Ui(true);}if (Msg.x >= 460 && Msg.y >= 590 && Msg.x <= 635 && Msg.y <= 720){Hero.A_2_Protract_Ui(false);}else{Hero.A_2_Protract_Ui(true);}if (Msg.x >= 655 && Msg.y >= 590 && Msg.x <= 835 && Msg.y <= 720){Hero.A_3_Protract_Ui(false);}else{Hero.A_3_Protract_Ui(true);}if (Msg.x >= 850 && Msg.y >= 590 && Msg.x <= 1030 && Msg.y <= 720){Hero.A_4_Protract_Ui(false);}else{Hero.A_4_Protract_Ui(true);}if (Msg.x >= 1100 && Msg.y >= 590 && Msg.x <= 1145 && Msg.y <= 645){Hero.Prop_1(true);}else{Hero.Prop_1(false);}if (Msg.x >= 1155 && Msg.y >= 530 && Msg.x <= 1205 && Msg.y <= 590){Hero.Prop_2(true);}else{Hero.Prop_2(false);}if (Msg.x >= 1207 && Msg.y >= 590 && Msg.x <= 1257 && Msg.y <= 645){Hero.Prop_3(true);}else{Hero.Prop_3(false);}if (Msg.x >= 1155 && Msg.y >= 645 && Msg.x <= 1205 && Msg.y <= 700){Hero.Prop_4(true);}else{Hero.Prop_4(false);}break;case WM_LBUTTONDOWN://左键按下Bgm(2, false);if (Msg.x >= 256 && Msg.y >= 590 && Msg.x <= 440 && Msg.y <= 720){return 1;}if (Msg.x >= 460 && Msg.y >= 590 && Msg.x <= 635 && Msg.y <= 720){return 2;}if (Msg.x >= 655 && Msg.y >= 590 && Msg.x <= 835 && Msg.y <= 720){return 3;}if (Msg.x >= 850 && Msg.y >= 590 && Msg.x <= 1030 && Msg.y <= 720){return 4;}if (Msg.x >= 1100 && Msg.y >= 590 && Msg.x <= 1145 && Msg.y <= 645){Sleep(500);Bgm(3, false);return 5;}if (Msg.x >= 1155 && Msg.y >= 530 && Msg.x <= 1205 && Msg.y <= 590){Sleep(500);Bgm(3, false);return 6;}if (Msg.x >= 1207 && Msg.y >= 590 && Msg.x <= 1257 && Msg.y <= 645){Sleep(500);Bgm(3, false);return 7;}if (Msg.x >= 1155 && Msg.y >= 645 && Msg.x <= 1205 && Msg.y <= 700){Sleep(500);Bgm(3, false);return 8;}break;case WM_RBUTTONDOWN:break;default:break;}}}return 0;}void Ui_Protract(IMAGE& UI, SaQi& Hero_1, LuFu& Hero_2){putimage(0, 0, &UI);Hero_1.TickProtract();Hero_2.TickProtract();Hero_1.A_1_Protract_Ui(true);Hero_1.A_2_Protract_Ui(true);Hero_1.A_3_Protract_Ui(true);Hero_1.A_4_Protract_Ui(true);settextcolor(RGB(11, 70, 148));settextstyle(25, 0, "楷体");outtextxy(28, 680, "【蓝小蓝】");}void Turn_Back(Hero_Stack& L, SaQi& Hero_1, LuFu& Hero_2){cout << "时间开始回溯.........但是所有人都产生了不适......" << endl;S_Pop(L);Hero_1.SetHP(L.Date[L.Top-1].HP_a);Hero_1.SetMP(L.Date[L.Top-1].MP_a);Hero_1.SetState(L.Date[L.Top-1].State_a);Hero_2.SetHP(L.Date[L.Top-1].HP_b);Hero_2.SetMP(L.Date[L.Top-1].MP_b);Hero_2.SetState(L.Date[L.Top-1].State_b);}void Turn_Protract(int Num){char Str_Turn[10] = { "\0" };setbkmode(TRANSPARENT);//设置字体背景为透明itoa(Num, Str_Turn, 10);//转换 整形-》字符串 十进制settextstyle(80, 0, "楷体");settextcolor(RGB(0, 120, 215));if (Num>=10){outtextxy(600, 55, Str_Turn);}else{outtextxy(620, 55, Str_Turn);}}void AI_Enemy(LuFu& Hero_2,SaQi & Hero_1,Skill_Action & S){cout << endl;cout << Hero_2.GetName() << "思考中........" << endl;Sleep(2000);if (Hero_2.GetState()){cout << Hero_2.GetName() << "被麻痹了..." << "无法战斗..." << endl;Hero_2.SetState(0);return;}if (Hero_2.GetMP() < 20&&!Hero_2.GetState()){cout << Hero_2.GetName() << "使用" << "【蓝色药剂】" << endl;Hero_2.AddMP(50);return;}if (Hero_2.GetHP() <= 40){S.B_Skill_Protract(12, 4);Hero_2.A_4_Judgment();return;}srand((unsigned int)time(0));switch (rand()%3+1){case 1:S.B_Skill_Protract(11, 1);Hero_1.HitHP(Hero_2.A_1_Judgment());break;case 2:S.B_Skill_Protract(8, 2);Hero_1.HitHP(Hero_2.A_2_Judgment());Hero_1.SetState(1);break;case 3:S.B_Skill_Protract(10, 3);Hero_1.HitHP(Hero_2.A_3_Judgment());break;default:break;}}//栈操作bool S_Empty(Hero_Stack& L){if (L.Top != 0)return false;elsereturn true;}bool S_Full(Hero_Stack& L){if (L.Top == MAXSIZE - 1)return true;elsereturn false;}void S_Push(Hero_Stack& L, int HP_a, int MP_a, int State_a, int HP_b, int MP_b, int State_b){if (!S_Full(L)){L.Date[L.Top].HP_a = HP_a;L.Date[L.Top].MP_a = MP_a;L.Date[L.Top].State_a = State_a;L.Date[L.Top].HP_b = HP_b;L.Date[L.Top].MP_b = HP_b;L.Date[L.Top].State_b = State_b;L.Top++;}elsecout << "S_Push()!!! 栈满!!!" << endl;}void S_Pop(Hero_Stack& L){if (!S_Empty(L)){L.Top--;}}Hero_date Get_S_Date(Hero_Stack& L){return L.Date[L.Top-1];}void Exit_(){cout << "五秒后自动关闭!" << endl;Sleep(5000);closegraph();fflush(stdin);exit(0);}void Music_Loding(){mciSendString("open ./material/music/UI_1.mp3 alias Bgm_UI_1", 0, 0, 0);mciSendString("open ./material/music/Mouse_Hit.mp3 alias Bgm_UI_Hit", 0, 0, 0);mciSendString("open ./material/music/UI_药剂_Use.mp3 alias Bgm_UI_药剂_Use", 0, 0, 0);}void Bgm(int Bgm_Num, bool Repeat_key){switch (Bgm_Num){case 1:mciSendString("seek Bgm_UI_1 to start", 0, 0, 0);if (!Repeat_key)mciSendString("play Bgm_UI_1", 0, 0, 0);//播放./material/music/背景音乐1.mp3代换为bgm1if (Repeat_key)mciSendString("play Bgm_UI_1 repeat", 0, 0, 0);//repeat 重复播放break;case 2:mciSendString("seek Bgm_UI_Hit to start", 0, 0, 0);if (!Repeat_key)mciSendString("play Bgm_UI_Hit", 0, 0, 0);//播放./material/music/背景音乐1.mp3代换为bgm1if (Repeat_key)mciSendString("play Bgm_UI_Hit repeat", 0, 0, 0);//repeat 重复播放break;case 3:mciSendString("seek Bgm_UI_药剂_Use to start", 0, 0, 0);if (!Repeat_key)mciSendString("play Bgm_UI_药剂_Use", 0, 0, 0);//播放./material/music/背景音乐1.mp3代换为bgm1if (Repeat_key)mciSendString("play Bgm_UI_药剂_Use repeat", 0, 0, 0);//repeat 重复播放break;default:break;}}

//Actor.cpp如下:#pragma warning(disable : 4996)#include "Actor.h"#include<iostream>using namespace std;Actor::Actor() : Hp(100), MP(100), Name("无"), State(0), Death(true){cout << "Actor创建!" << endl;}Actor::~Actor(){if (!(this->Death)){cout << this->Name << "已经删除!" << endl;delete this;}}void Actor::HitHP(int H){if ((this->Hp)-H<=0){this->Hp = 0;this->Death = false;}else{this->Hp -= H;cout << this->GetName() << "受到" << H << "点伤害!" << "当前HP为:" << this->GetHP() << endl;}}void Actor::HitMP(int P){if (this->MP>=100){this->MP = 100;}if (this->MP<=0){this->MP = 0;}else{this->MP -= P;cout << this->Name << "失去" << P << "MP!" << "当前MP为" << this->MP << endl;}}void Actor::AddHP(int H){if (this->Hp <= 0){cout << "AddHP无法加血 hp小于0 设置true为false!" << endl;this->Death = false;}else{this->Hp += H;if (this->Hp>100){this->Hp = 100;}cout << this->Name << "治愈" << H << "点HP!" << " 当前HP为:" << this->MP << endl;}}void Actor::AddMP(int H){this->MP += H;if (this->MP > 100){this->MP = 100;}if (this->MP < 0){this->MP = 0;}cout << this->Name << "恢复" << H << "点MP!"<<"当前MP为:" << this->MP << endl;}int Actor::GetHP(){return this->Hp;}int Actor::GetMP(){return this->MP;}int Actor::GetState(){return this->State;}char* Actor::GetName(){return this->Name;}void Actor::SetName(char* str){strcpy(this->Name , str);}void Actor::SetState(int Temp){if (Temp){cout <<this->Name<< "异常效果生效了......" << endl;}else if(!Temp){cout << this->Name<<"经过一段时间恢复,异常效果消失了......" << endl;}this->State = Temp;}bool Actor::GetDeath(){return this->Death;}void Actor::SetHP(int Temp){this->Hp = Temp;}void Actor::SetMP(int Temp){this->MP = Temp;}

//Actor.h如下:#pragma onceclass Actor{public:Actor();~Actor();private:int Hp;int MP;char Name[10];int State;bool Death;public:void HitHP(int H);void HitMP(int P);void AddHP(int H);void AddMP(int P);int GetHP();int GetMP();int GetState();char* GetName();void SetName(char *str);void SetState(int Temp);void SetHP(int Temp);void SetMP(int Temp);bool GetDeath();};

//LuFu.cpp如下:#include "LuFu.h"#include<iostream>using namespace std;LuFu::LuFu() : Body_1(NULL), Body_2(NULL), Attack_1(NULL), Body_x(800), Body_y(120),A_1_Name("【岩 崩】"),A_2_Name("【碎石撞击】"),A_3_Name("【哀伤大地】"),A_4_Name("【自然之力】"){cout << "LuFu创建!" << endl;this->SetName("【鲁夫】");cout << "宠物" << this->GetName() << "出战!" << endl;loadimage(&Body_1, _T("./material/play/宠物_鲁夫_1.jpg"), 400, 300);loadimage(&Body_2, _T("./material/play/宠物_鲁夫_2.jpg"), 400, 300);loadimage(&Attack_1, _T("./material/play/主角.jpg"), 128, 128);loadimage(&Attack_2, _T("./material/play/主角.jpg"), 128, 128);}LuFu::~LuFu(){if (!GetDeath()){delete this;}}void LuFu::TickProtract()//绘制{settextstyle(20, 0, "楷体");settextcolor(RGB(233, 195, 172));outtextxy(1208, 135, this->GetName());//输出 名字putimage(this->Body_x, this->Body_y, &Body_1 , NOTSRCERASE);putimage(this->Body_x, this->Body_y, &Body_2 , SRCINVERT);setlinecolor(RGB(239, 242, 132));setfillcolor(RGB(221, 0, 27));fillrectangle(1090 - 2.8 * (this->GetHP())-1, 20, 1091, 44);setfillcolor(RGB(0, 120, 215));fillrectangle(1090 - 2.5 * (this->GetMP()), 45, 1091, 60);}void LuFu::TickAttack(int x, int y){this->SetX_Y(Get_X() + x, Get_Y() + y);putimage(this->Body_x, this->Body_y, &Attack_1, NOTSRCERASE);putimage(this->Body_x, this->Body_y, &Attack_2, SRCINVERT);}void LuFu::SetX_Y(int x, int y){this->Body_x = x;this->Body_y = y;}int LuFu::Get_X(){return this->Body_x;}int LuFu::Get_Y(){return this->Body_y;}int LuFu::A_1_Judgment(){cout << this->GetName() << "使用" << this->A_1_Name << endl;this->HitMP(10);return 20;}int LuFu::A_2_Judgment(){cout << this->GetName() << "使用" << this->A_2_Name << endl;this->HitMP(20);return 15;}int LuFu::A_3_Judgment(){cout << this->GetName() << "使用" << this->A_3_Name << endl;this->HitMP(10);return 30;}int LuFu::A_4_Judgment(){cout << this->GetName() << "使用" << this->A_4_Name << endl;this->HitMP(20);this->AddHP(50);return 0;}

//LuFu.h如下:#pragma once#include "Actor.h"#include<graphics.h>class LuFu :public Actor{public:LuFu();~LuFu();private:IMAGE Body_1;IMAGE Body_2;IMAGE Attack_1;IMAGE Attack_2;int Body_x;//坐标int Body_y;char A_1_Name[20];char A_2_Name[20];char A_3_Name[20];char A_4_Name[20];public:void TickProtract();//绘制void TickAttack(int x, int y);void SetX_Y(int x, int y);int Get_X();int Get_Y();int A_1_Judgment();int A_2_Judgment();int A_3_Judgment();int A_4_Judgment();};

//SaQi.cpp如下:#include "SaQi.h"#include<iostream>using namespace std;SaQi::SaQi() : Body_1(NULL), Body_2(NULL), Body_x(120), Body_y(140), A_1_Name("【碾 碎】"), A_2_Name("【电光一闪】"), A_3_Name("【闪电冲击】"), A_4_Name("【雷霆复苏】"), Hong_Close_1(NULL), Hong_Close_2(NULL), Lan_Close_1(NULL), Lan_Close_2(NULL), Back_Close_1(NULL), Back_Close_2(NULL), Run_Close_1(NULL), Run_Close_2(NULL), Hong_Open_1(NULL), Hong_Open_2(NULL), Lan_Open_1(NULL), Lan_Open_2(NULL),Back_Open_1(NULL),Back_Open_2(NULL),Run_Open_1(NULL),Run_Open_2(NULL){cout << "SaQi创建!" << endl;this->SetName("【萨奇】");cout << "宠物" << this->GetName() << "出战!" << endl;loadimage(&Body_1, _T("./material/play/宠物_萨奇_1.jpg"), 400, 300);loadimage(&Body_2, _T("./material/play/宠物_萨奇_2.jpg"), 400, 300);loadimage(&Hong_Close_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Hong_Close_2, _T("./material/play/药剂_血瓶_Close_2.jpg"), 80, 80);loadimage(&Hong_Open_1, _T("./material/play/药剂_1.jpg"),80,80);loadimage(&Hong_Open_2, _T("./material/play/药剂_血瓶_Open_2.jpg"), 80, 80);loadimage(&Lan_Close_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Lan_Close_2, _T("./material/play/药剂_蓝瓶_Close_2.jpg"), 80, 80);loadimage(&Lan_Open_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Lan_Open_2, _T("./material/play/药剂_蓝瓶_Open_2.jpg"), 80, 80);loadimage(&Back_Close_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Back_Close_2, _T("./material/play/Back_False_2.jpg"), 80, 80);loadimage(&Back_Open_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Back_Open_2, _T("./material/play/Back_True_2.jpg"), 80, 80);loadimage(&Run_Close_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Run_Close_2, _T("./material/play/Run_False_2.jpg"), 80, 80);loadimage(&Run_Open_1, _T("./material/play/药剂_1.jpg"), 80, 80);loadimage(&Run_Open_2, _T("./material/play/Run_True_2.jpg"), 80, 80);}SaQi::~SaQi(){if (!GetDeath()){delete this;}}void SaQi::TickProtract(){setbkmode(TRANSPARENT);//设置字体背景为透明settextstyle(20, 0, "楷体");settextcolor(RGB(246, 246, 246));outtextxy(-10, 135, this->GetName());//输出 名字this->A_1_Protract_Ui(true);putimage(this->Body_x, this->Body_y, &Body_1, NOTSRCERASE);putimage(this->Body_x, this->Body_y, &Body_2, SRCINVERT);setlinecolor(RGB(239, 242, 132));setfillcolor(RGB(221, 0, 27));fillrectangle(189, 20, 190 + 2.8 * (this->GetHP())+1, 44);setfillcolor(RGB(0, 120, 215));fillrectangle(189, 45, 190 + 2.5 * (this->GetMP()), 60);}void SaQi::SetX_Y(int x, int y){this->Body_x = x;this->Body_y = y;}int SaQi::Get_X(){return this->Body_x;}int SaQi::Get_Y(){return this->Body_y;}void SaQi::A_1_Protract_Ui(bool key){if (key){settextcolor(RGB(239, 242, 132));}else if (!key){settextcolor(RGB(221, 0, 27));}settextstyle(30, 0, "楷体");outtextxy(285, 600, this->A_1_Name);settextstyle(20, 0, "楷体");outtextxy(285, 650, "ATK:15 MP:-10");outtextxy(290, 670, "造成15点伤害");}int SaQi::A_1_Judgment(){cout << this->GetName() << "使用" << this->A_1_Name << endl;this->HitMP(10);return 15;}void SaQi::A_2_Protract_Ui(bool key){if (key){settextcolor(RGB(239, 242, 132));}else if (!key){settextcolor(RGB(221, 0, 27));}settextstyle(30, 0, "楷体");outtextxy(460, 600, this->A_2_Name);settextstyle(20, 0, "楷体");outtextxy(485, 650, "ATK:20 MP:-30");outtextxy(485, 670, "造成20点伤害,");outtextxy(480, 690, "并且使对方麻痹");}int SaQi::A_2_Judgment(){cout << this->GetName() << "使用" << this->A_2_Name << endl;this->HitMP(30);//减少蓝return 20;}void SaQi::A_3_Protract_Ui(bool key){if (key){settextcolor(RGB(239, 242, 132));}else if (!key){settextcolor(RGB(221, 0, 27));}settextstyle(30, 0, "楷体");outtextxy(655, 600, this->A_3_Name);settextstyle(20, 0, "楷体");outtextxy(680, 650, "ATK:45 MP:-15");outtextxy(680, 670, "造成45点伤害,");outtextxy(665, 690, "并且受到20点伤害");}int SaQi::A_3_Judgment(){cout << this->GetName() << "使用" << this->A_3_Name << endl;this->HitMP(15);//减去 15 MPthis->HitHP(20);//减去 20 HPreturn 45;}void SaQi::A_4_Protract_Ui(bool key){if (key){settextcolor(RGB(239, 242, 132));}else if (!key){settextcolor(RGB(221, 0, 27));}settextstyle(30, 0, "楷体");outtextxy(852, 600, this->A_4_Name);settextstyle(20, 0, "楷体");outtextxy(870, 650, "ATK:20 MP:+50");outtextxy(870, 670, "受到20点伤害,");outtextxy(870, 690, "并且恢复50MP");}int SaQi::A_4_Judement(){cout << this->GetName() << "使用" << this->A_4_Name << endl;this->HitHP(20);this->AddMP(50);return 0;}void SaQi::Prop_1(bool key){int x = 1080;int y = 576;BeginBatchDraw();//双缓冲绘图if (key){putimage(x, y, &Hong_Open_1, NOTSRCERASE);putimage(x, y, &Hong_Open_2, SRCINVERT);EndBatchDraw();//结束缓冲}else if (!key){putimage(x, y, &Hong_Close_1, NOTSRCERASE);putimage(x, y, &Hong_Close_2, SRCINVERT);}EndBatchDraw();//结束缓冲}void SaQi::Prop_2(bool key){int x = 1138;int y = 520;BeginBatchDraw();//双缓冲绘图if (key){putimage(x, y, &Lan_Open_1, NOTSRCERASE);putimage(x, y, &Lan_Open_2, SRCINVERT);EndBatchDraw();//结束缓冲}else if (!key){putimage(x, y, &Lan_Close_1, NOTSRCERASE);putimage(x, y, &Lan_Close_2, SRCINVERT);}EndBatchDraw();//结束缓冲}void SaQi::Prop_3(bool key){int x = 1193;int y = 577;BeginBatchDraw();//双缓冲绘图if (key){putimage(x, y, &Back_Open_1, NOTSRCERASE);putimage(x, y, &Back_Open_2, SRCINVERT);EndBatchDraw();//结束缓冲}else if (!key){putimage(x, y, &Back_Close_1, NOTSRCERASE);putimage(x, y, &Back_Close_2, SRCINVERT);}EndBatchDraw();//结束缓冲}void SaQi::Prop_4(bool key){int x = 1136;int y = 633;BeginBatchDraw();//双缓冲绘图if (key){putimage(x, y, &Run_Open_1, NOTSRCERASE);putimage(x, y, &Run_Open_2, SRCINVERT);EndBatchDraw();//结束缓冲}else if (!key){putimage(x, y, &Run_Close_1, NOTSRCERASE);putimage(x, y, &Run_Close_2, SRCINVERT);}EndBatchDraw();//结束缓冲}

//SaQi.h如下:#pragma once#include "Actor.h"#include<graphics.h>class SaQi :public Actor{public:SaQi();~SaQi();private:IMAGE Body_1;IMAGE Body_2;IMAGE Hong_Close_1;IMAGE Hong_Close_2;IMAGE Hong_Open_1;IMAGE Hong_Open_2;IMAGE Lan_Close_1;IMAGE Lan_Close_2;IMAGE Lan_Open_1;IMAGE Lan_Open_2;IMAGE Back_Close_1;IMAGE Back_Close_2;IMAGE Back_Open_1;IMAGE Back_Open_2;IMAGE Run_Close_1;IMAGE Run_Close_2;IMAGE Run_Open_1;IMAGE Run_Open_2;int Body_x;//坐标int Body_y;char A_1_Name[20];char A_2_Name[20];char A_3_Name[20];char A_4_Name[20];public:void TickProtract();//绘制void SetX_Y(int x, int y);int Get_X();int Get_Y();void A_1_Protract_Ui(bool key);int A_1_Judgment();void A_2_Protract_Ui(bool key);int A_2_Judgment();void A_3_Protract_Ui(bool key);int A_3_Judgment();void A_4_Protract_Ui(bool key);int A_4_Judement();void Prop_1(bool key);void Prop_2(bool key);void Prop_3(bool key);void Prop_4(bool key);};

//Skill_Action.cpp如下:#include "Skill_Action.h"Skill_Action::Skill_Action(){loadimage(&A_S_1[0][0], _T("./material/action/Skill_A_1/A_1_1_01.jpg"), 1280, 720);loadimage(&A_S_1[0][1], _T("./material/action/Skill_A_1/A_1_1_02.jpg"), 1280, 720);loadimage(&A_S_1[0][2], _T("./material/action/Skill_A_1/A_1_1_03.jpg"), 1280, 720);loadimage(&A_S_1[0][3], _T("./material/action/Skill_A_1/A_1_1_04.jpg"), 1280, 720);loadimage(&A_S_1[0][4], _T("./material/action/Skill_A_1/A_1_1_05.jpg"), 1280, 720);loadimage(&A_S_1[0][5], _T("./material/action/Skill_A_1/A_1_1_06.jpg"), 1280, 720);loadimage(&A_S_1[0][6], _T("./material/action/Skill_A_1/A_1_1_07.jpg"), 1280, 720);loadimage(&A_S_1[0][7], _T("./material/action/Skill_A_1/A_1_1_08.jpg"), 1280, 720);loadimage(&A_S_1[0][8], _T("./material/action/Skill_A_1/A_1_1_09.jpg"), 1280, 720);loadimage(&A_S_1[0][9], _T("./material/action/Skill_A_1/A_1_1_10.jpg"), 1280, 720);loadimage(&A_S_1[0][10], _T("./material/action/Skill_A_1/A_1_1_11.jpg"), 1280, 720);loadimage(&A_S_2[0][0], _T("./material/action/Skill_A_1/A_1_2_01.jpg"), 1280, 720);loadimage(&A_S_2[0][1], _T("./material/action/Skill_A_1/A_1_2_02.jpg"), 1280, 720);loadimage(&A_S_2[0][2], _T("./material/action/Skill_A_1/A_1_2_03.jpg"), 1280, 720);loadimage(&A_S_2[0][3], _T("./material/action/Skill_A_1/A_1_2_04.jpg"), 1280, 720);loadimage(&A_S_2[0][4], _T("./material/action/Skill_A_1/A_1_2_05.jpg"), 1280, 720);loadimage(&A_S_2[0][5], _T("./material/action/Skill_A_1/A_1_2_06.jpg"), 1280, 720);loadimage(&A_S_2[0][6], _T("./material/action/Skill_A_1/A_1_2_07.jpg"), 1280, 720);loadimage(&A_S_2[0][7], _T("./material/action/Skill_A_1/A_1_2_08.jpg"), 1280, 720);loadimage(&A_S_2[0][8], _T("./material/action/Skill_A_1/A_1_2_09.jpg"), 1280, 720);loadimage(&A_S_2[0][9], _T("./material/action/Skill_A_1/A_1_2_10.jpg"), 1280, 720);loadimage(&A_S_2[0][10], _T("./material/action/Skill_A_1/A_1_2_11.jpg"), 1280, 720);//1loadimage(&A_S_1[1][0], _T("./material/action/Skill_A_2/A_2_1_01.jpg"), 1280, 720);loadimage(&A_S_1[1][1], _T("./material/action/Skill_A_2/A_2_1_02.jpg"), 1280, 720);loadimage(&A_S_1[1][2], _T("./material/action/Skill_A_2/A_2_1_03.jpg"), 1280, 720);loadimage(&A_S_1[1][3], _T("./material/action/Skill_A_2/A_2_1_04.jpg"), 1280, 720);loadimage(&A_S_1[1][4], _T("./material/action/Skill_A_2/A_2_1_05.jpg"), 1280, 720);loadimage(&A_S_1[1][5], _T("./material/action/Skill_A_2/A_2_1_06.jpg"), 1280, 720);loadimage(&A_S_1[1][6], _T("./material/action/Skill_A_2/A_2_1_07.jpg"), 1280, 720);loadimage(&A_S_1[1][7], _T("./material/action/Skill_A_2/A_2_1_08.jpg"), 1280, 720);loadimage(&A_S_2[1][0], _T("./material/action/Skill_A_2/A_2_2_01.jpg"), 1280, 720);loadimage(&A_S_2[1][1], _T("./material/action/Skill_A_2/A_2_2_02.jpg"), 1280, 720);loadimage(&A_S_2[1][2], _T("./material/action/Skill_A_2/A_2_2_03.jpg"), 1280, 720);loadimage(&A_S_2[1][3], _T("./material/action/Skill_A_2/A_2_2_04.jpg"), 1280, 720);loadimage(&A_S_2[1][4], _T("./material/action/Skill_A_2/A_2_2_05.jpg"), 1280, 720);loadimage(&A_S_2[1][5], _T("./material/action/Skill_A_2/A_2_2_06.jpg"), 1280, 720);loadimage(&A_S_2[1][6], _T("./material/action/Skill_A_2/A_2_2_07.jpg"), 1280, 720);loadimage(&A_S_2[1][7], _T("./material/action/Skill_A_2/A_2_2_08.jpg"), 1280, 720);//2loadimage(&A_S_1[2][0], _T("./material/action/Skill_A_3/A_3_1_01.jpg"), 1280, 720);loadimage(&A_S_1[2][1], _T("./material/action/Skill_A_3/A_3_1_02.jpg"), 1280, 720);loadimage(&A_S_1[2][2], _T("./material/action/Skill_A_3/A_3_1_03.jpg"), 1280, 720);loadimage(&A_S_1[2][3], _T("./material/action/Skill_A_3/A_3_1_04.jpg"), 1280, 720);loadimage(&A_S_1[2][4], _T("./material/action/Skill_A_3/A_3_1_05.jpg"), 1280, 720);loadimage(&A_S_1[2][5], _T("./material/action/Skill_A_3/A_3_1_06.jpg"), 1280, 720);loadimage(&A_S_1[2][6], _T("./material/action/Skill_A_3/A_3_1_07.jpg"), 1280, 720);loadimage(&A_S_2[2][0], _T("./material/action/Skill_A_3/A_3_2_01.jpg"), 1280, 720);loadimage(&A_S_2[2][1], _T("./material/action/Skill_A_3/A_3_2_02.jpg"), 1280, 720);loadimage(&A_S_2[2][2], _T("./material/action/Skill_A_3/A_3_2_03.jpg"), 1280, 720);loadimage(&A_S_2[2][3], _T("./material/action/Skill_A_3/A_3_2_04.jpg"), 1280, 720);loadimage(&A_S_2[2][4], _T("./material/action/Skill_A_3/A_3_2_05.jpg"), 1280, 720);loadimage(&A_S_2[2][5], _T("./material/action/Skill_A_3/A_3_2_06.jpg"), 1280, 720);loadimage(&A_S_2[2][6], _T("./material/action/Skill_A_3/A_3_2_07.jpg"), 1280, 720);//3loadimage(&A_S_1[3][0], _T("./material/action/Skill_A_4/A_4_1_01.jpg"), 1280, 720);loadimage(&A_S_1[3][1], _T("./material/action/Skill_A_4/A_4_1_02.jpg"), 1280, 720);loadimage(&A_S_1[3][2], _T("./material/action/Skill_A_4/A_4_1_03.jpg"), 1280, 720);loadimage(&A_S_1[3][3], _T("./material/action/Skill_A_4/A_4_1_04.jpg"), 1280, 720);loadimage(&A_S_1[3][4], _T("./material/action/Skill_A_4/A_4_1_05.jpg"), 1280, 720);loadimage(&A_S_1[3][5], _T("./material/action/Skill_A_4/A_4_1_06.jpg"), 1280, 720);loadimage(&A_S_1[3][6], _T("./material/action/Skill_A_4/A_4_1_07.jpg"), 1280, 720);loadimage(&A_S_1[3][7], _T("./material/action/Skill_A_4/A_4_1_08.jpg"), 1280, 720);loadimage(&A_S_2[3][0], _T("./material/action/Skill_A_4/A_4_2_01.jpg"), 1280, 720);loadimage(&A_S_2[3][1], _T("./material/action/Skill_A_4/A_4_2_02.jpg"), 1280, 720);loadimage(&A_S_2[3][2], _T("./material/action/Skill_A_4/A_4_2_03.jpg"), 1280, 720);loadimage(&A_S_2[3][3], _T("./material/action/Skill_A_4/A_4_2_04.jpg"), 1280, 720);loadimage(&A_S_2[3][4], _T("./material/action/Skill_A_4/A_4_2_05.jpg"), 1280, 720);loadimage(&A_S_2[3][5], _T("./material/action/Skill_A_4/A_4_2_06.jpg"), 1280, 720);loadimage(&A_S_2[3][6], _T("./material/action/Skill_A_4/A_4_2_07.jpg"), 1280, 720);loadimage(&A_S_2[3][7], _T("./material/action/Skill_A_4/A_4_2_08.jpg"), 1280, 720);//4loadimage(&B_S_1[0][0], _T("./material/action/Skill_B_1/A_1_1_01.jpg"), 1280, 720);loadimage(&B_S_1[0][1], _T("./material/action/Skill_B_1/A_1_1_02.jpg"), 1280, 720);loadimage(&B_S_1[0][2], _T("./material/action/Skill_B_1/A_1_1_03.jpg"), 1280, 720);loadimage(&B_S_1[0][3], _T("./material/action/Skill_B_1/A_1_1_04.jpg"), 1280, 720);loadimage(&B_S_1[0][4], _T("./material/action/Skill_B_1/A_1_1_05.jpg"), 1280, 720);loadimage(&B_S_1[0][5], _T("./material/action/Skill_B_1/A_1_1_06.jpg"), 1280, 720);loadimage(&B_S_1[0][6], _T("./material/action/Skill_B_1/A_1_1_07.jpg"), 1280, 720);loadimage(&B_S_1[0][7], _T("./material/action/Skill_B_1/A_1_1_08.jpg"), 1280, 720);loadimage(&B_S_2[0][0], _T("./material/action/Skill_B_1/A_1_2_01.jpg"), 1280, 720);loadimage(&B_S_2[0][1], _T("./material/action/Skill_B_1/A_1_2_02.jpg"), 1280, 720);loadimage(&B_S_2[0][2], _T("./material/action/Skill_B_1/A_1_2_03.jpg"), 1280, 720);loadimage(&B_S_2[0][3], _T("./material/action/Skill_B_1/A_1_2_04.jpg"), 1280, 720);loadimage(&B_S_2[0][4], _T("./material/action/Skill_B_1/A_1_2_05.jpg"), 1280, 720);loadimage(&B_S_2[0][5], _T("./material/action/Skill_B_1/A_1_2_06.jpg"), 1280, 720);loadimage(&B_S_2[0][6], _T("./material/action/Skill_B_1/A_1_2_07.jpg"), 1280, 720);loadimage(&B_S_2[0][7], _T("./material/action/Skill_B_1/A_1_2_08.jpg"), 1280, 720);loadimage(&B_S_1[1][0], _T("./material/action/Skill_B_2/A_2_1_01.jpg"), 1280, 720);loadimage(&B_S_1[1][1], _T("./material/action/Skill_B_2/A_2_1_02.jpg"), 1280, 720);loadimage(&B_S_1[1][2], _T("./material/action/Skill_B_2/A_2_1_03.jpg"), 1280, 720);loadimage(&B_S_1[1][3], _T("./material/action/Skill_B_2/A_2_1_04.jpg"), 1280, 720);loadimage(&B_S_1[1][4], _T("./material/action/Skill_B_2/A_2_1_05.jpg"), 1280, 720);loadimage(&B_S_1[1][5], _T("./material/action/Skill_B_2/A_2_1_06.jpg"), 1280, 720);loadimage(&B_S_1[1][6], _T("./material/action/Skill_B_2/A_2_1_07.jpg"), 1280, 720);loadimage(&B_S_1[1][7], _T("./material/action/Skill_B_2/A_2_1_08.jpg"), 1280, 720);loadimage(&B_S_2[1][0], _T("./material/action/Skill_B_2/A_2_2_01.jpg"), 1280, 720);loadimage(&B_S_2[1][1], _T("./material/action/Skill_B_2/A_2_2_02.jpg"), 1280, 720);loadimage(&B_S_2[1][2], _T("./material/action/Skill_B_2/A_2_2_03.jpg"), 1280, 720);loadimage(&B_S_2[1][3], _T("./material/action/Skill_B_2/A_2_2_04.jpg"), 1280, 720);loadimage(&B_S_2[1][4], _T("./material/action/Skill_B_2/A_2_2_05.jpg"), 1280, 720);loadimage(&B_S_2[1][5], _T("./material/action/Skill_B_2/A_2_2_06.jpg"), 1280, 720);loadimage(&B_S_2[1][6], _T("./material/action/Skill_B_2/A_2_2_07.jpg"), 1280, 720);loadimage(&B_S_2[1][7], _T("./material/action/Skill_B_2/A_2_2_08.jpg"), 1280, 720);loadimage(&B_S_1[2][0], _T("./material/action/Skill_B_3/A_3_1_01.jpg"), 1280, 720);loadimage(&B_S_1[2][1], _T("./material/action/Skill_B_3/A_3_1_02.jpg"), 1280, 720);loadimage(&B_S_1[2][2], _T("./material/action/Skill_B_3/A_3_1_03.jpg"), 1280, 720);loadimage(&B_S_1[2][3], _T("./material/action/Skill_B_3/A_3_1_04.jpg"), 1280, 720);loadimage(&B_S_1[2][4], _T("./material/action/Skill_B_3/A_3_1_05.jpg"), 1280, 720);loadimage(&B_S_1[2][5], _T("./material/action/Skill_B_3/A_3_1_06.jpg"), 1280, 720);loadimage(&B_S_1[2][6], _T("./material/action/Skill_B_3/A_3_1_07.jpg"), 1280, 720);loadimage(&B_S_1[2][7], _T("./material/action/Skill_B_3/A_3_1_08.jpg"), 1280, 720);loadimage(&B_S_1[2][8], _T("./material/action/Skill_B_3/A_3_1_09.jpg"), 1280, 720);loadimage(&B_S_1[2][9], _T("./material/action/Skill_B_3/A_3_1_10.jpg"), 1280, 720);loadimage(&B_S_2[2][0], _T("./material/action/Skill_B_3/A_3_2_01.jpg"), 1280, 720);loadimage(&B_S_2[2][1], _T("./material/action/Skill_B_3/A_3_2_02.jpg"), 1280, 720);loadimage(&B_S_2[2][2], _T("./material/action/Skill_B_3/A_3_2_03.jpg"), 1280, 720);loadimage(&B_S_2[2][3], _T("./material/action/Skill_B_3/A_3_2_04.jpg"), 1280, 720);loadimage(&B_S_2[2][4], _T("./material/action/Skill_B_3/A_3_2_05.jpg"), 1280, 720);loadimage(&B_S_2[2][5], _T("./material/action/Skill_B_3/A_3_2_06.jpg"), 1280, 720);loadimage(&B_S_2[2][6], _T("./material/action/Skill_B_3/A_3_2_07.jpg"), 1280, 720);loadimage(&B_S_2[2][7], _T("./material/action/Skill_B_3/A_3_2_08.jpg"), 1280, 720);loadimage(&B_S_2[2][8], _T("./material/action/Skill_B_3/A_3_2_09.jpg"), 1280, 720);loadimage(&B_S_2[2][9], _T("./material/action/Skill_B_3/A_3_2_10.jpg"), 1280, 720);loadimage(&B_S_1[3][0], _T("./material/action/Skill_B_4/A_4_1_01.jpg"), 1280, 720);loadimage(&B_S_1[3][1], _T("./material/action/Skill_B_4/A_4_1_02.jpg"), 1280, 720);loadimage(&B_S_1[3][2], _T("./material/action/Skill_B_4/A_4_1_03.jpg"), 1280, 720);loadimage(&B_S_1[3][3], _T("./material/action/Skill_B_4/A_4_1_04.jpg"), 1280, 720);loadimage(&B_S_1[3][4], _T("./material/action/Skill_B_4/A_4_1_05.jpg"), 1280, 720);loadimage(&B_S_1[3][5], _T("./material/action/Skill_B_4/A_4_1_06.jpg"), 1280, 720);loadimage(&B_S_1[3][6], _T("./material/action/Skill_B_4/A_4_1_07.jpg"), 1280, 720);loadimage(&B_S_1[3][7], _T("./material/action/Skill_B_4/A_4_1_08.jpg"), 1280, 720);loadimage(&B_S_1[3][8], _T("./material/action/Skill_B_4/A_4_1_09.jpg"), 1280, 720);loadimage(&B_S_1[3][9], _T("./material/action/Skill_B_4/A_4_1_10.jpg"), 1280, 720);loadimage(&B_S_1[3][10], _T("./material/action/Skill_B_4/A_4_1_11.jpg"), 1280, 720);loadimage(&B_S_1[3][11], _T("./material/action/Skill_B_4/A_4_1_12.jpg"), 1280, 720);loadimage(&B_S_2[3][0], _T("./material/action/Skill_B_4/A_4_2_01.jpg"), 1280, 720);loadimage(&B_S_2[3][1], _T("./material/action/Skill_B_4/A_4_2_02.jpg"), 1280, 720);loadimage(&B_S_2[3][2], _T("./material/action/Skill_B_4/A_4_2_03.jpg"), 1280, 720);loadimage(&B_S_2[3][3], _T("./material/action/Skill_B_4/A_4_2_04.jpg"), 1280, 720);loadimage(&B_S_2[3][4], _T("./material/action/Skill_B_4/A_4_2_05.jpg"), 1280, 720);loadimage(&B_S_2[3][5], _T("./material/action/Skill_B_4/A_4_2_06.jpg"), 1280, 720);loadimage(&B_S_2[3][6], _T("./material/action/Skill_B_4/A_4_2_07.jpg"), 1280, 720);loadimage(&B_S_2[3][7], _T("./material/action/Skill_B_4/A_4_2_08.jpg"), 1280, 720);loadimage(&B_S_2[3][8], _T("./material/action/Skill_B_4/A_4_2_09.jpg"), 1280, 720);loadimage(&B_S_2[3][9], _T("./material/action/Skill_B_4/A_4_2_10.jpg"), 1280, 720);loadimage(&B_S_2[3][10], _T("./material/action/Skill_B_4/A_4_2_11.jpg"), 1280, 720);loadimage(&B_S_2[3][11], _T("./material/action/Skill_B_4/A_4_2_12.jpg"), 1280, 720);}void Skill_Action::A_Skill_Protract(int frame, int key){key--;saveimage(_T("./material/action/test.bmp"));loadimage(&Save, _T("./material/action/test.bmp"));for (int i = 0; i < frame; i++){Sleep(100);BeginBatchDraw();putimage(0, 0, &Save);putimage(0, 0, &A_S_1[key][i], NOTSRCERASE);putimage(0, 0, &A_S_2[key][i], SRCINVERT);EndBatchDraw();}putimage(0, 0, &Save);}void Skill_Action::B_Skill_Protract(int frame, int key){key--;saveimage(_T("./material/action/test.bmp"));loadimage(&Save, _T("./material/action/test.bmp"));for (int i = 0; i < frame; i++){Sleep(100);BeginBatchDraw();putimage(0, 0, &Save);putimage(0, 0, &B_S_1[key][i], NOTSRCERASE);putimage(0, 0, &B_S_2[key][i], SRCINVERT);EndBatchDraw();}putimage(0, 0, &Save);}

//Skill_Action.h如下:#pragma once#include<graphics.h>class Skill_Action{public:Skill_Action();~Skill_Action() {}private:IMAGE Save;IMAGE A_S_1[4][12];IMAGE A_S_2[4][12];IMAGE B_S_1[4][12];IMAGE B_S_2[4][12];public:void A_Skill_Protract(int frame, int key);void B_Skill_Protract(int frame, int key);};

如果觉得《C++/数据结构——课程设计——回合制对战小游戏》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。