Quelcode des Partikelsystems Boden
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.

avatar.cpp 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // avatar.cpp
  3. // emptyExample
  4. //
  5. // Created by Sebastian Holzki on 17.04.19.
  6. //
  7. #include "avatar.hpp"
  8. Avatar::Avatar(int playerType){
  9. setup(playerType);
  10. }
  11. // -----------------------------------------
  12. Avatar::~Avatar(){
  13. }
  14. // -----------------------------------------
  15. void Avatar::setup(int playerType){
  16. //Load the right icon from data in ofImage, by using the transmitted info about the playerType
  17. // --> icon = ....
  18. }
  19. // -----------------------------------------
  20. void Avatar::update(){
  21. }
  22. // -----------------------------------------
  23. void Avatar::draw(){
  24. icon.draw(position);
  25. }
  26. // -----------------------------------------
  27. ofVec2f Avatar::getPosition(){
  28. return position;
  29. }
  30. // -----------------------------------------
  31. void Avatar::setPosition(int _x, int _y){
  32. position.x = _x;
  33. position.y = _y;
  34. }
  35. void Avatar::setPosition(ofVec2f _position){
  36. position = _position;
  37. }
  38. // -----------------------------------------
  39. void Avatar::clipToAvatar(Avatar _avatar){
  40. //Read coordinates to clip to:
  41. ofVec2f tempCoords = _avatar.getPosition();
  42. if( tempCoords.y == 0 ){
  43. position.x = tempCoords.x + 20 ;
  44. position.y = tempCoords.y + 20 ;
  45. }else{
  46. position.x = tempCoords.x + 20 ;
  47. position.y = tempCoords.y - 20 ;
  48. }
  49. }