Skip to content

Commit

Permalink
Merge pull request #6 from Product-College-Courses/master
Browse files Browse the repository at this point in the history
update to class
  • Loading branch information
seve authored Dec 11, 2018
2 parents b3682ac + ab561a4 commit adc6c8d
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 6 deletions.
15 changes: 10 additions & 5 deletions class-11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.





Expand Down
8 changes: 8 additions & 0 deletions solutions/README.md
Original file line number Diff line number Diff line change
@@ -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)
38 changes: 37 additions & 1 deletion solutions/breakout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,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
Expand All @@ -183,7 +210,8 @@
ctx.fillText(this.text, this.x, this.y)
}
}
// ----------------------
// ---------------------

// Defines a game label
class GameLabel extends Label {
constructor(text, font, color, align) {
Expand All @@ -198,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 {
Expand Down
27 changes: 27 additions & 0 deletions study-guide.md
Original file line number Diff line number Diff line change
@@ -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)



0 comments on commit adc6c8d

Please sign in to comment.