Skip to content

Commit

Permalink
adding nightmare traces
Browse files Browse the repository at this point in the history
  • Loading branch information
jujusb committed Oct 9, 2024
1 parent 732785c commit 5c6e48b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/gameObjects/reportablePhoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class ReportablePhoto extends Phaser.GameObjects.Container {
this.speed = speed;

// Foto
this.frame = frame;
this.image = this.scene.add.image(0, 0, 'photos', frame);
this.add(this.image);

Expand Down
7 changes: 5 additions & 2 deletions src/scenes/gameLoop/day1/nightmareDay1.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { gameObjectXapiTracker } from '../../../lib/xapi.js';
import { GAMEOBJECTTYPE } from '../../../xAPITracker/HighLevel/GameObject.js';
import NightmareMinigame from '../baseScenarios/nightmareMinigame.js'

export default class NightmareDay1 extends NightmareMinigame {
Expand Down Expand Up @@ -104,10 +106,11 @@ export default class NightmareDay1 extends NightmareMinigame {
chair.removeInteractive();

if (node) {
gameObjectXapiTracker.sendStatement(gameObjectXapiTracker.Interacted("chair_with_dialog", GAMEOBJECTTYPE.ITEM));
this.lastTouchedChair = chair;
this.dialogManager.setNode(node);
}
else {
} else {
gameObjectXapiTracker.sendStatement(gameObjectXapiTracker.Interacted("chair_without_dialog", GAMEOBJECTTYPE.ITEM));
this.chairFadesOut(chair);
}
});
Expand Down
5 changes: 5 additions & 0 deletions src/scenes/gameLoop/day2/nightmareDay2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { gameObjectXapiTracker } from '../../../lib/xapi.js';
import { GAMEOBJECTTYPE } from '../../../xAPITracker/HighLevel/GameObject.js';
import NightmareMinigame from '../baseScenarios/nightmareMinigame.js';
import ChairWithGum from '../../../gameObjects/chairWithGum.js';

Expand Down Expand Up @@ -168,6 +170,9 @@ export default class NightmareDay2 extends NightmareMinigame {

gum.setInteractive({ useHandCursor: true });
gum.on('pointerup', () => {
var statement = gameObjectXapiTracker.Interacted("gum", GAMEOBJECTTYPE.ITEM);
gameObjectXapiTracker.sendStatement(statement);

// Si se clica, se elmina del grupo y se destruye
this.gums.remove(gum, true, true);
})
Expand Down
3 changes: 3 additions & 0 deletions src/scenes/gameLoop/day4/nightmareDay4.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { gameObjectXapiTracker } from '../../../lib/xapi.js';
import { GAMEOBJECTTYPE } from '../../../xAPITracker/HighLevel/GameObject.js';
import NightmareMinigame from '../baseScenarios/nightmareMinigame.js';
import ReportablePhoto from '../../../gameObjects/reportablePhoto.js';

Expand Down Expand Up @@ -74,6 +76,7 @@ export default class NightmareDay4 extends NightmareMinigame {
// Se crea la foto segun los parametros
let photo = new ReportablePhoto(this, photosParams.scale, this.sprites[randomSprite], photosParams.speed,
photosParams.minTouches, photosParams.maxTouches, () => {
gameObjectXapiTracker.sendStatement(gameObjectXapiTracker.Interacted("photo_" + photo.frame, GAMEOBJECTTYPE.ITEM));
// Cuando se ha pulsado un numero determinado de clics...
// Se produce un terremoto
if (this.shakeCompleted) {
Expand Down

0 comments on commit 5c6e48b

Please sign in to comment.