Advertisement
Guest User

Untitled

a guest
May 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include "ball.h"
  2.  
  3. Ball::Ball() {
  4.  
  5. }
  6.  
  7. Ball::Ball(ofColor color) {
  8. this->color = color;
  9. }
  10.  
  11. void Ball::drawBall() {
  12. ofSetColor(color);
  13. ofDrawCircle(pos.x, pos.y, 30);
  14. ofSetCircleResolution(60);
  15. }
  16. void Ball::moveBall() {
  17. pos += vel;
  18. if (pos.x > ofGetWidth() || pos.x < 0) {
  19. vel.x *= -1;
  20. }
  21. if (pos.y > ofGetHeight() || pos.y < 0) {
  22. vel.y *= -1;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement