#include "bug.h"
#include "debuggers.h"
#include <iostream>
#include <random>

namespace pabloader {
Bug::Bug(Debuggers* game)
    : Entity(game, &game->enemiesSprite)
{
    tileDim.x = 2;
#ifdef _DEBUG
    DEBUG_COLOR = olc::RED;
#endif
}

BugParticle::BugParticle(Debuggers* game)
    : Entity(game, &game->enemiesSprite)
{
    size.x = sprite->width / 8;
    size.y = sprite->height / 8;
#ifdef _DEBUG
    DEBUG_COLOR = olc::MAGENTA;
#endif
}

void BugParticle::ResetParticle(Bug* bug, uint8_t index)
{
    vel.x = bug->vel.x + ((index & 0b01) ? 10: -10);
    vel.y = bug->vel.y + ((index & 0b10) ? 10: -10);

    pos = bug->pos;

    rotation = bug->rotation;

    tile.x = bug->tile.x * 2 + ((index & 0b01) ? 1: 0);
    tile.y = bug->tile.y * 2 + ((index & 0b10) ? 1: 0);
}
}