前情提要:飞机大战第三篇 实现敌机与爆炸
如下:
新建类----->Enemy + Boom
第一步:敌机类
Enemy.h
#include <stdio.h>
#include "cocos2d.h"
USING_NS_CC;
class Enemy:public Node
{
public:
CREATE_FUNC(Enemy);
int type;
int hp;
int ex,ey;
int toolID;//道具 0 不含 1 加血 2 炸雷 3 激光 4 散弹
Sprite * eSprite;
bool init();
static Enemy * createEnemy(int type,int x,int y);
void moveTo(int x,int y);
};
Enemy.cpp
#include "Enemy.h"
cocos2d-x 3.2 敌机与爆炸效果实现

这篇博客介绍了如何在cocos2d-x 3.2中创建敌机和爆炸效果。首先,通过创建Enemy类来实现敌机的初始化、类型设定以及移动功能。接着,利用粒子编辑器设计爆炸效果,并创建Boom类来展示不同的爆炸动画。通过添加不同类型的粒子系统和动作序列,实现了敌机被击中后的爆炸效果。
最低0.47元/天 解锁文章
5316

被折叠的 条评论
为什么被折叠?



