Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "bug.h"
  2. #include "debuggers.h"
  3. #include <iostream>
  4. #include <random>
  5. namespace pabloader {
  6. Bug::Bug(Debuggers* game)
  7. : Entity(game, &game->enemiesSprite)
  8. {
  9. tileDim.x = 2;
  10. #ifdef _DEBUG
  11. DEBUG_COLOR = olc::RED;
  12. #endif
  13. }
  14. BugParticle::BugParticle(Debuggers* game)
  15. : Entity(game, &game->enemiesSprite)
  16. {
  17. size.x = sprite->width / 8;
  18. size.y = sprite->height / 8;
  19. #ifdef _DEBUG
  20. DEBUG_COLOR = olc::MAGENTA;
  21. #endif
  22. }
  23. void BugParticle::ResetParticle(Bug* bug, uint8_t index)
  24. {
  25. vel.x = bug->vel.x + ((index & 0b01) ? 10: -10);
  26. vel.y = bug->vel.y + ((index & 0b10) ? 10: -10);
  27. pos = bug->pos;
  28. rotation = bug->rotation;
  29. tile.x = bug->tile.x * 2 + ((index & 0b01) ? 1: 0);
  30. tile.y = bug->tile.y * 2 + ((index & 0b10) ? 1: 0);
  31. }
  32. }