Download presentation
Presentation is loading. Please wait.
Published byJalyn Slingsby Modified over 9 years ago
1
Presenter: (Mike, Rob, etc.) Readings: (link to the game’s design doc?) Java & SpaceSmasher Version: “Some witty game quote here” Repetition & Real-time Simulations
2
Soon we’ll switch software simulations, but this time we’ll reuse our familiar SpaceSmasher environment Demo SpaceSmasher V2
3
Understanding & practice with: A Single While Loop A Single For Loop Translating For Loops to While Loops And vice-versa TBA While Loops with Multiple Conditions TBA && || Nesting loops inside loops with For Mixing nested For and While Loops Lab Goals & Outcomes
4
SpaceSmasher is a complex but exciting environment! Outcomes are similar to a typical CS1 class, but with different: Pros Examples Content Motivation Cons Setup Length Complexity Game Lab Pros & Cons
5
An even more fully-featured SpaceSmasher game When compared to the if statement lab The first step is to read the lab We’ll start together on TODO1 At the End of Lab
6
For & While Flowchart Should we make another row of blocks? True False addFireBlock() addIceBlock() addFireBlock() addIceBlock() Start End
7
For & While Flowchart Should we make another row of blocks? True False addFireBlock() addIceBlock() addFireBlock() addIceBlock()
8
Sequential Loops Flowchart
9
Loops here are not logically related to one another In other words, they’re not nested or related in any way If one loop fails to execute due to the loop condition evaluating to false, this affects no other loops A set of loops that each must be evaluated And if one is skipped, this has no bearing on the other loops. Contrast this behavior to Nested Loops
10
Loops Inside Loops (Nested)
11
Also called Nested Loops for(…) { //outer loop //outer loop code //which includes //an inner loop for(…) { //inner loop //inner loop code } } Loops Inside Loops (Nested) Note that if the outer loop’s condition is initially false: You never do any part of the outer loop, including the inner loop!
12
INSERT CLICKER QUESTION
13
TBAWhich of the following are true regarding Sequential IFs? Which of the following are true regarding Chained IF/ELSEs? Single, Sequential Loops Versus Nested Loops
14
Paddles don’t work No keyboard support for movement No mouse support for movement Spawning only No collision support They do change when an upgrade block is hit Balls don’t work They pass right through the paddle They don’t change with the paddle To an IceBall or FireBall TBAIn The Beginning…
15
First, we’ll add keyboard support This should spawn balls just like the left mouse button (TODO1 Single IF) And, the left and right keys should move the paddle (TODO2 Single IF) Then, we’ll add mouse support for left & right (TODO3 Chained IF) Next, we’ll fix the issue regarding paddle and ball collisions (TODO 0) TBALab Activities
16
We’ll refactor some existing code using && (TODO4) To make it shorter and clearer Then reduce a different code segment using || (TODO5) Finally, we’ll fix the ball so it turns to an IceBall if the paddle is ice (TODO6)** And a FireBall if the paddle is fire Lab Activities Continued
17
Variables & Methods
18
An even more complete SpaceSmasher experience Start by reading the lab We’ll start together on TODO1 in 10 minutes Look at the EXAMPLES for code samples At the End…
19
Once the lab is complete, look at the assignment. What about a version of this game that TBA Or, what about a version of this game that TBA Building BetterVersions of SmaceSmasher
20
tba SpaceSmasher Assignment
21
tba SpaceSmasher Assignment
22
tba SpaceSmasher Assignment
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.