#include "ofBall.h"

ofBall::ofBall(){
	x = ofGetScreenWidth()/2;
	y = ofGetScreenHeight()/2;
	speedX = ofRandom(-5, 5);
	speedY = ofRandom(-5, 5);
};

void ofBall::update(){
	x += speedX;
	y += speedY;
	
	if(x < 0 || x > ofGetWidth())		speedX *= -1;
	if(y < 0 || y > ofGetHeight())		speedY *= -1;
}

void ofBall::draw(){
	
	ofSetColor(0xFFBB00);
	ofCircle(x, y, 20);
	
	string pos = ofToString(x, 0) + ", " + ofToString(y, 0) ;
	ofDrawBitmapString(pos, x-30,y+40);
	
	ofSetColor(0x00AEEF);
}