HTML5 – Completing Your Game Proglan HTML5 Part 3.

Slides:



Advertisements
Similar presentations
Z x 725 Sensor Mark 140 x Sensor Coordinates Bump Bond Pad Ø = 12/ FE PAD#2 110 x 210 LM Structure FE Chip Coordinates Bump.
Advertisements

Recap Ball Movement How does ball start its movement initially What happens when it hits the top and bottom What happens when it hits the paddle If you.
Level 3 Extended Diploma Unit 22 Developing Computer Games
BrickBreaker for the Blackberry A quick analysis.
Twin A Design Pattern for Modeling Multiple Inheritance Mahmoud ghorbanzadeh.
Display of Objects on Screen. COUNTERS b A horizontal counter represents the horizontal position of the monitor’s electron beam. b A vertical counter.
Programs Involving Repetition Drawing Grass Drawing grids Printing marks on a ruler Repeatedly rolling dice in craps game.
Click Here to Begin the Game CHOICE 1CHOICE 2CHOICE 3 CHOICE CHOICE
How to create tables in HTML…

Windows 8 Game development using HTML5 and JavaScript Martin Beeby Technical Evangelist
HTML, HTML5 Canvas, JavaScript PART 3 LOOKING MORE CLOSELY AT FULL BLOWN GAME DESIGN A PATTERNED BACKGROUND (CREATED WTIH LOOPS) WITH A MOVING OBJECT CHALLENGES.
Set 7: Events and Animation IT452 Advanced Web and Internet Systems.
J.Byrne Draw the outer shape of the room to sizes given. J.Byrne
Programming Games Simulated ballistic motion: cannon ball. Classwork: Final day for midterm project and all projects for first part of class. Homework:
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
Java Loops (Java: An Eventful Approach, Ch 7 and 13), Slides Credit: Bruce, Danyluk and Murtagh CS 120 Lecture 16 6 November 2012.
CS 174: Web Programming October 7 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Roy McElmurry. More:
Drawing With Lines and Shapes!
Warm Up Look through your review and circle any problems that you have a question on. We will start the review day going over any questions on the practice.
Programming games Context of what we are doing. Drawing on canvas. Homework: [Complete coin toss examples.] Do your own drawings. Upload files to website.
Com.Tech 3104 Outcome 12 By: Evan And Mark Progress Report.
Programming games Review concepts. Crooked coin toss. Drawing on canvas. Homework: Complete [static] drawings. Upload files to website.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
 y’ = 3x and y’ = x are examples of differential equations  Differential Form dy = f(x) dx.
The Breakout Game (complete version) Chapter 11. Overview This chapter reviews all the material so far. This includes: – event handling, – menus, – inheritance,
digit x 1 digit 3 DIGIT BY 2 DIGIT Multiplying Decimals 4 digit by 3 digit
Java exercise review Lesson 26: Exercise 4. Exercise #4 – a sample solution 1.Write the psudocode and the deployment diagram for what you are planning.
Midterm: Question 1 (35%) (30 minutes) Write an assembly program to draw a rectangle. – (5%) Show a message to ask for information of the rectangle – (5%)
XNA ● Proprietary Microsoft framework ● C#. Interface.
VG101 RECITATION 8 By TAs. CONTENTS Brief review of class Strategy for assignment 9 Questions about assignment 7, 8.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
Ending HTML5 Open note Open Internet PROGLAN LONGQUIZ #2.
Class Work 5.A OBLIQUE VIEW. START 1.DRAW BORDER LINE 2.DRAW TITLE BLOCK 3.WRITE YOUR NAME 4.DIVIDE THE WORK SPACE INTO 4 (200mm – 125mm from border line)
3.9 Differentials Let y = f(x) represent a function that is differentiable in an open interval containing x. The differential of x (denoted by dx) is any.
Collision testing. learning targets Increase awareness of the struggles that of game development; Recognize computer science elements for game logic;
S1&S2 course work Volleyball. Volleyball Volleyball is a net sport that is played in teams of 6 players. Volleyball is a net sport that is played in teams.
Programming games Show work on site. Work on slide show. Timed event for bouncing ball. Homework: [Finish slide show and upload to site.] Acquire a short.
HTML5 ProgLan HTML5 Making a Game on the Canvas Part 1.
Game Development with JS and Canvas 2D
Chp 4: Input and Output Devices
Breakout 3D Jeremy Quick.
Animation & Games Module
7.2/7.3 The Discriminant & Quadratic Formula
Catapult 2014 Session 10.
7.2/7.3 The Discriminant & Quadratic Formula
Tables:.
The One Where You Scratch
Starter 15//2 = 7 (Quotient or Floor) (Modulus) 22%3 =1
بسم الله الرحمن الرحيم الموضوع:الوضوء صفته وفرائضه وسننه
Chapter 10 Algorithms.
9-4 Quadratic Equations and Projectiles
Fractions.
Programs Involving Repetition
Chapter 10 Algorithms.
Breakout in Greenfoot Barb Ericson
True Shapes Pointers for the Exam Worked Example True shape Tips
Programming for Art: Images
2 types of scale factor problems
CSc 337 Lecture 20: Canvas.
Chapter 10 Algorithms.
CS 1114: Introduction to Computing Using MATLAB and Robotics
Programming Games Reprise on drawing on canvas. Jargon (concepts): objects. Demonstrate slingshot. Mouse events. Work on animation project. Homework: Finish.
class status report game design & tech fall /19/03
Volumes by Cylindrical Shells Rita Korsunsky.
Mixed Numbers Equivalent Simplest Form Comparing
Lec 17 Using Nested Loops and Objects in an Applet Class
Collisions with Static Objects
Presentation transcript:

HTML5 – Completing Your Game Proglan HTML5 Part 3

The Bricks var bricks; var NROWS; var NCOLS; var BRICKWIDTH; var BRICKHEIGHT; var PADDING; function initbricks() { NROWS = 5; NCOLS = 5; BRICKWIDTH = (WIDTH/NCOLS) - 1; BRICKHEIGHT = 15; PADDING = 1; bricks = new Array(NROWS); for (i=0; i < NROWS; i++) { bricks[i] = new Array(NCOLS); for (j=0; j < NCOLS; j++) { bricks[i][j] = 1; } function draw() { clear(); circle(x, y, 10); if (rightDown) paddlex += 5; else if (leftDown) paddlex -= 5; rect(paddlex, HEIGHT-paddleh, paddlew, paddleh); //draw bricks for (i=0; i < NROWS; i++) { for (j=0; j < NCOLS; j++) { if (bricks[i][j] == 1) { rect((j * (BRICKWIDTH + PADDING)) + PADDING, (i * (BRICKHEIGHT + PADDING)) + PADDING, BRICKWIDTH, BRICKHEIGHT); } //have we hit a brick? rowheight = BRICKHEIGHT + PADDING; colwidth = BRICKWIDTH + PADDING; row = Math.floor(y/rowheight); col = Math.floor(x/colwidth); //if so, reverse the ball and mark the brick as broken if (y = 0 && col >= 0 && bricks[row][col] == 1) { dy = -dy; bricks[row][col] = 0; } if (x + dx > WIDTH || x + dx < 0) dx = -dx; if (y + dy < 0) dy = -dy; else if (y + dy > HEIGHT) { if (x > paddlex && x < paddlex + paddlew) dy = -dy; else clearInterval(intervalId); } x += dx; y += dy; } init(); initbricks();

Finishing Touches var ballr = 10; var rowcolors = ["#FF1C0A", "#FFFD0A", "#00A308", "#0008DB", "#EB0093"]; var paddlecolor = "#FFFFFF"; var ballcolor = "#FFFFFF"; var backcolor = "#000000"; function draw() { ctx.fillStyle = backcolor; clear(); ctx.fillStyle = ballcolor; circle(x, y, ballr); if (rightDown) paddlex += 5; else if (leftDown) paddlex -= 5; ctx.fillStyle = paddlecolor; rect(paddlex, HEIGHT-paddleh, paddlew, paddleh); drawbricks(); //want to learn about real collision detection? go read // rowheight = BRICKHEIGHT + PADDING; colwidth = BRICKWIDTH + PADDING; row = Math.floor(y/rowheight); col = Math.floor(x/colwidth); //reverse the ball and mark the brick as broken if (y = 0 && col >= 0 && bricks[row][col] == 1) { dy = -dy; bricks[row][col] = 0; } if (x + dx + ballr > WIDTH || x + dx - ballr < 0) dx = -dx; if (y + dy - ballr < 0) dy = -dy; else if (y + dy + ballr > HEIGHT - paddleh) { if (x > paddlex && x < paddlex + paddlew) { //move the ball differently based on where it hit the paddle dx = 8 * ((x-(paddlex+paddlew/2))/paddlew); dy = -dy; } else if (y + dy + ballr > HEIGHT) clearInterval(intervalId); } x += dx; y += dy; } init(); initbricks();

Enjoy your game