Computer Science I Looking at code: "Where did Prof. Shablinsky go" Classwork/homework: midterm projects.

Slides:



Advertisements
Similar presentations
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Advertisements

Code Club Session 3 Shark Eats Fish. Picture of finished product here.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
Information Technology Center Hany Abdelwahab Computer Specialist.
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Noadswood Science,  To know the basics of Python coding and decoding Monday, September 07, 2015.
G RAPHICS P ROGRAMMING Lecture 3 - Simple Animation - Simple 3D Drawing.
1 k Jarek Rossignac,  2008 Processing  Install Processing  Learn how to edit, run, save, export, post programs  Understand.
Programming Games Simulated ballistic motion: cannon ball. Classwork: Final day for midterm project and all projects for first part of class. Homework:
Programming Games Show your simple video. More video examples. Audio. Classwork/Homework: Produce more complex video program.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Continuous February 16, Test Review What expression represents the zip car eligibility rules of at least 18 years old and no incidents?
Keyboard and Events. What about the keyboard? Keyboard inputs can be used in many ways---not just for text The boolean variable keyPressed is true if.
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
1 ball, 2 ball, red ball, blue ball By Melissa Dalis Professor Susan Rodger Duke University June 2011.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
CIS 3.5 Lecture 2.2 More programming with "Processing"
Georgia Institute of Technology More on Creating Classes part 2 Barb Ericson Georgia Institute of Technology Oct 2005.
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running Types of data.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested.
Exceptions Chapter 16 This chapter explains: What as exception is Why they are useful Java exception facilities.
Programming Games Logic. Slide show. Range input. Storage. Datatypes. Binary numbers. Homework: Catch up. This includes uploading projects to your server.
Words. Characters and Strings Character –A single character inside of single quotes char letter = 'A' ; char digit = '0' ; – Strings Zero or more character.
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 Arrays. Parallel structures. Classwork/Homework: Build your own bouncing things.
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
Computer Science I Looping. User input. Classwork/Homework: Incorporate looping & user input into a sketch.
CSC 212 – Data Structures Lecture 5: Variables. Problem of the Day Why do underground subway stations always have more escalators going up than down?
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.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
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.
Computer Science I Go over midterm. Reprise on curves. Table examples. The map function. Testing Strings. Fonts. Classwork/Homework: Complete midterm project.
Computer Science I More class examples. Paths. Jigsaw. Tolerance. Classwork/homework: Your class project. Post proposal for midterm project.
Computer Science I Slingshot example. ProcessingJS example. Review for midterm quiz. Classwork/Homework: study for midterm. Work on midterm project.
Time to upload Virtual something.
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
Computer Science I Libraries. Sound. Saving frames as images. Classwork/Homework: Make sketch using sound. Add saving frames.
Variables. Something to mention… void setup(){ size(200, 200); background(255); smooth(); } void draw() { stroke(0); strokeWeight(abs(mouseX-pmouseX));
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Programming Games Reprise Credit Cards! Reprise Binary. Overall time limit, setTimeout Homework: [Show virtual something.] Make proposal as reply to my.
Computer Science I Adding a timing feature. Classwork/Homework: finish final project. Prepare for review for final. Post on programming topic.
By Melissa Dalis Professor Susan Rodger Duke University June 2011
Scratch for Interactivity
Classwork: Examine and enhance falling drop(s) or make your own.
Computer Science I Variables. Methods.
Computation as an Expressive Medium
Chapter 10 Algorithms.
Computer Science I Fonts. Building on one jigsaw to make another.
Chapter 10 Algorithms.
More programming with "Processing"
Game Over Module 4 Lesson 2.
Chapter 10 Algorithms.
Agenda for Unit 5: Control Structures
Iteration – While Loops
Presentation transcript:

Computer Science I Looking at code: "Where did Prof. Shablinsky go" Classwork/homework: midterm projects

Feedback on error messages While programming in Processing Some you can ignore because you haven’t gotten to code something yet. BUT look at them because maybe the message indicates a mistake. For example, methods (aka functions) are defined to take specific arguments. void calculate(float v, float w) {…} is not the same as void calculate(int v) { }

Feedback You need to zip the FOLDER, containing the.pde file and, possibly, a data file, and, possibly, other things… USE THE NAMING CONVENTION: jMeyerBouncingThingsWClasses You may have problems in re-using names. Download may produce jMeyerBouncingThings (1).zip which could produce folder NOT matching.pde file name. Solution: erase old stuff or change name.

Feedback Consider use of array in place of Box1, Box2, … Then you can use loops for (int i<0;i<boxes.length;i++) { … } Do use distinct names for things that have specific roles Thing badguy = new Thing(…); Thing goodguy = new Thing(...); Things[] stuffToDisplay = {badguy,goodguy,…}

Processing features The background function can take an image as an argument. This is how I make the map be the background: background(bg); The nf function formats floats. So if secs has the value , then nf(secs,1,2); will produce the string "5.10"

Idea for game Display world map Player attempts to guess where Prof. Shablinsky went during a summer a couple of years ago? Answers are: – Iceland – St. Petersberg While player is thinking, a shrinking image travels towards mouse position. Elapsed time shown. If player clicks the screen, flyer appears where the mouse was clicked. Two possibilities for message: – Positive message – Distance in pixels from closest of two answers If alloted time runs out, – Time ran out

Planning Manage two phases: inmotion Boolean variable (aka flag) Define – setup – Draw If inmotion: move flyer image towards mouse Else: give response – mouseClicked – checkanswer – giveresponse

Planning, cont. Move (animate) the flyer (the Irina image) towards the mouse position. Animation stops at the end of a fixed time duration set to 5 seconds OR if player clicks on the map. If player clicks on the map, a computation is done using the dist function to see if the player's location is near enough to one of the answer. Appropriate response given. If time runs out, a response is given.

Examine program Notice comments, including commented out code: used for debugging. The world map displayed using Pimage bg; In setup: bg = loadImage(filename); In draw: background(bg); The distance in pixels is calculated by builtin function dist. A for- loop calculates what of the two places is closer and then compares that number to 10, the tolerance allowed. This may be too strict. The function nf is used to format the elapsed time to display 2 decimal places. The flyer image dimensions are continuously changed, but kept in proportion using wdel, fw, and fh variables. fw -= wdel; fh = fw*(origh/origw);

PImage bg; PImage flyer; boolean inmotion = true; boolean clicked = false; float duration = 5; // 5 seconds float framer = 50; float interval = 1/framer; //frame interval in time float x,y,fw,fh,wdel; float origw,origh,smallw; PFont font; String question = "Where did Professor Shablinsky travel this summer?"; int[][] answers = {{452,90},{367,77}}; String[] answertexts = {"St. Petersberg, Russia", "Iceland"}; String responsetext;

Functions setup draw mouseClicked checkAnswer (float cx, float cy) giveresponse

Classwork / Homework Work on projects Start studying for midterm – Check out midterm guide – Prepare questions for next class