Classwork: Examine and enhance falling drop(s) or make your own.

Slides:



Advertisements
Similar presentations
Pages and boxes Building quick user interfaces. learning objectives o Build a quick UI with pages and boxes o understand how pages and boxes work o click.
Advertisements

Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
Lecture 3 IAT 800. Sept 15, Fall 2006IAT 8002 Suggestions on learning to program  Spend a lot of time fiddling around with code –Programming is something.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Programming Games Show project. Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Homework: Do your own.
Programming games Show your version of Bo the dog. Start cannonball Preview: video, audio work session (cannonball) Homework: Cannonball with ball in a.
CS 320 Assignment 1 Rewriting the MISC Osystem class to support loading machine language programs at addresses other than 0 1.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Creating HUD Rings. Step 1 Open a new document in Illustrator. You can set it to the size you prefer to work in. In my case I have it set at 500px by.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
Programming Games Logic. Slide show. Range input. Storage. Datatypes. Binary numbers. Homework: Catch up. This includes uploading projects to your server.
Computer Science I Classes and objects Classwork/Homework: Examine and modify my examples. Make your own.
Computer Science I Programming in Java (programming using Processing IN Java, using IntelliJ IDE) Classwork/Homework: copy your Processing projects over.
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.
Computer Science I Looping. User input. Classwork/Homework: Incorporate looping & user input into a sketch.
Computer Science I Share plans for virtual something. Text. Show my virtual dog. Classwork: Plans for your virtual something. Homework: start implementation.
Computer Science I Variables. Methods. Classwork/Homework: Re-do or do new drawing using variables & function(s). Zip folder and upload to Moodle dropbox.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Computer Science I Text input. Transformations. Yet another jigsaw. Classwork/Homework: Create new application making use of transformations.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
Time to upload Virtual something.
ICT/COMPUTING RULES Only use software allowed by the teacher
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Homework Drop Box on eChalk.  Step 1 – Create Homework Assignment  Step 2 - Students Submit Homework Assignments  Step 3 - Teacher Reviews Homework.
Information and Computer Sciences University of Hawaii, Manoa
Programming and Debugging with the Dragon and JTAG
Visit for more Learning Resources
Computer Graphics: Rocket, Java: Class
Computer Science I Variables. Methods.
Eclipse Navigation & Usage.
LCC 6310 Computation as an Expressive Medium
Arrays and files BIS1523 – Lecture 15.
Application Development Theory
CompSci 230 Software Construction
Chapter 7 Functions.
CS 11 C track: lecture 8 Last week: hash tables, C preprocessor
MS PowerPoint 2010 Week 2.
Learning to program with Logo
Programming Games Computer science big ideas and Computer Science jargon: review of things we have used in examples. Show virtual dog Homework: [Catch.
CS190/295 Programming in Python for Life Sciences: Lecture 1
Chapter 5 - Functions Outline 5.1 Introduction
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Introduction to TouchDevelop
CSCE Fall 2013 Prof. Jennifer L. Welch.
Graph Paper Programming
Programming for Artists
Chapter 10 Algorithms.
Computer Science I Fonts. Building on one jigsaw to make another.
CSCE 121: Simple Computer Model Spring 2015
Chapter 10 Algorithms.
More programming with "Processing"
Arrays
Google Calendar Appointments
Programming games Classes and objects (used for Jigsaw, Bouncing stuff, other projects) Homework: Complete cannonball. Video or Audio. Your own project.
Game Loop Update & Draw.
Lecture 4: Introduction to Processing AP Computer Science Principles
CSCE Fall 2012 Prof. Jennifer L. Welch.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Programming games Share your plans for your virtual something.
LCC 6310 Computation as an Expressive Medium
Chapter 10 Algorithms.
Microsoft Office Illustrated Fundamentals
The beginning of media computation Followed by a demo
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Classwork: Examine and enhance falling drop(s) or make your own. Computer Science I Animation example Classwork: Examine and enhance falling drop(s) or make your own.

What did we do last class?

Hints on details Wrote the body of the known Processing functions setup draw Used built-in Processing functions ? I showed a programmer defined function I wrote called smiley and I declared and used several variables

Why use variables? ? Makes code easier to understand than "naked numbers". Can be used to define relationship between values.

What did you do for the homework assignment ?

Computer languages Many different types Grace Hopper was one of people responsible for creating the "high level language" COBOL. So what is high vs low? Assembler language is low LR 1, 3000 load register 1 with contents of memory at location 3000 AR 1,3 add the contents of registers 1 and 3 and put them in 1 JUMP 4000 jump to position 4000 in memory Etc. Machine language is essentially 1 to 1 correspondence with Assembler, but all in 1s and 0s. More on this later. Cobol was [more or less] readable. Cobol (like Processing and Java) needs to be translated (this is called compilation) Cobol is still in use. If time, I will talk about the Y2K problem. If we don't get to it, it is an extra credit opportunity.

Animation …is fooling our brain by showing a sequence of static pictures quickly. One way to accomplish this is using the draw function to display slightly different screens each interval of time. We may or may not choose to erase the whole screen each time.

Falling drop(s) [One drop falls at a time] The draw function is invoked over and over according to the frameRate. Default value is 60 times/second Unless and until noLoop(); The command background(…); draws background of the whole screen, so can be used to erase everything.

Planning 3 objects (not in the sense that we will learn later about classes and objects, but close…) cup drop water Will define a function for each of these Another programmer defined function I made, positionDrop, does the work of re-positioning the drop and making some checks

The drop function A half circle plus a triangle void drop(float x, float y) { fill(0,0,200); arc(x,y,dropw,dropboth,0,PI); triangle(dropx-.5*dropw,dropy,dropx+.5*dropw,dropy,dropx,dropy-droptriheight); }

The cup void cup() { noFill(); rect(cupx,cupy,cupwidth,cupheight); }

The positionDrop function Does the hard work: when a drop hits the water, the waterlevel is increased and the next time the drop is drawn, it is starting off at the top again. Also, when the water fills up the cup, my code stops looping. You can try to make something more dramatic happen!

void positionDrop() { dropy = dropy+ dropchange; if ((dropy+. 5 void positionDrop() { dropy = dropy+ dropchange; if ((dropy+.5*dropboth)>(cupy+cupheight-waterlevel)) { waterlevel = waterlevel + waterchange; dropy = 20; } if (waterlevel>cupheight-dropboth) { noLoop(); else { drop(dropx,dropy);

The water in the cup This was problematic because I changed my mind on what the waterlevel variable represented. void water() { fill(0,0,100); rect(cupx, cupy+cupheight-waterlevel,cupwidth,waterlevel); }

Variables float cupx = 300; float cupwidth = 200; float cupy = 400; float cupheight = 400; float dropw = 30; float dropboth = 30; float droptriheight = 40;

Variables float dropx = cupx + .5*cupwidth; //does not change float dropy = 50; //changes float waterlevel = 0; //changes float dropchange = 3; float waterchange = 30;

The setup function Nothing that this is different from previous examples. void setup() { size(800,1000); }

The draw function Keeps repeating until the noLoop(); invoked. Recall positionDrop invokes drop. void draw() { background(255); positionDrop(); cup(); water(); }

Assignment Use variables and define and use a function, with parameters. Invoke function with different parameters

Colors You can specify color using rgb values or gray scale directly in fill() or stroke() statements OR you can define variables of datatype color More on datatypes later More color examples later Let’s look up how to do this: processing language color in google or go to Processing Reference page and look for color

Random color One possibility is to set up an array (more on this later) of colors, call it myColors, and choose from this list, using myColors[random(myColors.length)] Another way: color(random(256),random(256),random(256))

Recap Save As… your work with a name following the naming convention. jMeyerDrops This will produce a folder with that name holding a pde file with that name. In later projects, there will be other files in the folder, most notably a data folder containing images and, maybe, other things. Zip (compress) the folder. This is what you upload to the assignment box.

Classwork [Catch up on homework. Read my comments and, as appropriate, improve what you did.] How can drops project be improved or enhanced? One student did a different drops into cup sketch. He will present this in a few weeks. You can use similar technique to build an animation using the function you defined for homework. Your function must make use of parameters and/or global variables to make it do different things…. Note: you (your code) can change something more or different than just the vertical position. For an animated effect of moving around the screen, you (your code) will need to erase the whole screen, done using background( );