Exemplo n.º 1
0
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button) {

    int which = ofRandom(0, 2.99);

    if(which == 0) {
        float radius = ofRandom(3, 13);

        bubbles.push_back(ofxChipmunkCircle());
        bubbles.back().setup(x, y, radius, radius, 1, .8, false);
        physics.addShape(&bubbles.back());
    } else if(which == 1) {
        float radius = ofRandom(3, 13);

        bubbles.push_back(ofxChipmunkCircle());
        bubbles.back().setup(x, y, radius, radius, 1, .8, false);
        physics.addShape(&bubbles.back());

        bubbles.push_back(ofxChipmunkCircle());
        bubbles.back().setup(x+radius*radius*0.6, y, radius, radius, 1, .8, false);
        physics.addShape(&bubbles.back());

        physics.addJoint(&bubbles[bubbles.size()-2], &bubbles.back());
    }
    else if(which == 2) {
        float radius = ofRandom(9, 25);

        rects.push_back(ofxChipmunkRect());
        rects.back().setup(x, y, radius, radius, radius, 1, .8, false);
        physics.addShape(&rects.back());
    }

}
Exemplo n.º 2
0
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
	float radius = ofRandom(3, 10);
	
	bubbles.push_back(ofxChipmunkCircle());
	bubbles.back().setup(x, y, radius, radius, .5, .2, false);
	physics.addShape(&bubbles.back());
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
	for(int i=0; i<50; i++) {
		float radius = ofRandom(3, 10);
		
		bubbles.push_back(ofxChipmunkCircle());
		bubbles.back().setup(mouseX + ofRandom(-radius, radius), mouseY+ ofRandom(-radius, radius), radius, radius, .5, .2, false);
		physics.addShape(&bubbles.back());
	}
}