cocos2dx3.3开发FlappyBird总结十四:常量定义

本文详细解析了游戏中水管的四个状态及其参数设置,包括水管的高度、宽度、移动速度、上下间距、垂直间距、显示管道对的数量以及等待距离。此外,还介绍了鸟的半径、设计分辨率的宽度和高度、游戏层在场景中的标记,为开发者提供了一个全面的水管设计指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

游戏层中水管等需要常量:


#ifndef EngryBird_AppConstant_h
#define EngryBird_AppConstant_h

/**
 * The pipe has four state, using the following tag to mark.
 * > the state up
 * > the state down
 * > the state passed
 * > the state new created
 */
const int kPipeUpTag = 21;
const int kPipeDownTag = 12;
const int kPipePassedTag = 30;
const int kPipeNewTag = 31;

/**
 * > the pipe's height
 * > the pipe's width
 * > the speed of pipe moves
 * > the distance between the down pipe and up pipe
 * > the distance between the pipes vertical
 * > the number of pipe pairs display int the screen in the same time
 * > the distance that the pipe will display in the screen, for player to ready
 */
const int kPipeHeight = 320;
const int kPipeWidth = 52;
const float kPipeShiftSpeed = 80.0f;
const int kPipeUpDownDistance = 100;
const int kPipeInterval = 180;
const int kPipePairCount = 2;
const int kWaitDistance = 100;

/**
 * The radius of the bird
 */
const int kBirdRadius = 15;

/**
 * The width and height of the design resolution
 */
const int kDesignWidth = 288;
const int kDesignHeight = 512;

/**
 * The tag of game layer in the scene
 */
const int kGameLayerTag = 101;

#endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值