本文整理汇总了C++中Fish::GetCollisionBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Fish::GetCollisionBox方法的具体用法?C++ Fish::GetCollisionBox怎么用?C++ Fish::GetCollisionBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fish
的用法示例。
在下文中一共展示了Fish::GetCollisionBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Net::Update(float deltaTicks, Fish &fish)
{
switch(state)
{
case START:
frame = 0;
show = true;
released = false;
state = RUNNING;
break;
case RUNNING:
if(CheckCollision(fish.GetCollisionBox(), collisionBox))
{
state = RELEASED;
}
if(collisionBox.y + 64 <= 0)
{
state = CAPTURED;
}
break;
case CAPTURED:
//do wriggle animation
if(!timer.GetStarted())
{
timer.Start();
}
state = END;
break;
case RELEASED:
if(!timer.GetStarted())
{
timer.Start();
}
if(frame == 5)
{
state = END;
released = true;
timer.Stop();
}
if(timer.GetTicks() >= 100)
{
frame += 1;
timer.Stop();
}
break;
case END:
if(!timer.GetStarted())
{
timer.Start();
}
show = false;
released = false;
//this needs to be changed to proper level scaling
posX = (rand() % 2000 - 64);
posY = (rand() % 1000 + 64);
if(timer.GetTicks() >= 3000)
{
state = START;
timer.Stop();
}
break;
}
//BasicSprite::Update(deltaTicks);
collisionBox.x = posX;
collisionBox.y = posY;
collisionBox.h = height;
collisionBox.w = width;
}