iphone 游戏开发备忘

1. iphone/ipad 禁止系统自动休眠
//禁止自动休眠可以通过这一句话搞定:
[UIApplication sharedApplication].idleTimerDisabled=YES;

//当然一定要慎用,记着退出程序时把自动休眠功能开启
UIApplication sharedApplication].idleTimerDisabled=NO;

2. 精灵碰撞检测

CGRect projectileRect = CGRectMake(projectile.position.x , projectile.position.y , projectile.contentSize.width , projectile.contentSize.height );

CGRect targetRect = CGRectMake(target.position.x , target.position.y , target.contentSize.width, target.contentSize.height);

if (CGRectIntersectsRect(projectileRect, targetRect)) {
// 碰撞了.
}


第一个代表rect是a物体在屏幕上占的空间.第二个rect是b物体占的空间.两个空间相交则表示碰撞了.
现在 正在做的游戏中用到了.

3. 编译无法上真机
错误提示
Couldn't register XXX(授权文件名称) with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.

[解决办法]
重启iphone

[导致问题的原因]
错误的插拔数据线,在debug联机状态,没有停止debug而直接拔掉数据线.


4. cocos2d 动画

http://www.cnblogs.com/ylucy/archive/2010/12/04/1896562.html


5. 心脏缚动动画
lbl_taskwin.anchorPoint = ccp( 0.5, 0.5 ); //center the pivot
id a1 = [CCScaleTo actionWithDuration:1 scaleX:1.2 scaleY:1.2];
id a2 = [CCScaleTo actionWithDuration:1 scaleX:1 scaleY:1];
id action = [CCRepeatForever actionWithAction: [CCSequence actions:a1, a2, nil]];
[lbl_taskwin runAction:action];

6. 布料背景:
[UIColor scrollViewTexturedBackgroundColor];

7. IOS5 UISegmentedControl变更
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值