NYUAD Mobile Media » Class 4 http://www.mobvcasting.com/nyuadmobilemedia/notes Notes for NYU Abu Dhabi Mobile Media Course Taught by Shawn Van Every, Spring 2012 Fri, 04 May 2012 08:03:11 +0000 en-US hourly 1 http://wordpress.org/?v=3.4.2 while and for loop example http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/while-and-for-loop-example/ http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/while-and-for-loop-example/#comments Mon, 06 Feb 2012 20:05:17 +0000 vanevery http://www.mobvcasting.com/nyuadmobilemedia/notes/?p=87 0) { rect(x,0,mouseX/2,height); x = x + mouseX; println(x); } */ for (int x = 0; … Continue reading ]]> //int x = 0; void setup() { fill(0); size(400,400); } void draw() { background(255,255,255); /* x = 0; while(x < width && mouseX > 0) { rect(x,0,mouseX/2,height); x = x + mouseX; println(x); } */ for (int x = 0; x < width && mouseX > 0; x = x+mouseX) { rect(x,0,mouseX/2,height); } } ]]> http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/while-and-for-loop-example/feed/ 0 Bouncing Code – Start http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/bouncing-code-start/ http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/bouncing-code-start/#comments Mon, 06 Feb 2012 12:51:55 +0000 vanevery http://www.mobvcasting.com/nyuadmobilemedia/notes/?p=85 Continue reading ]]> int rectWidthHeight; int rectX; int rectY; int direction = 10; void setup() { println("setup"); println("width " + width); println("height " + height); //frameRate(1); //rectMode(CENTER); rectWidthHeight = 50; rectX = mouseX; rectY = mouseY; } void draw() { background(120,120,120); rectWidthHeight = mouseX; rect((width/2)-(rectWidthHeight/2),(height/2)-rectWidthHeight/2,rectWidthHeight,rectWidthHeight); //println("draw"); if (mousePressed) { rectX = mouseX; rectY = mouseY; } if (rectX < 0 || rectY < 0) { direction = direction * -1; } if (rectX > width) { direction = direction * -1; } if (rectY > height) { direction = direction * -1; } rectX = rectX + direction; rectY = rectY + direction; rect(rectX,rectY,50,50); } ]]> http://www.mobvcasting.com/nyuadmobilemedia/notes/2012/02/06/bouncing-code-start/feed/ 0