<script type="text/javascript" src="breakout.js"> </script>

Size: px
Start display at page:

Download "<script type="text/javascript" src="breakout.js"> </script>"

Transcription

1 This lesson brings together everything we've learned so far. We will be creating a breakout game. You can see it on It is great to think that you have learned so much so quickly that you are able to create a web page, with styles and enough JavaScript to write a game. 1. Open sublime text, create an html page and add a canvas <canvas id="mycanvas" width="480" height="320"></canvas> Because there is a lot of script let's create a separate JavaScript file save it as breakout.js and add a link to it underneath the canvas. <script type="text/javascript" src="breakout.js"> </script> Last time we got the canvas object and the context inside a function but this time we are going to call it from several functions so lets put it outside so they can all use it. Let's start with the ball centered in the middle 30px from the bottom. We need to create variables for the x and y position. Let's see if you can fill these variables in without looking: canvas = document ('mycanvas'); var ctx = canvas ("2d"); var x = canvas.-----/2; var y = canvas ; var Remember we can make our program call a function at time intervals with setinterval(function_to_call, milliseconds) & we create a function with function functionname(){. See if you can add a function called draw without looking. Also we need to clear the canvas, 1. clearrect(x, y, w, h), 2. draw a circle: beginpath(), 3. arc(center x, center y, r, start angle (from 0 to pi*2), end angle (from 0 to pi*2)); 4. add a fillstyle, 5. fill() and 6. closepath(). Remember they all need to be attached to the context. Who can suggest how we are going to make it move? Below is what you should have so far:

2 var canvas = document.getelementbyid("mycanvas"); var ctx = canvas.getcontext("2d"); var x = canvas.width/2; var y = canvas.height-30; var dx = 2; var dy = -2; function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.beginpath(); ctx.arc(x, y, 10, 0, Math.PI*2); ctx.fillstyle = "#0095DD"; ctx.fill(); ctx.closepath(); x += dx; y += dy; setinterval(draw, 10); The function draw is starting to get a little complicated and it is going to get even more complicated so i want to split it into 2 functions. I am just creating a new function function drawball(){ and moving to ball drawing lines of code into it. Then I will just call the function. This is not essential for to work but keeping things in small function s makes your code easier to understand.

3 var canvas = document.getelementbyid("mycanvas"); var ctx = canvas.getcontext("2d"); var x = canvas.width/2; var y = canvas.height-30; var dx = 2; var dy = -2; function drawball(){ ctx.beginpath(); ctx.arc(x, y, 10, 0, Math.PI*2); ctx.fillstyle = "#0095DD"; ctx.fill(); ctx.closepath(); function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); drawball(); x += dx; y += dy; setinterval(draw, 10);

4 We need to make dy and dx change directions when they hit the edges of the canvas. But first let's replace arch radius, with a variable ballradius which we can create at the top of the code so all the functions have access to it. var ballradius = 10 ; and then change the arc to: ctx.arc(x, y, ballradius, 0, Math.PI*2); Now we need to test if x and y will be outside of the canvas when we add dx and dy. So we test if x + dx < 0 or x + dx > canvas.width and if y + dy < 0 or y + dy > canvas.height. But remember x and y is in the middle of the ball, so we have to adjust this to compensate for the ball radius. So instead of 0 or width or zero and height ballradius and canvas.widthballradius and ballradius and canvas.height-ballradius Then to change directions we make dx = -dx or dy = -dy as necessary. Remember an if statement looks like if(what you are checking){. If you have 2 conditions and you want to see if either of them are true then you can use 2 vertical bars aka pipes. ( "shift" key + backslash "\" key ) to represent or. if(what you are checking 1 what you are checking 2 ){ Try to write the if statement before checking below.

5 function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); drawball(); if(x + dx > canvas.width-ballradius x + dx < ballradius) { dx = -dx; if(y + dy > canvas.height-ballradius y + dy < ballradius) { dy = -dy; x += dx; y += dy; Draw the paddle is easy, as we a re just drawing a rectangle. An anyone remember how to that? Let's just add some variable to hold the paddle's height, width and x. Say 10 by 75. And we want the paddle at the bottom in the middle; var paddleheight = 10; var paddlewidth = 75; var paddlex = (canvas.width-paddlewidth)/2; var paddley = (canvas.width-paddleheight) ; let's create a function called drawpaddle. Use beginpath(), rect(x, y, width, height), fillstyle, fill() & closepath() to draw the paddle.

6 function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, paddley, paddlewidth, paddleheight); ctx.fillstyle = "#0095DD"; ctx.fill(); ctx.closepath(); The last The paddle of course needs to move when the arrows keys are pressed. So we need to add an eventlistener to the document. Since we want the movement to stop when the key is not longer pressed we need event listeners for both keydown and key up. Remember its document.addeventlistener( what to listen for, what to do, capture order) parameter is not actually necessary in this case as the default is false: bubbling. In bubbling the inner most So you need to add keydown and keyup. element's event is handled first and then the document.addeventlistener("keydown", keydownhandler, false); document.addeventlistener("keyup", keyuphandler, false); outer: the <p> element's click event is handled first, then the <div> element's We need a variable to hold whether the right and left keys are pressed. Add these at the top. var rightpressed = false; var leftpressed = false; Key 39 is right and 37 is the left arrow key. Remember you send the event automatically so you can add a variable to hold the click event. In capturing the outer most element's event is handled first and then the inner: the <div> element's click event will be handled first, then the <p> element's click event.

7 event in the function's parameters. We just want to change the variables rightpressed or leftpressed. function keydownhandler(e) { if(e.keycode == 39) { rightpressed = true; else if(e.keycode == 37) { leftpressed = true; keyuphandler should change them back to false again. See if you can do keyuphandler without looking. var rightpressed = false; var leftpressed = false; document.addeventlistener("keydown", keydownhandler, false); document.addeventlistener("keyup", keyuphandler, false); function keydownhandler(e) { if(e.keycode == 39) { rightpressed = true; else if(e.keycode == 37) { leftpressed = true; function keyuphandler(e) { if(e.keycode == 39) { rightpressed = false; else if(e.keycode == 37) { leftpressed = false;

8 In the draw function call the drawpaddle function in the draw function after drawball. We can change the paddlex if leftpressed or rightpressed is true. Of course we only want to move it is it is less than canvas.width-paddlewidth and greater then 0. if(rightpressed && paddlex < canvas.width-paddlewidth) { paddlex += 7; else if(leftpressed && paddlex > 0) { paddlex -= 7; Add The Bricks First create variables for number of rows, number of columns, width, height padding, offsets and array to hold the bricks. The we can loop through the number of rows and columns to fill the array.

9

10

11 var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickpadding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; var bricks = []; for(c=0; c<brickcolumncount; c++) { bricks[c] = []; for(r=0; r<brickrowcount; r++) { bricks[c][r] = { x: 0, y: 0, status = 1; function drawbricks() { for(c=0; c<brickcolumncount; c++) { for(r=0; r<brickrowcount; r++) { if(bricks[c][r].status == 1) { var brickx = (c*(brickwidth+brickpadding)) +brickoffsetleft; var bricky = (r*(brickheight+brickpadding)) +brickoffsettop; bricks[c][r].x = brickx; bricks[c][r].y = bricky; ctx.beginpath(); ctx.rect(brickx, bricky, brickwidth, brickheight); ctx.fillstyle = "#0095DD"; ctx.fill(); ctx.closepath();

12 Add function collisiondetection and call it from draw. This is very like the bubbles code we did last time, except we hold a arguemtn status and change it to 0 when the ball collides with it. function collisiondetection() { for(c=0; c<brickcolumncount; c++) { for(r=0; r<brickrowcount; r++) { var b = bricks[c][r]; if(b.status == 1) { if(x > b.x && x < b.x+brickwidth && y > b.y && y < b.y+brickheight) { dy = -dy; b.status = 0; Game over Add Game over if the ball goes past bottom Change the if(y + dy > canvas.height-ballradius y + dy < ballradius) { dy = -dy; to below: if(y + dy < ballradius) {

13 dy = -dy; else if(y + dy > canvas.height-ballradius) { alert("game OVER"); document.location.reload(); Paddle if(y + dy < ballradius) { dy = -dy; else if(y + dy > canvas.height-ballradius) { if(x > paddlex && x < paddlex + paddlewidth) { dy = -dy; else { alert("game OVER"); document.location.reload();

HotRod Module Examples

HotRod Module Examples HotRod Module Examples 2016 Skybuilder.net Skybuilder.net HotRod Module 1 This is for illustrating how the HotRod module works, and the way to modify scripts you find on the Internet. Full Working Example

More information

Review: Rough Structure

Review: Rough Structure Break Out Canvas Tutorial con/nue Simple Game: Break Out Animate, Game Elements ª Breakout ª Bill Mill Modified Tutorial So?ware developer in Maryland Elements: ª Color ª Collision Detec/on ª Interac/on

More information

This is an open-book, open-notes, open-computer exam. You may not consult with anyone other than the instructor while working on this exam.

This is an open-book, open-notes, open-computer exam. You may not consult with anyone other than the instructor while working on this exam. FINAL EXAM KEY SPRING 2016 CSC 105 INTERACTIVE WEB DOCUMENTS NICHOLAS R. HOWE This is an open-book, open-notes, open-computer exam. You may not consult with anyone other than the instructor while working

More information

Web Programming 1 Packet #5: Canvas and JavaScript

Web Programming 1 Packet #5: Canvas and JavaScript Web Programming 1 Packet #5: Canvas and JavaScript Name: Objectives: By the completion of this packet, students should be able to: use JavaScript to draw on the canvas element Canvas Element. This is a

More information

CS7026 HTML5. Canvas

CS7026 HTML5. Canvas CS7026 HTML5 Canvas What is the element HTML5 defines the element as a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images

More information

Bioinformatics Resources

Bioinformatics Resources Bioinformatics Resources Lecture & Exercises Prof. B. Rost, Dr. L. Richter, J. Reeb Institut für Informatik I12 Slides by D. Nechaev Recap! Why do we even bother with JavaScript?! Because JavaScript allows

More information

INTRODUCTION INSTRUCTOR ROBYN OVERSTREET

INTRODUCTION INSTRUCTOR ROBYN OVERSTREET INTRODUCTION INSTRUCTOR ROBYN OVERSTREET WHAT IS HTML5 CANVAS? HTML5 element, now part of HTML5 API! Used for drawing and animahng directly in HTML, with JavaScript scriphng! Originally developed by Apple

More information

The Video Game Project

The Video Game Project The Video Game Project The first thing we are going to program is the square on which everything in the game is going to exist. 525 px To do this, we need to use HTML5 canvas. First, we will create the

More information

Time series in html Canvas

Time series in html Canvas Time series in html Canvas In this tutorial, we will create an html document and use it to animate a time series. html html (Hypertext Markup Language) is used to make web pages. No software is needed

More information

Sam Weinig Safari and WebKit Engineer. Chris Marrin Safari and WebKit Engineer

Sam Weinig Safari and WebKit Engineer. Chris Marrin Safari and WebKit Engineer Sam Weinig Safari and WebKit Engineer Chris Marrin Safari and WebKit Engineer 2 3 4 5 Simple presentation of complex data 6 Graphs can be interactive California County: San Francisco Population: 845,559

More information

Drawing a Pie Chart. Drawing a Pie Chart. Chapter 6. Setting the Canvas

Drawing a Pie Chart. Drawing a Pie Chart. Chapter 6. Setting the Canvas Chapter 6 Drawing a Pie Chart Similar to what you have done in the last two chapters, in this chapter, you will learn to build a pie chart, using the data contained in your HTML table. Starting from the

More information

Image Processing. HTML5 Canvas JavaScript Pixels

Image Processing. HTML5 Canvas JavaScript Pixels Image Processing HTML5 Canvas JavaScript Pixels Brent M. Dingle, Ph.D. 2015 Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Provide Examples

More information

excalibur Documentation

excalibur Documentation excalibur Documentation Release Erik Onarheim, Josh Edeen, Kamran Ayub Aug 12, 2017 User Documentation 1 Installing Excalibur.js 3 1.1 Getting Excalibur............................................. 3

More information

Assignment #3 Breakout!

Assignment #3 Breakout! Eric Roberts Handout #18 CS 106A January 26, 2005 Assignment #3 Breakout! Due: Friday, February 4, 5:00P.M. Your job in this assignment is to write the classic arcade game of Breakout. It is a large assignment,

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

Houdini - Explaining CSS

Houdini - Explaining CSS Houdini - Explaining CSS Ian Kilpatrick - Google Software Engineer Twitter: @bfgeek Standards Track Propose Idea Write Specification Browsers Implement Wait for Browser Adoption Use Feature! Standards

More information

A user-friendly reference guide HTML5 & CSS3 SAMPLE CHAPTER. Rob Crowther MANNING

A user-friendly reference guide HTML5 & CSS3 SAMPLE CHAPTER. Rob Crowther MANNING A user-friendly reference guide HTML5 & CSS3 SAMPLE CHAPTER Rob Crowther MANNING Hello! HTML5 & CSS3 by Rob Crowther Chapter 3 Copyright 2013 Manning Publications Brief contents PART 1 LEARNING HTML5 1

More information

THE JAVASCRIPT ARTIST 15/10/2016

THE JAVASCRIPT ARTIST 15/10/2016 THE JAVASCRIPT ARTIST 15/10/2016 Objectives Learn how to program with JavaScript in a fun way! Understand the basic blocks of what makes a program. Make you confident to explore more complex features of

More information

/

/ HTML5 Audio & Video HTML5 introduced the element to include audio files in your pages. The element has a number of attributes which allow you to control audio playback: src This

More information

Appendix A Canvas Reference

Appendix A Canvas Reference Appendix A Canvas Reference BC2 HTML5 GAMES CREATING FUN WITH HTML5, CSS3, AND WEBGL The Canvas Element See the official W3C specification for full details on the canvas element (www.w3.org/tr/ html5/the-canvas-element.html.

More information

Adapted from slides by Brahm Capoor. Breakout YEAH hours. Michael (Chung Troute)

Adapted from slides by Brahm Capoor. Breakout YEAH hours. Michael (Chung Troute) Adapted from slides by Brahm Capoor Breakout YEAH hours Michael (Chung Troute) Road Map Lecture Review Graphics Animation Events Using the debugger Assignment Overview Q&A! Graphics GRect rect = new GRect(50,

More information

Introduction to HTML5

Introduction to HTML5 Introduction to HTML5 Creating Lines, Rectangles, Setting Colors, Gradients, Circles and Curves By Dana Corrigan Intro This document is going to talk about the basics of HTML, beginning with creating primitive

More information

Visualizing Information with

Visualizing Information with Visualizing Information with HTML5 @synodinos 35,000 years ago Chauvet cave, southern France By far the oldest paintings ever discovered Hundreds of paintings At least 13 different species Viubk source

More information

UI development for the Web.! slides by Anastasia Bezerianos

UI development for the Web.! slides by Anastasia Bezerianos UI development for the Web slides by Anastasia Bezerianos Divide and conquer A webpage relies on three components: Content HTML text, images, animations, videos, etc Presentation CSS how it will appear

More information

Data Visualization With Chart.js. Alireza Mohammadi Fall 2017

Data Visualization With Chart.js. Alireza Mohammadi Fall 2017 Data Visualization With Chart.js Alireza Mohammadi Fall 2017 Introduction To Data Visualization You can tell powerful stories with data. If your website or application is data-intensive, then you will

More information

WebGL Seminar: O3D. Alexander Lokhman Tampere University of Technology

WebGL Seminar: O3D. Alexander Lokhman Tampere University of Technology WebGL Seminar: O3D Alexander Lokhman Tampere University of Technology What is O3D? O3D is an open source JavaScript API for creating rich, interactive 3D applications in the browser Created by Google and

More information

What is the Box Model?

What is the Box Model? CSS Box Model What is the Box Model? The box model is a tool we use to understand how our content will be displayed on a web page. Each HTML element appearing on our page takes up a "box" or "container"

More information

Instance Name Timeline. Properties Library. Frames, Key Frames, and Frame Rate Symbols movie clips. Events and Event Handlers (functions)

Instance Name Timeline. Properties Library. Frames, Key Frames, and Frame Rate Symbols movie clips. Events and Event Handlers (functions) Using Adobe Animate CC 2017 and ActionScript 3.0 to program Character Movement Created by: Stacey Fornstrom Thomas Jefferson High School - Denver, CO Student Project Examples: http://sfornstrom.tjcctweb.com/

More information

Conduit 2.0 tutorial: Rendering graphics and text using the Canvas node

Conduit 2.0 tutorial: Rendering graphics and text using the Canvas node Conduit 2.0 tutorial: Rendering graphics and text using the Canvas node Author: Pauli Ojala This tutorial will show how to use the Canvas node to render custom graphics and text. The end result will be

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

FUNCTIONAL REACTIVE PROGRAMMING USING ELM

FUNCTIONAL REACTIVE PROGRAMMING USING ELM 1 P a g e L. MORSE, S. WEIRICH: FUNCTIONAL REACTIVE PROGRAMMING USING ELM FUNCTIONAL REACTIVE PROGRAMMING USING ELM Undergraduate Intern LEONDRA MORSE* University of Maryland Eastern Shore Department of

More information

ACS-1805 Introduction to Programming (with App Inventor)

ACS-1805 Introduction to Programming (with App Inventor) ACS-1805 Introduction to Programming (with App Inventor) Chapter 8 Creating Animated Apps 10/25/2018 1 What We Will Learn The methods for creating apps with simple animations objects that move Including

More information

Chapter 4 Statements. Slides Modified by Vicky Seno

Chapter 4 Statements. Slides Modified by Vicky Seno Chapter 4 Statements Slides Modified by Vicky Seno Outline Expressions vs. statements The statements of JavaScript the grand tour (almost) Declaration and expression statements Assignment Conditional statements

More information

Processing Assignment Write- Ups

Processing Assignment Write- Ups Processing Assignment Write- Ups Exercise 1-1 Processing is not an elaborate series of points like connect the dots or is it? Can t be cause I got it all wrong when I mapped out each and every point that

More information

Note: Photoshop tutorial is spread over two pages. Click on 2 (top or bottom) to go to the second page.

Note: Photoshop tutorial is spread over two pages. Click on 2 (top or bottom) to go to the second page. Introduction During the course of this Photoshop tutorial we're going through 9 major steps to create a glass ball. The main goal of this tutorial is that you get an idea how to approach this. It's not

More information

ICS 61 Game Systems and Design Introduction to Scratch

ICS 61 Game Systems and Design Introduction to Scratch ICS 61, Winter, 2015 Introduction to Scratch p. 1 ICS 61 Game Systems and Design Introduction to Scratch 1. Make sure your computer has a browser open at the address http://scratch.mit.edu/projects/editor/.

More information

BUILD PACMAN. Learn Modern Javascript, HTML5 Canvas, and a bit of EmberJS. Jeffrey Biles. This book is for sale at

BUILD PACMAN. Learn Modern Javascript, HTML5 Canvas, and a bit of EmberJS. Jeffrey Biles. This book is for sale at BUILD PACMAN Learn Modern Javascript, HTML5 Canvas, and a bit of EmberJS Jeffrey Biles This book is for sale at http://leanpub.com/buildpacman This version was published on 2016-05-02 This is a Leanpub

More information

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th Chris Piech Handout #8 CS 106A Jan 19, 2018 Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th This assignment should be done individually (not in pairs) Portions of this handouts by

More information

CSCU9B2 Practical 8: Location-Aware Web Pages NOT USED (DOES NOT ALL WORK AS ADVERTISED)

CSCU9B2 Practical 8: Location-Aware Web Pages NOT USED (DOES NOT ALL WORK AS ADVERTISED) CSCU9B2 Practical 8: Location-Aware Web Pages NOT USED (DOES NOT ALL WORK AS ADVERTISED) Aims: To use JavaScript to make use of location information. This practical is really for those who need a little

More information

Creating Breakout - Part 2

Creating Breakout - Part 2 Creating Breakout - Part 2 Adapted from Basic Projects: Game Maker by David Waller So the game works, it is a functioning game. It s not very challenging though, and it could use some more work to make

More information

JavaScript Creativity US $39.99 SOURCE CODE ONLINE

JavaScript Creativity US $39.99 SOURCE CODE ONLINE www.allitebooks.com For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.allitebooks.com

More information

Canvas & SVG WHY YOU SHOULD READ THIS BOOK TODAY GET UP TO SPEED WITH HTML5 IN A WEEKEND

Canvas & SVG WHY YOU SHOULD READ THIS BOOK TODAY GET UP TO SPEED WITH HTML5 IN A WEEKEND WHY YOU SHOULD READ THIS BOOK TODAY PHP is a hugely popular language that powers the backend of 80% of websites, including Internet giants such as Facebook, Wikipedia and WordPress. It s an easy language

More information

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 03 (Haup9ach)

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 03 (Haup9ach) Mul$media im Netz (Online Mul$media) Wintersemester 2014/15 Übung 03 (Haup9ach) Ludwig- Maximilians- Universität München Mul?media im Netz WS 2014/15 - Übung 3-1 Today s Agenda PHP Assignments: Discuss

More information

CS7026 CSS3. CSS3 Graphics Effects

CS7026 CSS3. CSS3 Graphics Effects CS7026 CSS3 CSS3 Graphics Effects What You ll Learn We ll create the appearance of speech bubbles without using any images, just these pieces of pure CSS: The word-wrap property to contain overflowing

More information

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 This assignment, including much of the wording of this document, is taken from an assignment from Stanford University, by Professor Eric Roberts.

More information

Create a Swirly Lollipop Using the Spiral Tool Philip Christie on Jun 13th 2012 with 12 Comments

Create a Swirly Lollipop Using the Spiral Tool Philip Christie on Jun 13th 2012 with 12 Comments Advertise Here Create a Swirly Lollipop Using the Spiral Tool Philip Christie on Jun 13th 2012 with 12 Comments Tutorial Details Program: Adobe Illustrator CS5 Difficulty: Beginner Es timated Completion

More information

Smoother Graphics Taking Control of Painting the Screen

Smoother Graphics Taking Control of Painting the Screen It is very likely that by now you ve tried something that made your game run rather slow. Perhaps you tried to use an image with a transparent background, or had a gazillion objects moving on the window

More information

Let's see a couple of examples

Let's see a couple of examples Javascript Examples Let's see a couple of examples Last 2 sessions we talked about Javascript Today: - Review Javascript basics by going through some examples - In the process we will also learn some new

More information

OBJECT ORIENTED PROGRAMMING IN THE JAVASCRIPT

OBJECT ORIENTED PROGRAMMING IN THE JAVASCRIPT Information technologies in education, #8 1 OBJECT ORIENTED PROGRAMMING IN THE JAVASCRIPT Boris Bocharov, Maria Voevodina, Nataliia Braterska, Anastasiia Dashkovska Object Oriented Programming (OOP) means

More information

Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th

Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th Steve Cooper Handout #13 CS 106A April 12, 2013 Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th Your Early Assignment Help (YEAH) hours: time: tbd, Tues., Apr. 16th in location:tbd

More information

The way I feel about music is that there is no right and wrong. Only true and false. Fiona Apple. true false false

The way I feel about music is that there is no right and wrong. Only true and false. Fiona Apple. true false false 5 Conditionals Conditionals 59 That language is an instrument of human reason, and not merely a medium for the expression of thought, is a truth generally admitted. George Boole The way I feel about music

More information

Introduction to HTML 5. Brad Neuberg Developer Programs, Google

Introduction to HTML 5. Brad Neuberg Developer Programs, Google Introduction to HTML 5 Brad Neuberg Developer Programs, Google The Web Platform is Accelerating User Experience XHR CSS DOM HTML iphone 2.2: Nov 22, 2008 canvas app cache database SVG Safari 4.0b: Feb

More information

1. Complete these exercises to practice creating user functions in small sketches.

1. Complete these exercises to practice creating user functions in small sketches. Lab 6 Due: Fri, Nov 4, 9 AM Consult the Standard Lab Instructions on LEARN for explanations of Lab Days ( D1, D2, D3 ), the Processing Language and IDE, and Saving and Submitting. Rules: Do not use the

More information

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING AN INTRODUCTION TO SCRATCH (2) PROGRAMMING Document Version 2 (04/10/2014) INTRODUCTION SCRATCH is a visual programming environment and language. It was launched by the MIT Media Lab in 2007 in an effort

More information

CHANNEL BLOCK SOLID. Step 7. For the Placement Point, click the bottom left gray rectangle and click OK. to fit drawing on the screen.

CHANNEL BLOCK SOLID. Step 7. For the Placement Point, click the bottom left gray rectangle and click OK. to fit drawing on the screen. Chapter 9 CHANNEL BLOCK SOLID A. Create Rectangle. Step 1. Change to the Front View. Use green Front View or ALT-6 F. Hold down ALT and press 6. Key-in F. Step 3. Create. Step 4. Rectangle. Step 5. 1 Point.

More information

Processing/Java Syntax. Classes, objects, arrays, and ArrayLists

Processing/Java Syntax. Classes, objects, arrays, and ArrayLists Processing/Java Syntax Classes, objects, arrays, and ArrayLists 1 Processing and Java Java is relentlessly object-oriented Among other things, this means that all methods must occur within classes Processing

More information

16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과

16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과 16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과 목차 HTML5 Introduction HTML5 Browser Support HTML5 Semantic Elements HTML5 Canvas HTML5 SVG HTML5 Multimedia 2 HTML5 Introduction What

More information

Constraint Satisfaction Problems: A Deeper Look

Constraint Satisfaction Problems: A Deeper Look Constraint Satisfaction Problems: A Deeper Look The last problem set covered the topic of constraint satisfaction problems. CSP search and solution algorithms are directly applicable to a number of AI

More information

CS Multimedia and Communications. Lab 06: Webpage Tables and Image Links (Website Design part 3 of 3)

CS Multimedia and Communications. Lab 06: Webpage Tables and Image Links (Website Design part 3 of 3) CS 1033 Multimedia and Communications Lab 06: Webpage Tables and Image Links (Website Design part 3 of 3) REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB! Table Properties Reference Guide The Property

More information

1. Defining Procedures and Reusing Blocks

1. Defining Procedures and Reusing Blocks 1. Defining Procedures and Reusing Blocks 1.1 Eliminating Redundancy By creating a procedure, move a copy of the redundant blocks into it, and then call the procedure from the places containing the redundant

More information

Math 113 Exam 1 Practice

Math 113 Exam 1 Practice Math Exam Practice January 6, 00 Exam will cover sections 6.-6.5 and 7.-7.5 This sheet has three sections. The first section will remind you about techniques and formulas that you should know. The second

More information

Problem 1: Textbook Questions [4 marks]

Problem 1: Textbook Questions [4 marks] Problem 1: Textbook Questions [4 marks] Answer the following questions from Fluency with Information Technology. Chapter 3, Short Answer #8: A company that supplies connections to the Internet is called

More information

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, April 23 rd

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, April 23 rd Chris Piech Assignment #2 CS 106A April 13, 2018 Assignment #2: Simple Java Programs Due: 11AM PST on Monday, April 23 rd This assignment should be done individually (not in pairs) Portions of this handouts

More information

Introduction to HTML & CSS. Instructor: Beck Johnson Week 5

Introduction to HTML & CSS. Instructor: Beck Johnson Week 5 Introduction to HTML & CSS Instructor: Beck Johnson Week 5 SESSION OVERVIEW Review float, flex, media queries CSS positioning Fun CSS tricks Introduction to JavaScript Evaluations REVIEW! CSS Floats The

More information

VectorDraw web Library

VectorDraw web Library VectorDraw web Library What is it? A vector graphics library that is designed to not only open CAD drawings but also display generic vector objects on any platform that supports the HTML 5 standard, such

More information

Getting Started with JS-Eden

Getting Started with JS-Eden Getting Started with JS-Eden This activity will guide you through an introduction to JS-Eden. Starting JS-Eden You can open JS-Eden by pointing your web browser to: http://harfield.org.uk/jsedencanvas/

More information

Stickers! Introduction. Step 1: Colourful coding sticker

Stickers! Introduction. Step 1: Colourful coding sticker Stickers! Introduction In this project, you ll create lots of fun stickers that you can use to decorate web pages. You ll learn about using gradients that gradually change from one colour to another to

More information

HTML5. Canvas pages of professional hints and tricks. Notes for Professionals. GoalKicker.com. Free Programming Books

HTML5. Canvas pages of professional hints and tricks. Notes for Professionals. GoalKicker.com. Free Programming Books HTML5 Canvas HTML5 Notes for Professionals Canvas Notes for Professionals 100+ pages of professional hints and tricks GoalKicker.com Free Programming Books Disclaimer This is an uno cial free book created

More information

Lewis Weaver. Nell Waliczek. Software Engineering Lead. Program github.

Lewis Weaver. Nell Waliczek. Software Engineering Lead. Program  github. Nell Waliczek Software Engineering Lead Lewis Weaver Program Manager @NellWaliczek github.com/nellwaliczek @lew_weav github.com/leweaver Mixed Reality on the web using WebVR Available October 17 th WebVR

More information

Child Items. Adding Child Items to plugin control panels. File Structure 4. Hacking childitems.html 7. Hacking childitem.html (without the s) 14

Child Items. Adding Child Items to plugin control panels. File Structure 4. Hacking childitems.html 7. Hacking childitem.html (without the s) 14 Child Items Child Items 1 Adding Child Items to plugin control panels. 1.1 1.2 1.3 File Structure 4 Hacking childitems.html 7 Hacking childitem.html (without the s) 14 Adding Child Items to plugin control

More information

DOING MORE WITH WORD: MICROSOFT OFFICE 2010

DOING MORE WITH WORD: MICROSOFT OFFICE 2010 DOING MORE WITH WORD: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT WORD PAGE 03 Viewing Toolbars Adding and Removing Buttons MORE TASKS IN MICROSOFT WORD

More information

Khan Academy JavaScript Study Guide

Khan Academy JavaScript Study Guide Khan Academy JavaScript Study Guide Contents 1. Canvas graphics commands with processing.js 2. Coloring 3. Variables data types, assignments, increments 4. Animation with draw loop 5. Math expressions

More information

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser. Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible

More information

WHAT ARE THE PARTS OF A QUADRATIC?

WHAT ARE THE PARTS OF A QUADRATIC? 4.1 Introduction to Quadratics and their Graphs Standard Form of a Quadratic: y ax bx c or f x ax bx c. ex. y x. Every function/graph in the Quadratic family originates from the parent function: While

More information

GIMP WEB 2.0 ICONS. GIMP is all about IT (Images and Text) OPEN GIMP

GIMP WEB 2.0 ICONS. GIMP is all about IT (Images and Text) OPEN GIMP GIMP WEB 2.0 ICONS or WEB 2.0 ICONS: MEMO Web 2.0 Icons: Memo GIMP is all about IT (Images and Text) OPEN GIMP Step 1: To begin a new GIMP project, from the Menu Bar, select File New. At the Create a New

More information

Let s make a web game! credit: Photon Storm

Let s make a web game! credit: Photon Storm Let s make a web game! credit: Photon Storm What will we cover today? The canvas element Phaser, a JavaScript framework Setting up a local server Making an HTML5 page Setting up Phaser Creating a simple

More information

3ds Max Cottage Step 1. Always start out by setting up units: We re going with this setup as we will round everything off to one inch.

3ds Max Cottage Step 1. Always start out by setting up units: We re going with this setup as we will round everything off to one inch. 3ds Max Cottage Step 1 Always start out by setting up units: We re going with this setup as we will round everything off to one inch. File/Import the CAD drawing Be sure Files of Type is set to all formats

More information

Cascading Style Sheets for layout II CS7026

Cascading Style Sheets for layout II CS7026 Cascading Style Sheets for layout II CS7026 Understanding CSS float The CSS float property is also a very important property for layout. It allows you to position your Web page designs exactly as you want

More information

Taking Apart Numbers and Shapes

Taking Apart Numbers and Shapes Taking Apart Numbers and Shapes Writing Equivalent Expressions Using the Distributive Property 1 WARM UP Calculate the area of each rectangle. Show your work. 1. 6 in. 2. 15 in. 12 yd 9 yd LEARNING GOALS

More information

Digital Mapping with OziExplorer / ozitarget

Digital Mapping with OziExplorer / ozitarget Going Digital 2 - Navigation with computers for the masses This is the 2nd instalment on using Ozi Explorer for digital mapping. This time around I am going to run through some of the most common questions

More information

Using Dreamweaver CC. Logo. 4 Creating a Template. Page Heading. Page content in this area. About Us Gallery Ordering Contact Us Links

Using Dreamweaver CC. Logo. 4 Creating a Template. Page Heading. Page content in this area. About Us Gallery Ordering Contact Us Links Using Dreamweaver CC 4 Creating a Template Now that the main page of our website is complete, we need to create the rest of the pages. Each of them will have a layout that follows the plan shown below.

More information

Google SketchUp Design Exercise 1

Google SketchUp Design Exercise 1 Google SketchUp Design Exercise 1 The first thing students like to do in SketchUp is make a basic house and try out different colors and materials. They also love making windows and doors, and trying out

More information

Default Parameters and Shapes. Lecture 18

Default Parameters and Shapes. Lecture 18 Default Parameters and Shapes Lecture 18 Announcements PS04 - Deadline extended to October 31st at 6pm MT1 Date is now Tuesday 11/14 Warm-up Question #0: If there are 15 people and you need to form teams

More information

IAT 355 : Lab 01. Web Basics

IAT 355 : Lab 01. Web Basics IAT 355 : Lab 01 Web Basics Overview HTML CSS Javascript HTML & Graphics HTML - the language for the content of a webpage a Web Page put css rules here

More information

B - Broken Track Page 1 of 8

B - Broken Track Page 1 of 8 B - Broken Track There's a gap in the track! We need to make our robot even more intelligent so it won't get stuck, and can find the track again on its own. 2017 https://www.hamiltonbuhl.com/teacher-resources

More information

Events. Mendel Rosenblum. CS142 Lecture Notes - Events

Events. Mendel Rosenblum. CS142 Lecture Notes - Events Events Mendel Rosenblum DOM communicates to JavaScript with Events Event types: Mouse-related: mouse movement, button click, enter/leave element Keyboard-related: down, up, press Focus-related: focus in,

More information

SOLIDWORKS: Lesson III Patterns & Mirrors. UCF Engineering

SOLIDWORKS: Lesson III Patterns & Mirrors. UCF Engineering SOLIDWORKS: Lesson III Patterns & Mirrors UCF Engineering Solidworks Review Last lesson we discussed several more features that can be added to models in order to increase their complexity. We are now

More information

Assignment 2: Welcome to Java!

Assignment 2: Welcome to Java! CS106A Winter 2011-2012 Handout #12 January 23, 2011 Assignment 2: Welcome to Java! Based on a handout by Eric Roberts and Mehran Sahami Having helped Karel the Robot through the challenges of Assignment

More information

CISC 1600, Lab 2.2: Interactivity in Processing

CISC 1600, Lab 2.2: Interactivity in Processing CISC 1600, Lab 2.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad, a site for building processing sketches online using processing.js.

More information

Step 1: Create A New Photoshop Document

Step 1: Create A New Photoshop Document Snowflakes Photo Border In this Photoshop tutorial, we ll learn how to create a simple snowflakes photo border, which can be a fun finishing touch for photos of family and friends during the holidays,

More information

<script> var editor_background = new Image() editor_background.src = " var SIZE = 256

<script> var editor_background = new Image() editor_background.src =   var SIZE = 256 Downloaded from: justpaste.it/17nxj Past your image URL here: and press Source

More information

Editing Polygons. Adding material/volume: Extrude. Learning objectives

Editing Polygons. Adding material/volume: Extrude. Learning objectives Learning objectives Be able to: use the Extrude tool to add volume to a polygon know what edge loops are and how to insert edge loops in a polygon cut edges in a polygon know multiple methods of sewing

More information

TUTORIAL No 1: Page Setup

TUTORIAL No 1: Page Setup TUTORIAL No 1: Page Setup Skill Level: Foundation This tutorial shows you how to set up a workspace to draw in. The workspace is the area you are working in on the screen. 1. Open 2D Design. A screen with

More information

CSS worksheet. JMC 105 Drake University

CSS worksheet. JMC 105 Drake University CSS worksheet JMC 105 Drake University 1. Download the css-site.zip file from the class blog and expand the files. You ll notice that you have an images folder with three images inside and an index.html

More information

lundi 7 janvier 2002 Blender: tutorial: Building a Castle Page: 1

lundi 7 janvier 2002 Blender: tutorial: Building a Castle Page: 1 lundi 7 janvier 2002 Blender: tutorial: Building a Castle Page: 1 www.blender.nl this document is online at http://www.blender.nl/showitem.php?id=4 Building a Castle 2000 07 19 Bart Veldhuizen id4 Introduction

More information

How to lay out a web page with CSS

How to lay out a web page with CSS How to lay out a web page with CSS A CSS page layout uses the Cascading Style Sheets format, rather than traditional HTML tables or frames, to organize the content on a web page. The basic building block

More information

Loops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2

Loops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2 Loops Variable Scope Remapping Nested Loops CS105 05 Loops 1 Donald Judd CS105 05 Loops 2 judd while (expression) { statements CS105 05 Loops 3 Four Loop Questions 1. What do I want to repeat? - a rect

More information

Exam Questions Demo https://www.certifyforsure.com/dumps/ Microsoft. Exam Questions

Exam Questions Demo https://www.certifyforsure.com/dumps/ Microsoft. Exam Questions Microsoft Exam Questions 70-480 Programming in HTML5 with JavaScript and CSS3 Version:Demo 1. You are developing a web page that will be divided into three vertical sections. The main content of the site

More information

Chapter Four: Loops. Slides by Evan Gallagher. C++ for Everyone by Cay Horstmann Copyright 2012 by John Wiley & Sons. All rights reserved

Chapter Four: Loops. Slides by Evan Gallagher. C++ for Everyone by Cay Horstmann Copyright 2012 by John Wiley & Sons. All rights reserved Chapter Four: Loops Slides by Evan Gallagher The Three Loops in C++ C++ has these three looping statements: while for do The while Loop while (condition) { statements } The condition is some kind of test

More information

S206E Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules

S206E Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules S206E057 -- Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Interface of Math and Logic Functions 1. Basic mathematic operations: For example,

More information