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


C++ ANIMATE函数代码示例

本文整理汇总了C++中ANIMATE函数的典型用法代码示例。如果您正苦于以下问题:C++ ANIMATE函数的具体用法?C++ ANIMATE怎么用?C++ ANIMATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ai_miserys_bubble

void ai_miserys_bubble(Object *o)
{
    Object *target;

    switch(o->state)
    {
    case 0:
    {
        // find the Toroko object we are to home in on
        target = mbubble_find_target();
        if (!target)
        {
            o->state = 9999;
            return;
        }

        o->xmark = target->x - (6 << CSF);
        o->ymark = target->y - (6 << CSF);

        ThrowObject(o, o->xmark, o->ymark, 0, (2 << CSF));
        o->state = 1;

        // correct values: 0x3F0, 0xAE
        NX_LOG("Computed toss values xi: 0x%x, 0x%x\n", o->xinertia, o->yinertia);
        NX_LOG("Target x/y: 0x%x, 0x%x\n", target->x, target->y);
    }
    case 1:
        ANIMATE(1, 0, 1);

        if (abs(o->x - o->xmark) <= (3 << CSF) && \
                abs(o->y - o->ymark) <= (3 << CSF))
        {
            o->state = 2;
            o->frame = 2;
            sound(SND_BUBBLE);

            if ((target = mbubble_find_target()))
                target->invisible = true;
        }
        break;

    case 2:
    {
        ANIMATE(1, 2, 3);

        o->xinertia -= 0x20;
        o->yinertia -= 0x20;
        LIMITX(0x5FF);
        LIMITY(0x5FF);

        if (o->y < -1000)
            o->Delete();
    }
    break;
    }
}
开发者ID:helmyarkan12,项目名称:nxengine-libretro,代码行数:56,代码来源:misery.cpp

示例2: ai_npc_igor

// cutscene igor
void ai_npc_igor(Object *o)
{
	switch(o->state)
	{
		case 0:		// init, standing/panting
			o->xinertia = 0;
			o->frame = 0;
			o->animtimer = 0;
			o->state = 1;
		case 1:
			ANIMATE(5, 0, 1);
		break;
		
		case 2:		// walking
			o->state = 3;
			o->frame = 2;
			o->animtimer = 0;
		case 3:
			ANIMATE(3, 2, 5);
			XMOVE(0x200);
		break;
		
		case 4:		// punch
			o->xinertia = 0;
			o->state = 5;
			o->timer = 0;
		case 5:
			o->frame = 6;
			if (++o->timer > 10)
			{
				o->timer = 0;
				o->state = 6;
				sound(SND_EXPL_SMALL);
			}
		break;
		case 6:
			o->frame = 7;
			if (++o->timer > 8)
			{
				o->state = 0;
				o->frame = 0;
			}
		break;
		
		case 7:
			o->state = 1;
		break;
	}
	
	o->yinertia += 0x40;
	LIMITY(0x5FF);
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:53,代码来源:igor.cpp

示例3: ai_mesa_block

void ai_mesa_block(Object *o)
{
        ANIMATE(0, 0, 1);

        switch(o->state) {
        case 0: {	// being held
                if (!o->linkedobject || o->linkedobject->type == OBJ_MESA_DYING) {
                        o->Delete();
                }
        }
        break;

        case 1: {	// launched
                if (++o->timer == 4)
                        o->flags &= ~FLAG_IGNORE_SOLID;

                o->yinertia += 0x2A;
                LIMITY(0x5ff);

                if (o->blockd && o->yinertia >= 0) {
                        sound(SND_BLOCK_DESTROY);
                        o->Delete();
                }
        }
        break;
        }

        if (o->deleted) {
                SmokeClouds(o, 3, 0, 0);
                effect(o->x, o->y, EFFECT_BOOMFLASH);
        }
}
开发者ID:lluixhi,项目名称:nxengine-evo,代码行数:32,代码来源:hell.cpp

示例4: ai_ironh_shot

void ai_ironh_shot(Object *o)
{
	if (!o->state)
	{
		if (++o->timer > 20)
		{
			o->state = 1;
			o->xinertia = o->yinertia = 0;
			o->timer2 = 0;
		}
	}
	else
	{
		o->xinertia += 0x20;
	}
	
	ANIMATE(0, 0, 2);
	
	if (++o->timer2 > 100 && !o->onscreen)
	{
		o->Delete();
	}
	
	if ((o->timer2 & 3)==1) sound(SND_IRONH_SHOT_FLY);
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:25,代码来源:ironhead.cpp

示例5: ai_green_devil

void ai_green_devil(Object *o)
{
	switch(o->state)
	{
		case 0:
		{
			o->flags |= FLAG_SHOOTABLE;
			o->ymark = o->y;
			o->yinertia = random(-5<<CSF, 5<<CSF);
			o->damage = 3;
			o->state = 1;
		}
		case 1:
		{
			ANIMATE(2, 0, 1);
			o->yinertia += (o->y < o->ymark) ? 0x80 : -0x80;
			
			XACCEL(0x20);
			LIMITX(0x400);
			
			if (o->dir == LEFT)
			{
				if (o->x < -o->Width())
					o->Delete();
			}
			else
			{
				if (o->x > ((map.xsize * TILE_W) << CSF) + o->Width())
					o->Delete();
			}
		}
		break;
	}
	
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:35,代码来源:ballos_misc.cpp

示例6: ai_ballos_target

// targeter for lightning strikes
void ai_ballos_target(Object *o)
{
	switch(o->state)
	{
		case 0:
		{
			// position to shoot lightning at passed as x,y
			o->xmark = o->CenterX() - ((sprites[SPR_LIGHTNING].w / 2) << CSF);
			o->ymark = o->CenterY();
			
			// adjust our Y coordinate to match player's
			o->y = player->CenterY();
			
			sound(SND_CHARGE_GUN);
			o->state = 1;
		}
		case 1:
		{
			ANIMATE(1, 0, 1);
			o->timer++;
			
			if (o->timer == 20 && o->dir == LEFT)
			{	// lightning attack
				// setting lightning dir=left: tells it do not flash screen
				CreateObject(o->xmark, o->ymark, OBJ_LIGHTNING)->dir = LEFT;
			}
			
			if (o->timer > 40)
				o->Delete();
		}
		break;
	}
	
}
开发者ID:Angluca,项目名称:nxengine-libretro,代码行数:35,代码来源:ballos_priest.cpp

示例7: ai_doctor

void ai_doctor(Object *o)
{
	switch(o->state)
	{
		case 10:	// he chuckles
			o->state = 11;
			o->timer2 = 0;
			o->frame = 1;
			o->animtimer = 0;
		case 11:
			ANIMATE(6, 0, 1);
			if (++o->timer2 > 8*6) { o->frame = 0; o->state = 1; }
		break;
		
		case 20:	// he rises up and hovers
		{
			o->state = 21;
			o->timer = 0;
			o->frame = 2;
			o->ymark = o->y - (32 << CSF);
		}
		case 21:
		{
			o->yinertia += (o->y > o->ymark) ? -0x20 : 0x20;
			LIMITY(0x200);
		}
		break;
		
		case 30:	// he teleports away
		{
			o->timer = 0;
			o->frame = 2;
			o->yinertia = 0;
			o->state++;
		}
		case 31:
		{
			if (DoTeleportOut(o, 1))
				o->Delete();
		}
		break;
		
		case 40:	// he teleports in and hovers
		{
			o->timer = 0;
			o->state = 41;
			o->frame = 2;
		}
		case 41:
		{
			if (DoTeleportIn(o, 1))
			{
				o->state = 20;
				o->yinertia = -0x200;
			}
		}
		break;
	}
}
开发者ID:Angluca,项目名称:nxengine-libretro,代码行数:59,代码来源:npcregu.cpp

示例8: ai_ballos_skull

void ai_ballos_skull(Object *o)
{
	ANIMATE(8, 0, 3);
	
	switch(o->state)
	{
		case 0:
		{
			o->state = 100;
			o->frame = random(0, 16) & 3;
		}
		case 100:
		{
			o->yinertia += 0x40;
			LIMITY(0x700);
			
			if (o->timer++ & 2)
			{
				(SmokePuff(o->x, o->y))->PushBehind(o);
			}
			
			if (o->y > 0x10000)
			{
				o->flags &= ~FLAG_IGNORE_SOLID;
				
				if (o->blockd)
				{
					o->yinertia = -0x200;
					o->state = 110;
					o->flags |= FLAG_IGNORE_SOLID;
					
					quake(10, SND_BLOCK_DESTROY);
					
					for(int i=0;i<4;i++)
					{
						Object *s = SmokePuff(o->x + random(-12<<CSF, 12<<CSF), \
											  o->y + 0x2000);
						
						s->xinertia = random(-0x155, 0x155);
						s->yinertia = random(-0x600, 0);
						s->PushBehind(o);
					}
				}
			}
		}
		break;
		
		case 110:
		{
			o->yinertia += 0x40;
			
			if (o->Top() >= (map.ysize * TILE_H) << CSF)
			{
				o->Delete();
			}
		}
		break;
	}
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:59,代码来源:ballos_misc.cpp

示例9: ai_bute_flying

void ai_bute_flying(Object *o)
{
        //AIDEBUG;
        if (run_bute_defeated(o, BUTE_HP))
                return;

        switch(o->state) {
        case 0: {
                o->invisible = true;
                o->state = 1;
        }
        case 1: {
                if (o->dir == LEFT) {
                        if (player->x > (o->x - (288<<CSF)) && \
                                        player->x < (o->x - (272<<CSF))) {
                                o->state = 10;
                        }
                } else {
                        if (player->x < (o->x + (288<<CSF)) && \
                                        player->x > (o->x + (272<<CSF))) {
                                o->state = 10;
                        }
                }
        }
        break;

        case 10: {
                o->state = 11;
                o->invisible = false;
                o->flags |= FLAG_SHOOTABLE;
                o->damage = 5;
        }
        case 11: {
                FACEPLAYER;
                ANIMATE(1, 0, 1);

                XACCEL(0x10);
                o->yinertia += (o->y > player->y) ? -0x10 : 0x10;

                LIMITX(0x5ff);
                LIMITY(0x5ff);

                if ((o->blockl && o->xinertia < 0) || \
                                (o->blockr && o->xinertia > 0)) {
                        o->xinertia = -o->xinertia;
                }

                if ((o->blockd && o->yinertia > 0) || \
                                (o->blocku && o->yinertia < 0)) {
                        o->yinertia = -o->yinertia;
                }


        }
        break;
        }

}
开发者ID:lluixhi,项目名称:nxengine-evo,代码行数:58,代码来源:hell.cpp

示例10: ai_bat_circle

void ai_bat_circle(Object *o)
{
	switch(o->state)
	{
		case 0:
		{
			uint8_t angle;
			o->state = 1;
			
			// set up initial direction and target x,y
			angle = random(0, 255);
			o->xinertia = sin_table[angle];
			
			angle += 64;
			o->xmark = (o->x + (sin_table[angle] * 8));
			
			angle = random(0, 255);
			o->yinertia = sin_table[angle];
			
			angle += 64;
			o->ymark = (o->y + (sin_table[angle] * 8));
		}
		case 1:
			// circle around our target point
			ANIMATE(1, 2, 4);
			FACEPLAYER;
			o->xinertia += (o->x > o->xmark) ? -0x10 : 0x10;
			o->yinertia += (o->y > o->ymark) ? -0x10 : 0x10;
			LIMITX(0x200);
			LIMITY(0x200);
			
			if (!o->timer2)
			{
				if (pdistlx(0x1000) && (player->y > o->y) && pdistly(0xC000))
				{	// dive attack
					o->xinertia /= 2;
					o->yinertia = 0;
					o->state = 2;
					o->frame = 5;		// mouth showing teeth
				}
			}
			else o->timer2--;
		break;
		
		case 2:	// dive attack
			o->yinertia += 0x40;
			LIMITY(0x5ff);
			
			if (o->blockd)
			{
				o->yinertia = 0;
				o->xinertia *= 2;
				o->timer2 = 120;		// delay before can dive again
				o->state = 1;
			}
		break;
	}
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:58,代码来源:weed.cpp

示例11: ai_bute_falling

void ai_bute_falling(Object *o)
{
        ANIMATE(3, 0, 3);

        switch(o->state) {
        case 0: {
                o->state = 1;
                o->MoveAtDir(o->dir, 0x600);
                o->flags |= FLAG_IGNORE_SOLID;
        }
        case 1: {
                o->timer++;

                if (o->timer == 16) {
                        o->flags &= ~FLAG_IGNORE_SOLID;
                } else if (o->timer > 16 && o->block[o->dir]) {
                        o->state = 10;
                }

                if (o->timer > 20) {
                        switch(o->dir) {
                        case LEFT:
                                if (o->CenterX() <= player->CenterX() + (32<<CSF))
                                        o->state = 10;
                                break;

                        case RIGHT:
                                if (o->CenterX() >= player->CenterX() - (32<<CSF))
                                        o->state = 10;
                                break;

                        case UP:
                                if (o->CenterY() <= player->CenterY() + (32<<CSF))
                                        o->state = 10;
                                break;

                        case DOWN:
                                if (o->CenterY() >= player->CenterY() - (32<<CSF))
                                        o->state = 10;
                                break;
                        }
                }
        }
        break;

        case 10: {
                o->y += (4 << CSF);
                o->ChangeType(OBJ_BUTE_FLYING);
                o->state = 10;	// trigger flight immediately

                o->frame = 0;
                o->xinertia = 0;
                o->yinertia = 0;
        }
        break;
        }
}
开发者ID:lluixhi,项目名称:nxengine-evo,代码行数:57,代码来源:hell.cpp

示例12: ai_misery_ring

void ai_misery_ring(Object *o)
{
	if (!o->linkedobject)
	{
		SmokeClouds(o, 3, 2, 2);
		o->Delete();
		return;
	}
	
	switch(o->state)
	{
		case 0:
		{
			o->state = 1;
			o->timer = 0;
		}
		case 1:
		{
			// distance from misery
			if (o->timer < 192)
				o->timer++;
			
			// turn to bats when misery teleports
			if (o->linkedobject->state >= STATE_TP_AWAY && \
				o->linkedobject->state < STATE_TP_AWAY+10)
			{
				o->state = 10;
			}
		}
		break;
		
		case 10:	// transform to bat
		{
			o->flags |= FLAG_SHOOTABLE;
			o->flags &= ~FLAG_INVULNERABLE;
			
			ThrowObjectAtPlayer(o, 3, 0x200);
			FACEPLAYER;
			
			o->sprite = SPR_ORANGE_BAT_FINAL;
			o->state = 11;
		}
		case 11:
		{
			ANIMATE(4, 0, 2);
			
			if ((o->dir == LEFT && o->blockl) || \
				(o->dir == RIGHT && o->blockr) || \
				o->blocku || o->blockd)
			{
				SmokeClouds(o, 3, 2, 2);
				o->Delete();
			}
		}
		break;
	}
}
开发者ID:GameMaker2k,项目名称:NXEngine,代码行数:57,代码来源:misery.cpp

示例13: ai_mannan_shot

void ai_mannan_shot(Object *o)
{
	XACCEL(0x20);
	ANIMATE(0, 1, 2);
	
	if ((o->timer & 3) == 1)
		sound(SND_IRONH_SHOT_FLY);
	
	if (++o->timer > 100)
		o->Delete();
}
开发者ID:Fordi,项目名称:nxengine-evo,代码行数:11,代码来源:weed.cpp

示例14: ai_black_lightning

void ai_black_lightning(Object *o)
{
	ANIMATE(0, 0, 1);
	o->yinertia = 0x1000;
	
	if (o->blockd)
	{
		effect(o->CenterX(), o->Bottom(), EFFECT_BOOMFLASH);
		SmokeXY(o->CenterX(), o->Bottom(), 3, o->Width()>>CSF, 4);
		o->Delete();
	}
开发者ID:GameMaker2k,项目名称:NXEngine,代码行数:11,代码来源:misery.cpp

示例15: ai_firewhirr_shot

void ai_firewhirr_shot(Object *o)
{
    ANIMATE(1, 0, 2);
    o->x += (o->dir==LEFT) ? -0x200 : 0x200;

    if ((o->dir==LEFT && o->blockl) || (o->dir==RIGHT && o->blockr))
    {
        if (o->dir == RIGHT) o->x += o->Width();
        effect(o->x, o->CenterY(), EFFECT_FISHY);
        o->Delete();
    }
}
开发者ID:GameMaker2k,项目名称:NXEngine,代码行数:12,代码来源:labyrinth_m.cpp


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