ProjectileEmitter.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * 2D Game Engine
  3. * ProjectileEmitter.h:
  4. * Based on pikuma.com 2D game engine in C++ and Lua course
  5. * Copyright (c) 2021 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 27/02/2021.
  8. */
  9. #ifndef GAMEENGINE_SOURCE_INCLUDE_COMPONENTS_PROJECTILEEMITTER_H
  10. #define GAMEENGINE_SOURCE_INCLUDE_COMPONENTS_PROJECTILEEMITTER_H
  11. #include <SDL.h>
  12. #include <ECS.h>
  13. #include <glm/glm.hpp>
  14. struct ProjectileEmitterComponent
  15. {
  16. glm::vec2 projectileVelocity;
  17. uint32_t repeatFrequency;
  18. uint32_t projectileDuration;
  19. uint32_t hitPercentDamage;
  20. bool isFriendly;
  21. int lastEmissionTime;
  22. ProjectileEmitterComponent(glm::vec2 projectileVelocity = glm::vec2 (0, 0), uint32_t repeatFrequency = 0,
  23. uint32_t projectileDuration = 10000,
  24. uint32_t hitPercentageDamage = 10,
  25. bool isFriendly= false) : projectileVelocity(projectileVelocity),
  26. repeatFrequency(repeatFrequency),
  27. projectileDuration(projectileDuration),
  28. hitPercentDamage(hitPercentageDamage),
  29. isFriendly(isFriendly)
  30. {
  31. this->lastEmissionTime = SDL_GetTicks();
  32. };
  33. };
  34. #endif /* GAMEENGINE_SOURCE_INCLUDE_COMPONENTS_PROJECTILEEMITTER_H */