标签:style blog http io color ar os 使用 sp
主角眼熟吗?没错,上次跑酷游戏中的“30”来Jump了,有三种道具,主角光环,竹蜻蜓,翅膀; 有两种怪物,螃蟹和鸟; 有5种板子。点击屏幕,30会把它的嘴巴3给发射出去,可以攻击怪物。上次的跑酷参考《cocos2d 简单高仿天天跑酷游戏》 ,苹果已经审核通过...但做的很差,后续有时间再更新。后面考虑会出更多的该主角游戏。
其实蛮讨厌"高仿"这两个字的,争取下一款游戏有更多原创部分。
float minPositionY = 0; void update(float dt){ //follow the hero float nextPositionY = VISIBLE_HEIGHT / 2 - hero->getPositionY(); if(nextPositionY < minPositionY){ minPositionY = nextPositionY; this->setPositionY(minPositionY); } }
deque<JumpBoard*> _boardObjects; void generateSomeBoards(const int& lastPositionX,int startPosition,const int& count); void createAndRemoveObjects(float dt){ if(_pause == true){ return; } if(_boardObjects.size() <= 12){//generate some boards if we only have few boards JumpBoard *lastBoard = _boardObjects.back(); generateSomeBoards(lastBoard->getPositionX(), lastBoard->getPositionY() + getGeneratorHigh(),5); } //remove unused boards JumpBoard* firstBoard = _boardObjects.front(); if(hero->getPositionY() - firstBoard->getPositionY() > 600){ firstBoard->removeFromParent(); _boardObjects.pop_front(); } }
typedef enum{ kNormalBoard, //0 kCloudBoard, //1 kMoveBoard, //2 kMoveLttleBoard, //3 kSpringBoard //4 }JumpBoardType; int level1[] = {0,0,0,0,0,0,0,0,0,0,1,1,1}; int level2[] = {0,0,0,0,0,0,0,0,0,0,1,1,2,3,4};
int getBoardTypeDueToFloorNum(){ int floorCount = getFloorCount(); int result = 0; if(floorCount <= 2){ if(_levelIndex >= _level1.size()){ _levelIndex = 0; random_shuffle(_level1.begin(), _level1.end()); } result = _level1[_levelIndex]; ++_levelIndex; return result; }else if(floorCount > 2 && floorCount <= 10){ if(_levelIndex >= _level2.size()){ _levelIndex = 0; random_shuffle(_level2.begin(), _level2.end()); } result = _level2[_levelIndex]; ++_levelIndex; return result; }else{ //无限模式 } }
//typedef enum{ // kHelicopterItem, //0 // kFlyItem, //1 // kShortItem, //2 // kLongItem, //3 // kDefenceBall //4 //}EatItemType; int allEatItemType[] = {4,4,4,0,0,1};
标签:style blog http io color ar os 使用 sp
原文地址:http://blog.csdn.net/fox64194167/article/details/40951285