当前位置: 首页>>代码示例>>C++>>正文


C++ AnimatedSprite::getSpriteType方法代码示例

本文整理汇总了C++中AnimatedSprite::getSpriteType方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::getSpriteType方法的具体用法?C++ AnimatedSprite::getSpriteType怎么用?C++ AnimatedSprite::getSpriteType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnimatedSprite的用法示例。


在下文中一共展示了AnimatedSprite::getSpriteType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update


//.........这里部分代码省略.........
		// TO FIGURE OUT HOW TO DO THIS AND HOW TO RESOLVE SUCH COLLISIONS

		// RECYCLE THE COLLISION SINCE WE'RE NOW DONE WITH IT
		recycledCollisions.push_back(earliestCollision);
	}

	// APPLY THE REMAINING TIME TO MOVE THE SPRITES. NOTE THAT
	// THIS IS ACTUALLY A VERY RISKY, TRICKY STEP BECAUSE IT COULD
	// MOVE OBJECTS ALMOST TO THE POINT OF COLLISION, WHICH MAY THEN
	// BE DETECTED ALMOST AT TIME 0 NEXT FRAME. THERE ARE OTHER TRICKY
	// ISSUES RELATED TO OUR BUFFER AS WELL, SO WE CHEAT A LITTLE HERE
	// AND SCALE THE TIME REMAINING DOWN A LITTE
	if (currentCollisionTime < 1.0f)
		moveAllSpritesToEndOfFrame();

	// INIT TILE COLLISION INFO
	// SET ON TILE LAST FRAME USING ON TILE THIS FRAME
	// SET ON TILE THIS FRAME TO FALSE
	spritesIt = sortedSweptShapes[LEFT_EDGE]->begin();
	while (spritesIt != sortedSweptShapes[LEFT_EDGE]->end())
	{
		CollidableObject *sprite = (*spritesIt);
		sprite->advanceOnTileStatus();
		spritesIt++;
	}
//	while(!colliding){
	for (b2Contact* contact = game->getbworld()->GetContactList(); contact; contact = contact->GetNext()) {
		b2Body* a = contact->GetFixtureA()->GetBody(); 
		b2Body* b = contact->GetFixtureB()->GetBody();

		AnimatedSprite* c = (AnimatedSprite*) a->GetUserData(); 
		AnimatedSprite* d = (AnimatedSprite*) b->GetUserData();

		unsigned int x = c->getSpriteType()->getSpriteTypeID(); 
		unsigned int y = d->getSpriteType()->getSpriteTypeID();
		
		switch(x){
		case 0: // player 
			break;
		case 1: // 
			break;
		case 2:
			GarbageMon *e; 
			e= (GarbageMon*)c;
			//co.remove(e);
			//game->getbworld()->DestroyBody(e->getBody());
			//e->collisionResponse(game);
			break;
		case 4:
			//Trash *f = (Trash*)c;
			//f->collisionResponse(game);
			break;
		}
		
		switch(y){
		//	if (x == 0) {
				case 0: // player 
					break;
				case 1: // 
					break;
				case 2:
		//			colliding = true;
					GarbageMon *g;
					g= (GarbageMon*)d;
					co.push_back(g);
					co.remove(g);
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的AnimatedSprite::getSpriteType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。