📄 worldobject.cpp
字号:
#include "LlamaWorks2d.h"
using namespace llamaworks2d;
#include "WorldObject.h"
world_object::world_object() :
collisionWidth(0),
collisionHeight(0),
collidable(true),
visible(true),
next(NULL)
{
}
// Transform to world coordinates and render.
bool world_object::Render( invasion *theGame)
{
return (true);
}
// Get a chance to update internal state every
// frame.
bool world_object::Update( invasion *theGame)
{
return (true);
}
void world_object::Hit( world_object &stationary)
{
}
bool world_object::Intersects(
world_object &other)
{
if (collidable==false ||
other.collidable==false)
{
return (false);
}
if (worldPos.X() + collisionWidth <
other.worldPos.X())
{
return (false);
}
if (worldPos.X() >
other.worldPos.X() + other.collisionWidth)
{
return (false);
}
if (worldPos.Y() + collisionHeight <
other.worldPos.Y())
{
return (false);
}
if (worldPos.Y() >
other.worldPos.Y() + other.collisionHeight)
{
return (false);
}
return (true);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -