150 likes | 165 Views
Learn how to make engaging games using the Board class, suitable for all levels of students. Explore animations, click interactions, and project scalability.
E N D
CASCON 2007 Workshop Presentation Using the Board to create (interesting, Useful, Extendible...) games Troy Vasiga Lecturer, Cheriton School of Computer Science University of Waterloo
Outline • What makes an assignment good? • Introduction and overview of Board class • Motivation • Simple animations and extensions • Dealing with clicks and lines • Larger scale projects • Summary CASCON 2007 Workshop Presentation
What makes an assignment good? • Assignments should be: • Interesting • Approachable (for beginning students) • Extendible (for higher level students) • Useful • Related to the curriculum CASCON 2007 Workshop Presentation
Board overview • Create one dimensional and two dimensional “Boards” of arbitrary (discrete) size • Boards allow us to put pegs (of virtually any colour) and remove pegs • Boards allow us to place lines between any two positions and remove lines • Boards allow messages to be printed • Boards allow us to obtain their size • Boards allow mouse clicks to be obtained from each position • See handout: BoardReference.pdf CASCON 2007 Workshop Presentation
My motivation CASCON 2007 Workshop Presentation
Pong CASCON 2007 Workshop Presentation
Breakout CASCON 2007 Workshop Presentation
Kaboom CASCON 2007 Workshop Presentation
Fundamentals • All these games have • Low-resolution (good for the board) • Discrete motion • Simple animation involving a moving ball • Simple animation involving a “blocker”/ “bouncer” CASCON 2007 Workshop Presentation
Simple Animation • This program should be accessible to all students • Deals only with method calls • No if statements • No loops • Specification: create a one-dimensional board of size 5. Have a black peg move across from left to right as if it was moving. It should disappear at the end. • Enhancements: • Have it loop • Have it “bounce” back and forth CASCON 2007 Workshop Presentation
More extensions • Instead of simply bouncing, let’s have the animation do something more complicated, like go in a spiral. • A static version is shown here: spiral.pdf • Note the ability for students at various levels to approach this problem: • Simple lines • Static points • Dynamic animation CASCON 2007 Workshop Presentation
Getting a grasp on clicks and lines • To begin, we will get a grasp on clicks • This will be the input mechanism to move the bouncer • A nice warm up exercise: linedraw.pdf • Simple loop, no if statements, very few variables CASCON 2007 Workshop Presentation
Simple bouncer • Let’s create the bouncer • It should move along the bottom of a given board • A click to the right of the bouncer should move it to the right. • A click to the left of the bouncer should move it to the left. CASCON 2007 Workshop Presentation
Larger scale projects • Flipper: flipper.pdf • Checkers • Chess (colours can be different pieces: messages can indicates which pieces are being moved) • Mario-type game CASCON 2007 Workshop Presentation
Summary • The Board offers lots of benefit • Little overhead (compared to other graphics libraries in Java) • Discrete, integer based model • Easy to create animation • Accessible to students of all ability (easy to partition assignments into approachable levels) • Free CASCON 2007 Workshop Presentation