Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab1 Discussion B. Ramamurthy.

Similar presentations


Presentation on theme: "Lab1 Discussion B. Ramamurthy."— Presentation transcript:

1 Lab1 Discussion B. Ramamurthy

2 General Instructions Attend the recitation (s), office hours (s) to get help Read the Lab description Understand what is needed. Collect all the images you need before you start. Design/plan before you start programming Book tells you to write a pseudo code before program… pseudo code is the “plan” Flowchart is another representation for the plan

3 Lets plan Decide the permanent features and write the setup function + test it Collect/draw/create the images of all the creatures you want on the African Savannah. Write the functions for drawing the creatures on the Savannah You need to place the creatures/animals You need to how to generate and use random numbers Use mouseX and mouseY and the functions appropriately You need to know “if ..else” /selection statement

4 Placing Images PImage pic; void setup() { size(400,400); pic = loadImage("tulips.jpg"); } void draw() { image(pic, 0,0,130,130);

5 Random function “random” is a function in Processing that helps to get random numbers random(high) ; random(low, high); randomSeed(0); void draw() { int color = int(random(255)); stroke(r); line(i, 0, i, 100); }

6 Picture Background PImage pic; void setup() { size(512,384); pic = loadImage("tulips.jpg"); } void draw() { background(pic);

7 Selection/choice .. If .else statement
if (expression) { statements } else Example: if (i < 35) { line(30, i, 80, i); } { line(20, i, 90, i); }

8 Lets try these out Lets try picture, background;
Review if..else and random: you will need it for this lab


Download ppt "Lab1 Discussion B. Ramamurthy."

Similar presentations


Ads by Google