From 746f8455f2127606741109fc4199ea9090e34aae Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 3 Dec 2018 21:32:58 -0800 Subject: [PATCH 1/2] added study guide --- solutions/breakout/index.html | 12 ++++++++++++ study-guide.md | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 study-guide.md diff --git a/solutions/breakout/index.html b/solutions/breakout/index.html index 2a6022e..0389438 100644 --- a/solutions/breakout/index.html +++ b/solutions/breakout/index.html @@ -55,6 +55,18 @@ this.x = 0 this.y = 0 } + + moveTo(x, y) { + this.x = x + this.y = y + return this + } + + moveBy(dx, dy) { + this.x += dx + this.y += dy + return this + } } // ---------------------- // Defines the ball diff --git a/study-guide.md b/study-guide.md new file mode 100644 index 0000000..ab21757 --- /dev/null +++ b/study-guide.md @@ -0,0 +1,27 @@ +# Study Guide + +The notes here are to help you prepare for the final assessment. + +1. Arrays + - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array +2. Multi Dimensional Arrays + - https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript +3. Dependancy Injection + - [Class 04](class-04) +5. Refactoring + - [Class 4](class-04) +6. ES6 Classes + - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes +7. EventListeners + - https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener +8. Template Strings + - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals +9. Variables: const, let, and var + - https://hackernoon.com/js-var-let-or-const-67e51dbb716f +10. Debugging + - [Class 08](class-08) +11. Webpack + - [Class 10](class-10) + + + From ab561a4030330293b2caa4fee23587f21d948739 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 4 Dec 2018 17:00:23 -0800 Subject: [PATCH 2/2] added solutions for Phaser --- class-11/README.md | 15 ++++++++++----- solutions/README.md | 8 ++++++++ solutions/breakout/index.html | 26 +++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 solutions/README.md diff --git a/class-11/README.md b/class-11/README.md index 84bb0aa..b565dad 100644 --- a/class-11/README.md +++ b/class-11/README.md @@ -150,12 +150,17 @@ these values are missing. ## Extending Phaser's classes The Phaser's classes exist for you to use. You can use them as is. -That is just make an instance and you're good to go. -In some cases they also may not have all of the functionality that -you might need for your uses. In these cases you can add new properties -and methods by creating a new class that extends one of the Phaser -classes. +In some cases they also may not have all of the functionality that you might need for your uses. In these cases you can add new properties and methods by creating a new class that extends one of the Phaser classes. + +### Extending Phaser.Scene + +Phaser games are made up of Scenes. A scene represents one view of a game. A game might have a scene for preloading, +a scene that displays a menu, and a scene to play the game. + +Each of these scenes would need custom code that is unique to each. A good way to organize code around this is to create custom classes that extend Phaser.Scene. + + diff --git a/solutions/README.md b/solutions/README.md new file mode 100644 index 0000000..859f832 --- /dev/null +++ b/solutions/README.md @@ -0,0 +1,8 @@ +# Solutions + +This folder contains solutions to the projects. + +- [Breakout](breakout) +- [Oregon Trail](oregon-trail) +- [Boom Dots Phaser 3](https://github.com/soggybag/doom-bots-webpack) +- [Flappy Bird Phaser 3](https://github.com/soggybag/flappy-bird-webpack) \ No newline at end of file diff --git a/solutions/breakout/index.html b/solutions/breakout/index.html index 0389438..dbeb6ed 100644 --- a/solutions/breakout/index.html +++ b/solutions/breakout/index.html @@ -187,6 +187,21 @@ this.color = color this.align = align } + + setColor(color) { + this.color = color + return this + } + + setFont(font) { + this.font = font + return this + } + + setText(text) { + this.text = text + return this + } render(ctx) { ctx.font = this.font @@ -195,7 +210,8 @@ ctx.fillText(this.text, this.x, this.y) } } - // ---------------------- + // --------------------- + // Defines a game label class GameLabel extends Label { constructor(text, font, color, align) { @@ -210,6 +226,14 @@ ctx.fillText(`${this.text} ${this.value}`, this.x, this.y) } } + + class MyLabel extends Label { + constructor() { + super('Hello', '24px Helvetica', 'blue') + } + } + + new MyLabel() // ---------------------- // Defines the game class Game {