add text instructions for each game
This commit is contained in:
parent
f5eee290fb
commit
5aae54fe65
7 changed files with 50 additions and 5 deletions
5
notes.md
5
notes.md
|
|
@ -1,3 +1,8 @@
|
||||||
|
### divers
|
||||||
|
- messages d'explication des jeux
|
||||||
|
- fade out au bout d'un certain temps
|
||||||
|
- fade out dès que le score du jeu bouge
|
||||||
|
|
||||||
### mini game ideas
|
### mini game ideas
|
||||||
|
|
||||||
#### fridge
|
#### fridge
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ export class CleanupHS extends TimedGame {
|
||||||
this.trashLandingZone.addChild(trashcan);
|
this.trashLandingZone.addChild(trashcan);
|
||||||
this.shelfLandingZone.addChild(shelf);
|
this.shelfLandingZone.addChild(shelf);
|
||||||
|
|
||||||
|
this._gameDesc.text = "Range le HS !!";
|
||||||
|
this._instruction.text = "drag & drop les objets dans le bon contenant";
|
||||||
|
|
||||||
this.trashLandingZone.layout = { width: "20%", height: "100%" };
|
this.trashLandingZone.layout = { width: "20%", height: "100%" };
|
||||||
this.shelfLandingZone.layout = {
|
this.shelfLandingZone.layout = {
|
||||||
width: "20%",
|
width: "20%",
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ export class Fridge extends TimedGame {
|
||||||
|
|
||||||
this.timeout = this._bottleCount * 1500; // 1.5s per bottle
|
this.timeout = this._bottleCount * 1500; // 1.5s per bottle
|
||||||
|
|
||||||
|
this._gameDesc.text = "Remplis le frigo !!";
|
||||||
|
this._instruction.text = "drag & drop les club mate dans le frigo";
|
||||||
|
|
||||||
const fridgeContainer = new Container();
|
const fridgeContainer = new Container();
|
||||||
fridgeContainer.layout = { width: "50%" };
|
fridgeContainer.layout = { width: "50%" };
|
||||||
const fridge = Sprite.from("frigo");
|
const fridge = Sprite.from("frigo");
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,45 @@
|
||||||
import { Container, RenderLayer } from "pixi.js";
|
import { Container, RenderLayer, Text } from "pixi.js";
|
||||||
|
|
||||||
export class Game {
|
export class Game {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._difficulty = 1;
|
this._difficulty = 1;
|
||||||
this.won = false;
|
this.won = false;
|
||||||
|
|
||||||
this.gameContainer = new Container(); // main container, to add the game to a node, add this container as a child
|
this.gameContainer = new Container(); // main container, to add the game to a node, add this container as a child
|
||||||
this.gameContainer.layout = true;
|
this.gameContainer.layout = true;
|
||||||
/*
|
|
||||||
this._uiLayer = new Container();
|
|
||||||
this._gameObjectsLayer = new Container();*/
|
|
||||||
this._uiLayer = new RenderLayer();
|
this._uiLayer = new RenderLayer();
|
||||||
this._gameObjectsLayer = new RenderLayer();
|
this._gameObjectsLayer = new RenderLayer();
|
||||||
this._gameObjectsLayer.sortableChildren = true;
|
this._gameObjectsLayer.sortableChildren = true;
|
||||||
|
|
||||||
|
this._gameDesc = new Text({
|
||||||
|
text: "",
|
||||||
|
style: {
|
||||||
|
fontFamily: "Arial",
|
||||||
|
fontSize: 30,
|
||||||
|
fill: 0x000000,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this._instruction = new Text({
|
||||||
|
text: "",
|
||||||
|
style: {
|
||||||
|
fontFamily: "Arial",
|
||||||
|
fontSize: 30,
|
||||||
|
fill: 0x000000,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this._gameDesc.layout = { position: "absolute", left: "40%" };
|
||||||
|
this._instruction.layout = {
|
||||||
|
position: "absolute",
|
||||||
|
left: "40%",
|
||||||
|
top: "40%",
|
||||||
|
};
|
||||||
|
|
||||||
|
this._addUiChild(this._gameDesc);
|
||||||
|
this._addUiChild(this._instruction);
|
||||||
|
|
||||||
this.gameContainer.addChild(this._gameObjectsLayer);
|
this.gameContainer.addChild(this._gameObjectsLayer);
|
||||||
this.gameContainer.addChild(this._uiLayer);
|
this.gameContainer.addChild(this._uiLayer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ export class Opinator extends TimedGame {
|
||||||
this._lastMousePos = undefined; // use to compute the travelled distance
|
this._lastMousePos = undefined; // use to compute the travelled distance
|
||||||
|
|
||||||
this.timeout = this._baseGoalScore * 1000; // 1s per sprite len
|
this.timeout = this._baseGoalScore * 1000; // 1s per sprite len
|
||||||
|
this._gameDesc.text = "Répare opinator !!";
|
||||||
|
this._instruction.text = "clique et agite la souris";
|
||||||
|
|
||||||
this._backgroundSprite = Sprite.from("opinator");
|
this._backgroundSprite = Sprite.from("opinator");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,15 @@ export class SmartMonday extends TimedGame {
|
||||||
constructor(ticker) {
|
constructor(ticker) {
|
||||||
super(10000, ticker);
|
super(10000, ticker);
|
||||||
|
|
||||||
|
this._gameDesc.text = "Organise le smart monday !!";
|
||||||
|
this._instruction.text = "spam le clavier";
|
||||||
|
|
||||||
this._goal = 100 * this._difficulty; // number of characters
|
this._goal = 100 * this._difficulty; // number of characters
|
||||||
this.timeout = 1000 * (this._goal / 10); // 10 chars per second
|
this.timeout = 1000 * (this._goal / 10); // 10 chars per second
|
||||||
|
|
||||||
this._currentString = "";
|
this._currentString = "";
|
||||||
this._keyEventHandle = undefined;
|
this._keyEventHandle = undefined;
|
||||||
|
this.gameContainer.layout = { width: "100%", height: "100%" };
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ function switchToGame(gameContainer, newGame) {
|
||||||
const fridge = new Fridge(app.ticker);
|
const fridge = new Fridge(app.ticker);
|
||||||
const smartMonday = new SmartMonday(app.ticker);
|
const smartMonday = new SmartMonday(app.ticker);
|
||||||
const cleanupHS = new CleanupHS(root.width, root.height, app.ticker);
|
const cleanupHS = new CleanupHS(root.width, root.height, app.ticker);
|
||||||
let currentGame = opinator;
|
let currentGame = cleanupHS;
|
||||||
gameContainter.addChild(currentGame.gameContainer);
|
gameContainter.addChild(currentGame.gameContainer);
|
||||||
|
|
||||||
root.addChild(gameContainter);
|
root.addChild(gameContainter);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue