您的位置:首页 > 其它

实现子弹自动向前运动 定时器 移动精灵 精灵释放

2011-07-18 20:55 351 查看
#import "cocos2d.h"#import "Bullet.h"

@implementation Bullet////-(id) init//{// self = [super init];// if (self)// {// self = [CCSprite spriteWithFile:@"0001.png"];// //;// }// return self;//}//

-(void)start1{ //定时期设定 [self schedule:@selector(up) interval:1/20.0];}//自己运行-(void )up{ CGFloat x; x= self.position.x; //NSLog(@"%f",self.position.y); // int y=self.position.y +10; self.position = ccp(x, y); if (y> 480) {//自动把精灵释放 [self removeFromParentAndCleanup:YES]; } }
-(void)dealloc { [super dealloc];}@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐