STM32学习笔记十九:WS2812制作像素游戏屏-飞行射击游戏(9)探索道具系统

 增加道具的初衷,是为了增加游戏的趣味性。但是现在有些游戏吧,啧啧啧。

考虑道具,我们要考虑几方面的事情:

1、道具产生,可以随机产生,指定位置或时间自动产生,击杀地方产生。

2、未捡拾的道具管理。可以自动获取,主动捡拾,如何移动,如何呈现,如何销毁等等

3、已捡拾道具管理。这和上面2是两个不同链表,特别是双人游戏,显然不能用上面那个。

4、道具使用。包括特效呈现,后端数据处理。这很重要!因为你做的时候才会发现,道具可能会影响各种各样的数据,全世界的任何数据都可能需要访问到,就看你希望道具是什么效果了。这对前面章节的数据管理方式影响很大。

不发散了,回归我们的游戏。

我们可以通过前面 IntervalAniTimer_t  来控制 玩家使用道具的间隔,道具的数量是通过玩家自己捡拾的方式来控制。

另外,我们加一点小小的游戏设定——捡到的道具先进入出放在链表里面,只能按顺序使用——这样,可以增加一点点小小的策略性。

不同道具的差异是很大的,为此,我们要为每种道具定义一个新的类。前面我们把道具用结构来做,这回我们把他们拆出来,统一当成道具效果来使用。暂定我们有四种道具:

炸弹、激光、护盾、恢复。

每个道具有两种显示形态:

-》下落过程中的包裹形态,是一条结构数据,用管理类PropManager进行管理。像子弹数据一样,保留基础信息即可,用tag保存类型。

-》显示特效形态。此时应处于玩家的道具列表进行管理。每种道具对应一个实体类。

开始吧。

1、先定义PropManager。

PropManager.h

/** PropManager.h**  Created on: Dec 27, 2023*      Author: YoungMay*/#ifndef SRC_PLANE_PROPMANAGER_H_
#define SRC_PLANE_PROPMANAGER_H_
#include "PlaneDef.h"
#include "../drivers/DList.h"
#include "PropBase.h"
#include "PropBomb.h"
#include "PropHealth.h"
#include "PropSheel.h"
#include "PropLaser.h"class PropManager {
public:PropManager();virtual ~PropManager();uint8_t tick(uint32_t t);void init();uint8_t show(void);ListNode *propList;PlaneObject_t* createPropObject(int type);PropBase* createPropEffect(PlaneObject_t *prop) {PropBase *pb = NULL;switch (prop->tag) {case 0:pb = new PropBomb;break;case 1:pb = new PropLaser;break;case 2:pb = new PropHealth;break;case 3:pb = new PropSheel;break;}pb->baseInfo.tag = prop->tag;return pb;}private:IntervalAniTimer_t createTimer = { 1000, 10000 };uint16_t propTypeProportion[4] = { 100, 100, 100, 100 };
};#endif /* SRC_PLANE_PROPMANAGER_H_ */

PropManager.cpp

/** PropManager.cpp**  Created on: Dec 27, 2023*      Author: YoungMay*/#include "PropManager.h"PropManager::PropManager() {propList = ListCreate();}PropManager::~PropManager() {Serial_print("Destroy PropManager start");for (ListNode *cur = propList->next; cur != propList; cur = cur->next) {delete ((PlaneObject_t*) (cur->data));}ListDestroy(propList);Serial_print("Destroy PropManager OK");
}void PropManager::init() {}PlaneObject_t* PropManager::createPropObject(int type) {PlaneObject_t *prop = new PlaneObject_t;prop->tag = type;prop->x = ran_range(5, 27) * PlaneXYScale;prop->y = 0;prop->speedX = 0;prop->speedY = 10;prop->width = 3;prop->height = 3;prop->visiable = 1;prop->color = 0x900090;prop->life = 60000;return prop;
}
uint8_t PropManager::tick(uint32_t t) {if (createTimer.tick(t)) {int type = ran_seq(4, propTypeProportion);PlaneObject_t *prop = createPropObject(type);ListPushBack(propList, (LTDataType) prop);}for (ListNode *cur = propList->next; cur != propList; cur = cur->next) {PlaneObject_t *prop = ((PlaneObject_t*) (cur->data));prop->y += prop->speedY * t;prop->life -= t;if (prop->y > 64 * PlaneXYScale || prop->life < 0)prop->visiable = 0;}return 0;
}uint8_t PropManager::show(void) {ListNode *cur = propList->next;while (cur != propList) {PlaneObject_t *prop = ((PlaneObject_t*) (cur->data));if (prop->visiable) {ws2812_fill(prop->x / PlaneXYScale - 1, prop->y / PlaneXYScale - 1,3, 3, 128, 0, 128);uint8_t idx = (prop->life >> 7) & 0x7;ws2812_pixel(prop->x / PlaneXYScale + Explode_X[idx],prop->y / PlaneXYScale + Explode_Y[idx],(PropColor[prop->tag] & 0xff0000) >> 16,(PropColor[prop->tag] & 0xff00) >> 8,PropColor[prop->tag] & 0xff);ws2812_pixel(prop->x / PlaneXYScale + Explode_X[(idx + 4) & 7],prop->y / PlaneXYScale + Explode_Y[(idx + 4) & 7],(PropColor[prop->tag] & 0xff0000) >> 16,(PropColor[prop->tag] & 0xff00) >> 8,PropColor[prop->tag] & 0xff);} else {delete prop;ListErase(cur);}cur = cur->next;}return 0;
}

四种掉落包的形状是一样的,做了一个转圈的颜色特效。

2、在plane.cpp的tick中,加入掉落物的处理

uint8_t Plane::tick(uint32_t t, uint8_t b1, uint8_t b2) {
。。enemyManager.tick(t);propManager.tick(t);checkEffectCollision(t, player1);checkEffectCollision(t, player2);checkEnemyCollision();checkPlayerCollision();checkPropCollision();backGroundStar.show();enemyManager.show();player1->show();player2->show();propManager.show();
。。。
}

3、添加掉落物的碰撞检测

void Plane::checkPropCollision() {ListNode *cur = propManager.propList->next;while (cur != propManager.propList) {PlaneObject_t *prop = (PlaneObject_t*) (cur->data);if (player1->baseInfo.visiable&& checkAABBCollision(&player1->baseInfo, prop)) {prop->visiable = 0;player1->pickProp(propManager.createPropEffect(prop));}if (player2->baseInfo.visiable&& checkAABBCollision(&player2->baseInfo, prop)) {prop->visiable = 0;player2->pickProp(propManager.createPropEffect(prop));}cur = cur->next;}
}

这里用了AABB碰撞:

	uint8_t checkAABBCollision(PlaneObject_t *a, PlaneObject_t *b) {return abs(a->x - b->x) / PlaneXYScale < (a->width + b->width) / 2&& abs(a->y - b->y) / PlaneXYScale < (a->height + b->height) / 2;}

 4、为玩家添加拾取操作pickProp

class PlanePlayer {
public:PlanePlayer();~PlanePlayer();void init(uint8_t id);void start(uint8_t id);uint8_t tick(uint32_t t, uint8_t b1);uint8_t show(void);uint8_t hitDetect(int x, int y, int damage);uint8_t hitEffectDetect(int x, int y, int r);void pickProp(PropBase *prop) {if (propCount < 30) {ListPushBack(propList, (LTDataType) prop);propCount++;}}PlaneObject_t baseInfo;ListNode *bulletList;PropBase *currentProp = NULL;
private:DispersedAnimation *damageAnimation;ListNode *animationList;ListNode *propList;uint8_t propCount = 0;IntervalAniTimer_t fireTimer = { 0, 200 };PlaneObject_t* createBulletObject();void showProp(int locX);
};

5、然后是实现玩家甩道具。

uint8_t PlanePlayer::tick(uint32_t t, uint8_t b1) {
。。。if (currentProp == NULL) {if (b1 & KEY_BUTTON_D && propList->next != propList) {currentProp = (PropBase*) (propList->next->data);currentProp->init(&baseInfo);propCount--;ListErase(propList->next);}} else {currentProp->tick(t);if (currentProp->baseInfo.life < 0) {delete currentProp;currentProp = NULL;}}。。。return 0;
}

如果道具已经甩出去了,则执行道具的TICK方法。

6、在玩家的显示操作中添加显示道具特效

uint8_t PlanePlayer::show(void) {
。。。if (currentProp != NULL) {currentProp->show();}if (baseInfo.tag == 1)showProp(0);elseshowProp(31);return 0;
}void PlanePlayer::showProp(int locX) {uint8_t h1 = baseInfo.life / (PlayerMaxLife / 30);uint8_t h2 = baseInfo.life - h1 * (PlayerMaxLife / 30);ws2812_fill(locX, 31 - h1, 1, h1, 240, 0, 0);ws2812_pixel(locX, 31 - h1 - 1, h2 * 5, h2 * 3, 0);int locY = 32;for (ListNode *cur = propList->next; cur != propList; cur = cur->next) {uint8_t tag = ((PropBase*) (cur->data))->baseInfo.tag;ws2812_pixel(locX, locY, (PropColor[tag] >> 16) & 0xff,(PropColor[tag] >> 8) & 0xff, PropColor[tag] & 0xff);locY++;}
}

showProp用于在屏幕两侧分别显示两个玩家的未使用的道具和当前血量。

现在实现几种道具:

1、先定义好基类:

/** PropBase.h**  Created on: Dec 27, 2023*      Author: YoungMay*/#ifndef SRC_PLANE_PLANEPROP_H_
#define SRC_PLANE_PLANEPROP_H_
#include "PlaneDef.h"
#include "../drivers/DList.h"
#include "../drivers/DataBulk.h"
#include "../drivers/ws2812Frame.h"const uint32_t PropColor[4] = { 0xf02000, 0x0020f0, 0x20f000, 0x008080 };class PropBase {
public:PropBase();virtual ~PropBase();virtual uint8_t tick(uint32_t t)=0;virtual void init(PlaneObject_t *player)=0;virtual void hitEffectDetect(uint32_t t)=0;virtual uint8_t show()=0;PlaneObject_t baseInfo;PlaneObject_t *player;
protected:uint32_t totalTick = 0;};#endif /* SRC_PLANE_PLANEPROP_H_ */

2、然后是几种道具。每种道具有不同的显示特效和碰撞检测

炸弹道具:PropBomb.cpp 

/** PropBomb.cpp**  Created on: Dec 27, 2023*      Author: YoungMay*/#include "PropBomb.h"
#include "EnemyBase.h"PropBomb::PropBomb() {// TODO Auto-generated constructor stub}PropBomb::~PropBomb() {// TODO Auto-generated destructor stub
}void PropBomb::init(PlaneObject_t *_player) {player = _player;baseInfo.x = player->x;baseInfo.y =player->y > 25 * PlaneXYScale ? player->y - 25 * PlaneXYScale : 0;baseInfo.life = 4000;baseInfo.visiable = 1;
}uint8_t PropBomb::tick(uint32_t t) {baseInfo.life -= t;return 0;
}uint8_t PropBomb::show() {ws2812_Fill_Circle(baseInfo.x / PlaneXYScale, baseInfo.y / PlaneXYScale, 10,PropColor[0]);return 0;
}uint8_t PropBomb::hitEffectDetectOnce(int x, int y, int r) {int a = (x - baseInfo.x) / 100;int b = (y - baseInfo.y) / 100;int c = (r + 10) * 100;return (a * a + b * b < c * c) ? 20 : 0;
}void PropBomb::hitEffectDetect(uint32_t t) {for (ListNode *enemy = EnemyList->next; enemy != EnemyList;enemy = enemy->next) {EnemyBase *ene = (EnemyBase*) enemy->data;if (ene->explodeState)continue;uint8_t res = hitEffectDetectOnce(ene->baseInfo.x, ene->baseInfo.y,(ene->baseInfo.width + ene->baseInfo.height) / 3);if (res) {ene->baseInfo.life -= res * t;ene->hurt();}}for (ListNode *enemyBul = EnemyBulletList->next;enemyBul != EnemyBulletList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}for (ListNode *enemyBul = EnemyRocketList->next;enemyBul != EnemyRocketList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}
}

激光道具:PropLaser.cpp

/** PropLaser.cpp**  Created on: Dec 27, 2023*      Author: YoungMay*/#include "PropLaser.h"
#include "EnemyBase.h"PropLaser::PropLaser() {// TODO Auto-generated constructor stub}PropLaser::~PropLaser() {// TODO Auto-generated destructor stub
}
void PropLaser::init(PlaneObject_t *_player) {player = _player;baseInfo.x = player->x;baseInfo.y = player->y;baseInfo.life = 6000;
}uint8_t PropLaser::tick(uint32_t t) {baseInfo.life -= t;return 0;
}uint8_t PropLaser::show() {ws2812_fill(player->x / PlaneXYScale, 0, 1, player->y / PlaneXYScale,(PropColor[1] >> 16) & 0xff, (PropColor[1] >> 8) & 0xff,PropColor[1] & 0xff);return 0;
}uint8_t PropLaser::hitEffectDetectOnce(int x, int y, int r) {return abs(x - player->x) < r * PlaneXYScale && y < player->y ? 20 : 0;
}void PropLaser::hitEffectDetect(uint32_t t) {for (ListNode *enemy = EnemyList->next; enemy != EnemyList;enemy = enemy->next) {EnemyBase *ene = (EnemyBase*) enemy->data;if (ene->explodeState)continue;uint8_t res = hitEffectDetectOnce(ene->baseInfo.x, ene->baseInfo.y,ene->baseInfo.width / 2);if (res) {ene->baseInfo.life -= res * t;ene->hurt();}}for (ListNode *enemyBul = EnemyBulletList->next;enemyBul != EnemyBulletList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}for (ListNode *enemyBul = EnemyRocketList->next;enemyBul != EnemyRocketList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}
}

恢复道具 PropHealth.cpp:这个道具不需要碰撞检测

/** PropHealth.cpp**  Created on: Dec 27, 2023*      Author: YoungMay*/#include "PropHealth.h"PropHealth::PropHealth() {// TODO Auto-generated constructor stub}PropHealth::~PropHealth() {// TODO Auto-generated destructor stub
}
void PropHealth::init(PlaneObject_t *_player) {player = _player;baseInfo.x = player->x;baseInfo.y = player->y;baseInfo.life = 10000;
}uint8_t PropHealth::tick(uint32_t t) {baseInfo.life -= t;player->life += t;if (player->life > PlayerMaxLife)player->life = PlayerMaxLife;return 0;
}uint8_t PropHealth::show() {ws2812_Draw_Circle(player->x / PlaneXYScale, player->y / PlaneXYScale, 4,PropColor[2]);return 0;
}void PropHealth::hitEffectDetect(uint32_t t) {}

护盾道具 PropSheel.cpp: 护盾只能防子弹,不能防飞机。当然,敌我飞机的碰撞也没做。屏幕小,飞机一多就容易混在一起了,所以就不让他们碰了。

/** PropSheel.cpp**  Created on: Dec 27, 2023*      Author: YoungMay*/#include "PropSheel.h"PropSheel::PropSheel() {// TODO Auto-generated constructor stub}PropSheel::~PropSheel() {// TODO Auto-generated destructor stub
}
void PropSheel::init(PlaneObject_t *_player) {player = _player;baseInfo.x = player->x;baseInfo.y = player->y;baseInfo.life = 10000;
}uint8_t PropSheel::tick(uint32_t t) {baseInfo.life -= t;return 0;
}uint8_t PropSheel::show() {ws2812_Draw_Circle(player->x / PlaneXYScale, player->y / PlaneXYScale, 4,PropColor[3]);return 0;
}uint8_t PropSheel::hitEffectDetectOnce(int x, int y, int r) {int a = (x - player->x) / 100;int b = (y - player->y) / 100;int c = (r + 5) * 100;return (a * a + b * b < c * c) ? 2 : 0;
}void PropSheel::hitEffectDetect(uint32_t t) {for (ListNode *enemyBul = EnemyBulletList->next;enemyBul != EnemyBulletList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}for (ListNode *enemyBul = EnemyRocketList->next;enemyBul != EnemyRocketList; enemyBul = enemyBul->next) {PlaneObject_t *bul = (PlaneObject_t*) enemyBul->data;uint8_t res = hitEffectDetectOnce(bul->x, bul->y, 1);if (res) {bul->visiable = 0;}}
}

类似的方法,还可以加上火力加强道具,玩家导弹道具等等。

最后看看效果:

STM32学习笔记十九:WS2812制作像素游戏屏-飞行射击

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/595453.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【数据库原理】(7)关系数据库的完整性约束

关系模型的完整性规则是为了确保数据的唯一性和数据之间的关系的准确性。 有三类完整性约束:实体完整性、参照完整性和用户定义完整性。 其中实体完整性和参照完整性是必须满足的完整性约束条件,应该由关系系统自动支持。 实体完整性 实体完整性的核心概念 唯一性&#xf…

陪诊系统|北京陪诊小程序提升陪诊服务效果

随着科技的不断发展&#xff0c;人们对于医疗服务的需求也越来越高。在过去&#xff0c;陪诊师和陪诊公司通常需要通过电话或传真等传统方式与医院进行沟通和安排。然而&#xff0c;现在有了陪诊小程序&#xff0c;这些问题得到了解决。本文将介绍陪诊小程序的开发流程和功能&a…

【python高级用法】线程

前言 Python通过标准库的 threading 模块来管理线程。这个模块提供了很多不错的特性&#xff0c;让线程变得无比简单。实际上&#xff0c;线程模块提供了几种同时运行的机制&#xff0c;实现起来非常简单。 线程模块 线程对象Lock对象RLock对象信号对象条件对象事件对象 简单…

生成式AI如何重塑开发流程和开发工具

随着科技的飞速发展&#xff0c;人工智能&#xff08;AI&#xff09;已经成为当今世界最重要的技术趋势之一。在众多AI应用中&#xff0c;生成式AI以其独特的优势&#xff0c;正在对软件开发行业产生深远的影响。生成式AI通过自动化和优化软件开发过程&#xff0c;提高开发效率…

Java学习——设计模式——介绍

文章目录 设计模式介绍UML的类图表示类与类之间关系的表示关联关系聚合关系组合关系依赖关系继承关系实现关系 设计模式介绍 设计模式design patterns&#xff0c;指在软件设计中&#xff0c;被反复使用的一种代码设计经验。使用设计模式的目的是为了可重用代码&#xff0c;提…

纯前端上传word,xlsx,ppt,在前端预览并下载成图片(预览效果可以,下载图片效果不太理想)

纯前端上传word,xlsx,ppt,在前端预览并下载成图片&#xff08;预览效果可以&#xff0c;下载图片效果不太理想&#xff09; 一.安装依赖二、主要代码 预览效果链接: https://github.com/501351981/vue-office 插件文档链接: https://501351981.github.io/vue-office/examples/d…

pth.tar的保存和读取

一、简介 在PyTorch中&#xff0c;.pt、.pth和.pth.tar都是保存训练好的模型的文件格式。主要区别在于&#xff1a; .pt是PyTorch1.6及以上版本中引入的保存格式&#xff0c;可以保存整个模型&#xff0c;包括模型结构、模型参数以及优化器状态等信息&#xff0c;是一个二进制文…

【C++入门到精通】function包装器 | bind() 函数 C++11 [ C++入门 ]

阅读导航 引言一、function包装器1. 概念2. 基本使用3. 逆波兰表达式求值&#xff08;1&#xff09;普通写法&#xff08;2&#xff09;使用包装器以后的写法 二、bind() 函数温馨提示 引言 很高兴再次与大家分享关于 C11 的一些知识。在上一篇文章中&#xff0c;我们讲解了 c…

【Linux系统编程二十六】:线程控制与线程特性(Linux中线程库/线程创建/线程退出/线程等待)

【Linux系统编程二十六】&#xff1a;线程控制与线程特性 一.Linux线程库pthread1.线程控制块2.线程tid3.线程栈 二.线程控制1.线程创建2.线程退出3.线程等待 三.线程的特性1.独立栈2.局部存储3.线程可分离 一.Linux线程库pthread 在Linux中&#xff0c;是没有明确的线程概念的…

阿里云服务器Alibaba Cloud Linux 3镜像版本大全说明

Alibaba Cloud Linux阿里云打造的Linux服务器操作系统发行版&#xff0c;Alibaba Cloud Linux完全兼容完全兼容CentOS/RHEL生态和操作方式&#xff0c;目前已经推出Alibaba Cloud Linux 3&#xff0c;阿里云百科aliyunbaike.com分享Alibaba Cloud Linux 3版本特性说明&#xff…

19个地信专业可以投的岗位汇总【GIS求职秘籍】

今天给大家详细科普一下&#xff0c;GIS专业的同学毕业以后还能从事哪些岗位的工作。 &#xff08;这期不包含学校老师等事业编岗位&#xff09; 一、GIS数据采集和处理 GIS数据采集和处理在这里分为一个大类&#xff0c;包含前期测绘外业的实地采集&#xff0c;后续的数据加…

石化行业设备管理系统的作用

石化行业是全球经济中不可或缺的重要组成部分&#xff0c;它涵盖了石油、天然气、化工等领域。在这个高风险和高安全要求的行业中&#xff0c;设备的可靠性和安全性至关重要。为了有效管理和维护设备&#xff0c;石化公司越来越多地采用设备管理系统&#xff0c;以提高生产效率…

MongoDB—SQL到MongoDB映射图表

一、术语和概念 下表显示了各种 SQL 术语和概念 以及相应的 MongoDB 术语和概念。 SQL Terms/Concepts MongoDB Terms/Concepts database database table collection row document or BSON document column field index index table joins $lookup, embedded docu…

CSS 伪类函数 :is() 和 :where()

在编写 CSS 时&#xff0c;有时可能会使用很长的选择器列表来定位具有相同样式规则的多个元素。例如&#xff0c;如果您想对标题中的 b 标签进行颜色调整&#xff0c;我们应该都写过这样的代码&#xff1a; h1 > b, h2 > b, h3 > b, h4 > b, h5 > b, h6 > b…

不想root,但想远程控制vivo手机?这个方法不用root也能做到

远程控制vivo手机不用root&#xff01;今天给大家讲讲免Root情况下&#xff0c;笔记本电脑如何远程控制vivo手机。 在电脑和手机都安装AirDroid&#xff0c;这是免Root的关键。 下载AirDroid个人版 | 远程控制安卓手机软件下载下载AirDroid个人版进行文件传输和管理、远程控制安…

Java 执行 cmd 命令

方法 Runtime.getRuntime().exec("这里是cmd命令") 例子 关闭 wps.exe 进程&#xff0c;以下是完整写法&#xff0c;如果只执行 exec()方法有时会卡住 Testpublic void closeProgress() {try {Process process Runtime.getRuntime().exec("taskkill /f /im w…

八、HTML 链接

一、HTML 链接 HTML 使用超级链接与网络上的另一个文档相连。 HTML中的链接是一种用于在不同网页之间导航的元素。 链接通常用于将一个网页与另一个网页或资源&#xff08;如文档、图像、音频文件等&#xff09;相关联。 链接允许用户在浏览网页时单击文本或图像来跳转到其…

Python进程、线程、协程:多任务并发编程指南

概要 在当今计算机时代&#xff0c;为了提高程序的性能和响应速度&#xff0c;多任务并发编程成为了一种必不可少的技术手段。而Python作为一门高级编程语言&#xff0c;提供了多种多任务并发编程的方式&#xff0c;包括进程、线程和协程。本文将详细介绍这三种方式的使用教程…

指针大礼包2

第11题 &#xff08;1.0分&#xff09; 题号:6877 难度:中 第8章 若有定义语句:double a, *p&a ; 以下叙述中错误的是(). A:定义语句中的*号是一个间址运算符 B:定义语句中的*号是一个说明符 C:定义语句中的p只能存放double类型变量的地址 D:定…

【c语言】飞机大战终

效果展示 效果演示 源码展示 #include<stdio.h> #include <graphics.h> #include <assert.h> #include <stdlib.h> #include<conio.h>//_getch(); #include <time.h> #include <math.h> #include<mmsystem.h>//包含多媒体设备…