#define _CRT_SECURE_NO_WARNINGS
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <stdio.h>
#include"EasyXPng.h"
#pragma comment(lib,"Winmm.lib")
void PlayMusicOnce(const char *fileName);
void enemy_startup();
void gameover();
void show_arrow(int x, int y);
void showmouse();
void startup();
void scinground();
void background1();
void background();
void netxturn();
void turnprocess();
void showemerycard();
HWND g_hWnd;
MOUSEMSG m;
int k = 0;//场景参数 0为选择界面 ,1为英雄界面
IMAGE beijing[4], choise[10], hero[9];
IMAGE esc[2];
IMAGE mouse[2];
IMAGE hand[2];
IMAGE fight[5];
char input;
IMAGE game;
IMAGE sc[10];//随从图片
IMAGE changjing;
IMAGE_PNG boom;
IMAGE_PNG arrow1, arrow2;
int begin_arrow_x, begin_arrow_y;
int hero_hp = 15;//敌方英雄的血量
int x; //显示esc
int living;//随从是否或者0死1活在场上
int attack1 = 0; //随从是否被鼠标点起1为被点
int attack2 = 0; //随从是否被指向其攻击对象
int att_x, att_y;
IMAGE_PNG suicong_image[5][5];
int turn=0;
int currentcost=0;
int allcost=0;
//o 是淡水鳄 1是迅猛龙 2是冰风雪人
int p_x, p_y; //计入随从刚刚开始的位置
int vx = -5, vy = -5;
int process = 0;
int cardnumber;
int clickcard = 0;
int card_clicked = -1;
int sc_clicked = -1;
int enety_attacked = -1;
int card_inhand_click[5];
int scwillattack = -1;
int scingroundnumber = 0;
IMAGE_PNG blood[15];
IMAGE_PNG ourturn;
IMAGE_PNG theirturn;
int p__x, p__y; //随从攻击时记录初始位置的变量
int next = 0;
int time = 0;//计入轮回合时候的时间
int enemycard = 3;
char s[5];
char d = '/';
IMAGE emerycard;
struct card
{
int number; //确定卡牌对应的是哪那张随从
IMAGE_PNG card_inhand;// 卡牌图片
int card_x, card_y;//卡牌的坐标
int cost;
};
card cardinhand[10];
//随从结构体
struct suicong
{
int life;//0是死的 1在场上
int p_x, p_y; //随从打印位置
int hp, att; //随从血量和攻击力
IMAGE_PNG scimage[5];
int cost;
};
suicong s_c[10];
suicong enemy[10];
//随从初始化
suicong sc_in_ground[5];
void scinground()
{
if (scingroundnumber == 1)
{
sc_in_ground[0].p_x = 445;
sc_in_ground[0].p_y = 265;
}
if (scingroundnumber == 2)
{
sc_in_ground[0].p_x = 425;
sc_in_ground[0].p_y = 265;
sc_in_ground[1].p_x = 480;
sc_in_ground[1].p_y = 265;
}
if (scingroundnumber == 3)
{
sc_in_ground[0].p_x = 380;
sc_in_ground[0].p_y = 265;
sc_in_ground[1].p_x = 445;
sc_in_ground[1].p_y = 265;
sc_in_ground[2].p_x = 510;
sc_in_ground[2].p_y = 265;
}
}
void cardinhandstartup()
{
cardnumber = 3;
cardinhand[0].number = 0;
cardinhand[0].cost = 2;
cardinhand[1].number = 1;
cardinhand[1].cost = 2;
cardinhand[2].number = 2;
cardinhand[2].cost = 4;
loadimage(&cardinhand[0].card_inhand, _T(".\\淡水鳄(3).png"), 65, 80);
loadimage(&cardinhand[1].card_inhand, _T(".\\迅猛龙(2).png"), 65, 80);
loadimage(&cardinhand[2].card_inhand, _T(".\\冰风雪人(5).png"), 65, 80);
}
void show_card_inhand()
{
if (cardnumber == 1)
{
cardinhand[0].card_x = 450;
cardinhand[0].card_y = 455;
}
if (cardnumber == 2)
{
cardinhand[0].card_x = 415;
cardinhand[0].card_y = 455;
cardinhand[1].card_x = 485;
cardinhand[1].card_y = 455;
}
if (cardnumber == 3)
{
cardinhand[0].card_x = 385;
cardinhand[0].card_y = 455;
cardinhand[1].card_x = 450;
cardinhand[1].card_y = 455;
cardinhand[2].card_x = 515;
cardinhand[2].card_y = 455;
}
if (cardnumber == 4)
{
cardinhand[0].card_x = 350;
cardinhand[0].card_y = 455;
cardinhand[1].card_x = 415;
cardinhand[1].card_y = 455;
cardinhand[2].card_x = 485;
cardinhand[2].card_y = 455;
cardinhand[3].card_x = 550;
cardinhand[3].card_y = 455;
}
int i;
for (i = 0; i<cardnumber; i++)
if (card_inhand_click[i] != 1)
putimage(cardinhand[i].card_x, cardinhand[i].card_y, &cardinhand[i].card_inhand);
}
//有bug
void click_card()
{
int i;
if (m.uMsg == WM_LBUTTONDOWN && clickcard == 0)
{
for (i = 0; i < cardnumber; i++) //点起卡牌
if (m.x > cardinhand[i].card_x && m.x<cardinhand[i].card_x + 60 && m.y>cardinhand[i].card_y && m.y < cardinhand[i].card_y + 80)
{
if (currentcost >= cardinhand[i].cost)
{
clickcard = 1; //有牌被点起
card_clicked = i; //记录给点起的是哪张牌
card_inhand_click[i] = 1;//用来显示被选中的卡牌不显示在手牌中
}
break;
}
}
if (m.uMsg == WM_RBUTTONDOWN)//选中随从后能右键取消
{
if (clickcard == 1)
{
clickcard = 0;
card_inhand_click[card_clicked] = 0;
card_clicked = -1;
}
}
//有随从显示的BUG
if (m.uMsg == WM_LBUTTONDOWN && clickcard == 1 && m.y < 400)//将随从打到场上
{
//s_c[card_clicked].life = 1;
clickcard = 0; //没有牌被点起
int i;
card_inhand_click[card_clicked] = 0;
sc_in_ground[scingroundnumber] = s_c[cardinhand[card_clicked].number];
currentcost -= cardinhand[card_clicked].cost;
for (i = card_clicked; i < cardnumber; i++) //手牌往前整
{
cardinhand[i] = cardinhand[i + 1];
}
cardnumber--; //手牌减1
scingroundnumber++;
scinground();//给场上随从排序
}
}
void suicong_startup()
{
for (living = 0; living < 10; living++)
s_c[living].life = 0;//初始化所有随从死亡
s_c[0].life = 0;
s_c[0].p_x = 0;
s_c[0].p_y = 0;
s_c[0].hp = 3;
s_c[0].att = 2;
s_c[0].cost = 2;
s_c[1].life = 0;
s_c[1].hp = 2;
s_c[1].att = 3;
s_c[1].p_x = 0;
s_c[1].p_y = 0;
s_c[1].cost = 2;
s_c[2].life = 0;
s_c[2].hp = 5;
s_c[2].att = 4;
s_c[2].p_x = 0;
s_c[2].p_y = 0;
s_c[2].cost = 2;
loadimage(&s_c[0].scimage[2], _T(".\\淡水鳄(3).png"), 65, 80);
loadimage(&s_c[0].scimage[1], _T(".\\淡水鳄(2).png"), 65, 80);
loadimage(&s_c[0].scimage[0], _T(".\\淡水鳄(1).png"), 65, 80);
loadimage(&s_c[1].scimage[1], _T(".\\迅猛龙(2).png"), 65, 80);
loadimage(&s_c[1].scimage[0], _T(".\\迅猛龙(1).png"), 65, 80);
loadimage(&s_c[2].scimage[0], _T(".\\冰风雪人(1).png"), 65, 80);
loadimage(&s_c[2].scimage[1], _T(".\\冰风雪人(2).png"), 65, 80);
loadimage(&s_c[2].scimage[2], _T(".\\冰风雪人(3).png"), 65, 80);
loadimage(&s_c[2].scimage[3], _T(".\\冰风雪人(4).png"), 65, 80);
loadimage(&s_c[2].scimage[4], _T(".\\冰风雪人(5).png"), 65, 80);
}
void show_enemy(int living)
{
if (enemy[living].hp > 0)
putimage(enemy[living].p_x, enemy[living].p_y, &s_c[living].scimage[enemy[living].hp - 1]);
}
void show_suicong(int living)
{
if (sc_in_ground[living].hp - 1>0)
putimage(sc_in_ground[living].p_x, sc_in_ground[living].p_y, &sc_in_ground[living].scimage[sc_in_ground[living].hp - 1]);
}
void show_suicong_attack(int n, int px, int py)
{
if (process == 0)
{
p__x = sc_in_ground[n].p_x;
p__y = sc_in_ground[n].p_y;
process = 1;
}
double xielv1 = ((float)px - (float)p__x) / ((float)py - (float)p__y);
float xielv2 = 1.0* (py - p__y) /(px - p__x);
if (p__x == px)
{
if (process == 1)
{
p_x = sc_in_ground[n].p_x;
p_y = sc_in_ground[n].p_y;
process = 2;
}
if (process == 2)
{
sc_in_ground[n].p_y += vy;
if (sc_in_ground[n].p_y == py)
{
process = 3;
}
}
show_suicong(n);
if (process == 3)
{
sc_in_ground[n].p_y -= vy;
putimage(px - 30, py - 27, &boom);
if (p_y == sc_in_ground[n].p_y)
{
process = 0;
attack2 = 0;
Sleep(500);
}
}
}
if (p__x != px)
{
if (p__x<px)
{
if (process == 1)
{
p_x = sc_in_ground[n].p_x;
p_y = sc_in_ground[n].p_y;
process = 2;
}
if (process == 2)
{
sc_in_ground[n].p_y += vy;
sc_in_ground[n].p_x += (float)vy * xielv1;
if (sc_in_ground[n].p_y == py)
{
process = 3;
}
}
show_suicong(n);
if (process == 3)
{
sc_in_ground[n].p_y -= vy;
sc_in_ground[n].p_x -= vy * xielv1;
putimage(px - 30, py - 27, &boom);
if (p_y == sc_in_ground[n].p_y)
{
没有合适的资源?快使用搜索试试~ 我知道了~
炉石传说项目c++版本
共107个文件
png:51个
jpg:43个
cur:5个
4星 · 超过85%的资源 需积分: 46 35 下载量 34 浏览量
2018-04-25
00:24:34
上传
评论 5
收藏 9.09MB ZIP 举报
温馨提示
模仿炉石传说游戏(可以联网),写了一些基本的卡牌制作,对战机制。大部分完善模仿了这款游戏
资源推荐
资源详情
资源评论
收起资源包目录
炉石传说项目c++版本 (107个子文件)
wait.cur 17KB
down.cur 17KB
drag.cur 17KB
hand.cur 17KB
test.cur 4KB
code final.exe 56KB
QQͼƬ20171215181618.jpg 238KB
hero6.jpg 211KB
hero8.jpg 210KB
hero5.jpg 210KB
hero2.jpg 210KB
hero3.jpg 210KB
hero1.jpg 209KB
hero7.jpg 208KB
hero4.jpg 207KB
game0.jpg 190KB
game.jpg 190KB
hero0.jpg 183KB
对战场景.jpg 180KB
QQͼƬ20171215181604.jpg 179KB
esc0.jpg 177KB
beijing1.jpg 167KB
choise10.jpg 158KB
QQͼƬ20171215181610.jpg 157KB
choise9.jpg 157KB
choise7.jpg 157KB
choise6.jpg 157KB
choise8.jpg 156KB
choise1.jpg 156KB
choise0.jpg 156KB
choise2.jpg 155KB
choise5.jpg 155KB
00.jpg 155KB
choise4.jpg 155KB
beijing3.jpg 155KB
choise3.jpg 155KB
beijing2.jpg 154KB
fight0.jpg 109KB
fight3.jpg 108KB
fight1.jpg 106KB
beijing0.jpg 96KB
2545597451.jpg 78KB
plus1v3.jpg 41KB
fight2.jpg 38KB
淡水鳄.jpg 36KB
grabhand64 copy.jpg 15KB
hand64 copy.jpg 14KB
grabhand copy.jpg 12KB
hand copy.jpg 12KB
旅店老板的欢迎.mp3 19KB
寻找对手开始.mp3 14KB
寻找对手结束.mp3 11KB
background1.mp3 4KB
background0.mp3 3KB
healthy stone.pdb 60KB
淡水鳄(1).png 79KB
淡水鳄(2).png 79KB
迅猛龙(1).png 77KB
持盾卫士(1).png 76KB
BloodSplatA.png 76KB
银背族长(2).png 76KB
银背族长(1).png 76KB
银背族长(3).png 75KB
灰熊(1).png 75KB
霜狼步兵(1).png 75KB
灰熊(2).png 75KB
持盾卫士(2).png 75KB
持盾卫士(3).png 74KB
淡水鳄(3).png 74KB
迅猛龙(2).png 71KB
灰熊(3).png 71KB
冰风雪人(1).png 70KB
闪金镇步兵(1).png 70KB
8Ѫ.png 69KB
13Ѫ.png 69KB
9Ѫ.png 69KB
6Ѫ.png 69KB
3Ѫ.png 69KB
10Ѫ.png 69KB
冰风雪人(2).png 69KB
冰风雪人(3).png 68KB
2Ѫ.png 68KB
霜狼步兵(2).png 68KB
5Ѫ.png 68KB
12Ѫ.png 68KB
银背族长(4).png 68KB
15Ѫ.png 68KB
鱼人.png 68KB
冰风雪人(4).png 68KB
岩浆暴怒者.png 68KB
7Ѫ.png 67KB
持盾卫士(4).png 67KB
4Ѫ.png 67KB
14Ѫ.png 67KB
1Ѫ.png 66KB
野猪.png 66KB
11.png 66KB
闪金镇步兵(2).png 63KB
冰风雪人(5).png 61KB
ArrowBang.png 59KB
共 107 条
- 1
- 2
资源评论
- fumeifu2018-12-26请问void click_card()中有bug的部分是怎么解决的呢?谢谢大佬(・ω・)ノ。
鲸失
- 粉丝: 34
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 自动驾驶-状态估计和定位之Error State EKF.pdf
- STM32F103ZET6+北斗
- 程序流程图的说明及图形示例
- FDN5618P-NL-VB一款SOT23封装P-Channel场效应MOS管
- Go语言基础(变量和基本类型).zip
- 基于CYCLONE2 (EP2C8Q) FPGA 设计PLL锁相环设置时钟Verilog源码Quartus工程文件.zip
- FDN372S-NL-VB一款SOT23封装N-Channel场效应MOS管
- date0425111111111111111111111
- 包含贪心算法的定义及python代码部分实现
- 自动驾驶-状态估计和定位之扩展卡尔曼滤波.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功