Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Bootcamp - Team TEAL - Day 6
1. TEA M TEAL
LIZ RUTLEDGE
DAY 6 rutle173@newschool.edu
August 8, 2011 esrutledge@gmail.com
2. agenda.
Review: Learn:
ALL THE THINGS! FOR LOOPS!
(i.e. anything you guys want me to (hoorayyyyyyyyyyy!)
go over up until now)
seriously though:
you’re gonna thank me later.
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
3. homework
now wasn’t that fun?
displaying text homework:
questions?
let’s look at a few!
review:
displaying images
making things move
simple conditionals
booleans
anything else?
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
4. animation
heading. best practices.
the concepts.
separating out direction and
velocity to simplify your code
the techniques and
syntax.
seriously, it’s just including more
variables (dx/speedX vs directionX)
...and thinking in vectors.
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
5. for loops!
hold on...this could get bumpy.
the concept:
a little bit of code to do the same thing lots of times.
in english:
hey Processing, can you draw 5 ellipses for me?
in code:
for (int i = 0; i < 5; i++) {
ellipse(0, 0, 10, 10);
}
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
6. nested if-statements.
before: with nested if statements:
if (test) { if (test) {
if (test) {
statements statements
} }
statements
}
example:
if (x > 100) {
example:
if (x > 100) { // If x is greater than 100,
ellipse(50, 50, 36, 36); if( X == 112) {
} ellipse(50, 50, 36, 36); // draw this ellipse
}
else {
ellipse(50, 90, 30, 30); // draw this ellipse
}
}
else() { something else }
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
7. optional review.
if we have time and you guys want it.
from thursday:
conditionals
logical operators
mathematical operators
the “NOT” operator
booleans
from friday:
crazy moving/bouncing stuff
pseudocode/figuring out logic in general
anything else?
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
8. if statements.
heading.
optional subheading goes here.
1. The test must be an expression that resolves to true or false.
sample code: 2. When the test expression evaluates to true, the code inside the
if (test) { brackets is run. If the expression is false, the code is ignored.
statements 3. Code inside a set of braces is called a block.
}
examples:
int x = 150;
if (x > 100) { // If x is greater than 100,
ellipse(50, 50, 36, 36); // draw this ellipse
}
if (x < 100) { // If x is less than 100
rect(35, 35, 30, 30); // draw this rectangle
}
line(20, 20, 80, 80);
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
9. if-else statements.
heading.
optional subheadingcomplexity.
adding goes here.
= a tree diagram made of code.
if (test) {
statements;
}
else { else = execute only if first test
statements 2; is not met
}
if (test) {
statements;
}
else if (test2) { else if = execute only if first test is
statements 2; not met AND second test IS met
}
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
10. conditionals!
the tool that allows you to do anything of
any actual interest...
the operators: examples:
> greater than
println(3 > 5); // Prints what?
>= greater than or equal to
< less than println(5 >= 3); // Prints what?
<= less than or equal to println(5 == 5); // Prints what?
== equals
println(5 != 5); // Prints what?
!= does NOT equal
(hint: it’s either true or false!)
what do they do?
return a boolean value of whether or
not the expression is in fact true
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
11. logical operators.
sometimes one condition just
isn’t enough.
examples:
int a = 10;
int b = 20;
&& = AND if ((a > 5) || (b < 30)) {
line(20, 50, 80, 50);
|| = OR }
// Will the code in the block run?
! = NOT if ((a > 15) || (b < 30)) {
ellipse(50, 50, 36, 36);
}
// Will the code in the block run?
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
12. the “NOT” operator.
The logical NOT operator is an exclamation mark. It inverts the
logical value of the associated boolean variables. It changes true
to false, and false to true. The logical NOT operator can be applied
only to boolean variables.
examples:
boolean b = true; // Assign true to b
println(b); // Prints “true”
println(!b); // Prints “false”
println(!x); // ERROR! It’s only possible to ! a boolean variable
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011
13. homework.
due Tuesday August 9th.
read: do:
FORM + CODE: “Repeat” (pp 43-63) Make a parade of elements using for
loops to create a bunch of things at
once. Since (if you do this correctly)
research: it isn’t any harder to do 1 or 1,000, I
an interesting project that could be want there to be at least 20 objects.
inspiration for your final project (or
that is just totally baller in general) There doesn’t necessarily need to be
post link to the project on the blog any collision detection or anything. Just
and describe what interests you a bunch of objects toddling their way
about it (just a couple sentences) along the screen, preferable in some
kind of interesting way.
DAY 6
Tuesday, 8 Aug 2011
CODE
bootcamp 2011