Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ball.h"
- Ball::Ball() {
- }
- Ball::Ball(ofColor color) {
- this->color = color;
- }
- void Ball::drawBall() {
- ofSetColor(color);
- ofDrawCircle(pos.x, pos.y, 30);
- ofSetCircleResolution(60);
- }
- void Ball::moveBall() {
- pos += vel;
- if (pos.x > ofGetWidth() || pos.x < 0) {
- vel.x *= -1;
- }
- if (pos.y > ofGetHeight() || pos.y < 0) {
- vel.y *= -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement