From 302ad5dd367b593c283f1bdbbf1e3e66c81ba2e7 Mon Sep 17 00:00:00 2001 From: thermodynamicallyunfavored Date: Fri, 4 Dec 2015 13:42:14 -0500 Subject: [PATCH 1/4] added function to draw rect started on funcitno for circle --- VoidFunctions/VoidFunctions.pde | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 8b13789..27db157 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -1 +1,18 @@ +void setup() { + size(800, 600); //size of canvas +} +void draw() { + drawsquare(); //draw square +} + +void drawsquare () { //create function draw rect + rectMode(CENTER); //draws rect from cneter + fill(201, 234, 245); // makes rect blue + rect(width/2, height/2, 50, 50); //draws 50 x 50 square in center of screen +} + + +void drawcircle(){ //create function drwa circle + +} \ No newline at end of file From c39e70c44aef96b46ade142584de63d5d87ed9c2 Mon Sep 17 00:00:00 2001 From: thermodynamicallyunfavored Date: Fri, 4 Dec 2015 13:46:58 -0500 Subject: [PATCH 2/4] added drawcircle function --- VoidFunctions/VoidFunctions.pde | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 27db157..13c2423 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -3,7 +3,9 @@ void setup() { } void draw() { + background(242, 250, 240); //draws bg with super light green bg drawsquare(); //draw square + drawcircle(random(255), random(255), random(255)); //calls on drawcircle function } void drawsquare () { //create function draw rect @@ -13,6 +15,7 @@ void drawsquare () { //create function draw rect } -void drawcircle(){ //create function drwa circle - +void drawcircle(float r, float g, float b) { //create function drwa circle user can define circle + fill(r, g, b); //can make circle different color with parameters later + ellipse(mouseX, mouseY, 30, 30); //creates ellipse where mouse is w/ diameter of 30 } \ No newline at end of file From a04fc7d5a5cff8a3c57616dfcea1ab4dd97ed49c Mon Sep 17 00:00:00 2001 From: thermodynamicallyunfavored Date: Fri, 4 Dec 2015 14:37:49 -0500 Subject: [PATCH 3/4] added flyingballs function --- VoidFunctions/VoidFunctions.pde | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 13c2423..2628beb 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -5,7 +5,8 @@ void setup() { void draw() { background(242, 250, 240); //draws bg with super light green bg drawsquare(); //draw square - drawcircle(random(255), random(255), random(255)); //calls on drawcircle function + drawcircle(random(191), random(232), random(181)); //calls on drawcircle function + flyingball(random(width), random(height), 20, 3, 6); } void drawsquare () { //create function draw rect @@ -18,4 +19,10 @@ void drawsquare () { //create function draw rect void drawcircle(float r, float g, float b) { //create function drwa circle user can define circle fill(r, g, b); //can make circle different color with parameters later ellipse(mouseX, mouseY, 30, 30); //creates ellipse where mouse is w/ diameter of 30 +} + +void flyingball (float x, float y, float d, float velx, float vely) { + ellipse(x, y, d, d); //draw ellipse + x += velx; // ives ball velocity + y += vely; //gives ball velocity } \ No newline at end of file From 362b8de076ed4c9da3f05d9a513eb686d53398a1 Mon Sep 17 00:00:00 2001 From: thermodynamicallyunfavored Date: Fri, 4 Dec 2015 14:50:28 -0500 Subject: [PATCH 4/4] added addition function --- VoidFunctions/VoidFunctions.pde | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 2628beb..97b4f0e 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -4,6 +4,7 @@ void setup() { void draw() { background(242, 250, 240); //draws bg with super light green bg + println(add(3, 2)); drawsquare(); //draw square drawcircle(random(191), random(232), random(181)); //calls on drawcircle function flyingball(random(width), random(height), 20, 3, 6); @@ -25,4 +26,9 @@ void flyingball (float x, float y, float d, float velx, float vely) { ellipse(x, y, d, d); //draw ellipse x += velx; // ives ball velocity y += vely; //gives ball velocity +} + +int add(int x, int y) { //addition function + int c = x + y; + return c; //gives out c } \ No newline at end of file