Exemplo n.º 1
0
void CollisionHandler::SendNewObjectPositionToGFX(DisplayableObject& _obj)
{
	// Send information about the object that has been hit (for gfx to know about states changes)
	EngineEvent redisplayObject(INFO_POS_LVL);
	if (_obj.GetClass() == PLAYER || _obj.GetClass() == ENEMY)
		redisplayObject.set(INFO_POS_CHAR, _obj.GetInfoForDisplay());
	else
		redisplayObject.set(INFO_POS_LVL, _obj.GetInfoForDisplay());
	m_gameEngine->TransmitInfoToGFX(redisplayObject);
}
Exemplo n.º 2
0
void CollisionHandler::ReactToCollisionsWithObj(MovingObject& _obj, DisplayableObject& _ref, CollisionDirection _direction)
{
	ReactToCollision(_obj, _ref.GetCoordinates(), _direction);

	_obj.UpdateAfterCollision(Util::OppositeCollisionDirection(_direction), _ref.GetClass()); // Updates the state of the object, not its coordinates
	_obj.SetPosition(m_gameEngine->GetCoordinatesOfForegroundItem(_obj.GetID()));

	_ref.UpdateAfterCollision(_direction, _obj.GetClass());

	SendNewObjectPositionToGFX(_ref);
}