【2.0版本cocos2d-iphone 开发之CCProgressTimer制作游戏中的血条】
作者:zhangxinlin转载请注明,原文链接:http://blog.csdn.net/zhang429350061/article/details/8275225
第一次写博客,最近在学习和同僚们的交流过程中整理了一些cocos2d的知识,放在博客里和大家学习交流。希望大牛们多给指导意见,共同进步。
1.首先说一下cocos2d中1.0版本和2.0版本中关于CCProgressTimer的不同之处。在1.0版本里面有许多进度条的样式,
比如:
kCCProgressTimerTypeRadialCCW, 扇形逆时针形式
kCCProgressTimerTypeRadialCW, 扇形顺时针形式
kCCProgressTimerTypeHorizontalBarLR, 从左往右增张的形式
kCCProgressTimerTypeHorizontalBarRL, 从右往左增张的形式
kCCProgressTimerTypeVerticalBarBT, 从下往上增张的形式
kCCProgressTimerTypeVerticalBarTB, 从上往下增张的形式
但是在2.0版本里面没有了这么多的样式,取而代之的是:
typedef enum {
/// Radial Counter-Clockwise
kCCProgressTimerTypeRadial,
/// Bar
kCCProgressTimerTypeBar,
} CCProgressTimerType;
半径类型kCCProgressTimerTypeRadial和条形kCCProgressTimerTypeBar两种类型。
2.讲下怎么使用kCCProgressTimerTypeBar这种类型,另一种kCCProgressTimerTypeRadial使用情况也差不多。
在这里我把我做的一个demo放出来
<div class="dp-highlighter bg_plain" style="font-family: Consolas, 'Courier New', Courier, mono, serif; background-color: #e7e5dc; width: 1091.9666748046875px; overflow: auto; padding-top: 1px; line-height: 26px; margin: 18px 0px !important;"><div class="bar" style="padding-left: 45px;"><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: #f8f8f8; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c;"> view plaincopy<div style="width: 18px; height: 18px;">
页:
[1]