-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with published result of episode 23.
- Loading branch information
Showing
18 changed files
with
142 additions
and
141 deletions.
There are no files selected for viewing
8 changes: 1 addition & 7 deletions
8
public/js/scenes/CompositionScene.js → public/js/CompositionScene.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import EventEmitter from "./EventEmitter.js"; | ||
import Compositor from './Compositor.js'; | ||
import EventEmitter from './EventEmitter.js'; | ||
|
||
export default class Scene { | ||
static EVENT_COMPLETE = Symbol('scene complete'); | ||
|
||
constructor() { | ||
this.events = new EventEmitter(); | ||
this.comp = new Compositor(); | ||
} | ||
|
||
end() { | ||
draw(gameContext) { | ||
this.comp.draw(gameContext.videoContext); | ||
} | ||
|
||
update(gameContext) { | ||
} | ||
|
||
pause() { | ||
console.log("Pause", this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function createColorLayer(color) { | ||
return function drawColor(context) { | ||
context.fillStyle = color; | ||
context.fillRect(0, 0, context.canvas.width, context.canvas.height); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {findPlayers} from "../player.js"; | ||
|
||
function getPlayer(level) { | ||
for (const entity of findPlayers(level)) { | ||
return entity; | ||
} | ||
} | ||
|
||
export function createPlayerProgressLayer(font, level) { | ||
const size = font.size; | ||
|
||
const spriteBuffer = document.createElement('canvas'); | ||
spriteBuffer.width = 32; | ||
spriteBuffer.height = 32; | ||
const spriteBufferContext = spriteBuffer.getContext('2d'); | ||
|
||
return function drawPlayerProgress(context) { | ||
const entity = getPlayer(level); | ||
font.print('WORLD ' + level.name, context, size * 12, size * 12); | ||
|
||
font.print('x ' + entity.player.lives.toString().padStart(3, ' '), | ||
context, size * 16, size * 16); | ||
|
||
spriteBufferContext.clearRect(0, 0, | ||
spriteBuffer.width, spriteBuffer.height); | ||
entity.draw(spriteBufferContext); | ||
context.drawImage(spriteBuffer, size * 12, size * 15); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.