simplified scene description
This commit is contained in:
parent
ffebe4c64b
commit
1cc25c81ca
|
@ -39,7 +39,7 @@
|
|||
window.removeEventListener('keydown', listener, true);
|
||||
|
||||
/* play the selected choice screen */
|
||||
this.scenes.choice.play(scene)
|
||||
this.scenes['choice_' + scene].play()
|
||||
/* then play the chosen scene */
|
||||
.then(() => this.scenes[scene].play())
|
||||
/* then play the reinaldo scene */
|
||||
|
|
32
app/scene.js
32
app/scene.js
|
@ -6,15 +6,8 @@
|
|||
|
||||
let Scene = function(scene, canvas) {
|
||||
|
||||
/* frames that compose this scene. a frame is made up of several
|
||||
overlapped images. */
|
||||
this.frames = scene.frames;
|
||||
|
||||
/* default roll (sequence of frames) of this scene */
|
||||
this.roll = scene.roll;
|
||||
|
||||
/* other rolls that depend on choices (like key presses) */
|
||||
this.choices = scene.choices;
|
||||
/* scene definition from json */
|
||||
this.scene = scene;
|
||||
|
||||
/* the html5 canvas object */
|
||||
this.canvas = canvas;
|
||||
|
@ -22,21 +15,16 @@
|
|||
};
|
||||
|
||||
/* draw one of the specified frames in this scene */
|
||||
Scene.prototype.drawFrame = function(frame) {
|
||||
Scene.prototype.drawFrame = function(images) {
|
||||
|
||||
let images = this.frames[frame];
|
||||
|
||||
images.forEach((image) => {
|
||||
[].concat(images).forEach((image) => {
|
||||
this.canvas.drawImage(image);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
/* play a roll of this scene. if called with no arguments, it will
|
||||
* render the default scene roll.
|
||||
* alternatively one of the scene roll choices can be specified as
|
||||
* argument. */
|
||||
Scene.prototype.play = function(choice) {
|
||||
/* play this scene on the given canvas */
|
||||
Scene.prototype.play = function() {
|
||||
|
||||
/* transform the scene roll definition given in the .json scene file
|
||||
* into a flat array of simple ({ name, duration }) objects.
|
||||
|
@ -74,7 +62,7 @@
|
|||
|
||||
return () => new Promise((resolve, reject) => {
|
||||
|
||||
this.drawFrame(frame.name);
|
||||
this.drawFrame(frame.images);
|
||||
setTimeout(() => {
|
||||
return resolve();
|
||||
}, frame.duration);
|
||||
|
@ -86,13 +74,9 @@
|
|||
|
||||
};
|
||||
|
||||
/* pick scene to render between one of the several scene roll choices
|
||||
* or the default scene roll */
|
||||
let scene = choice ? this.choices[choice] : this.roll;
|
||||
|
||||
/* expand the scene definition (get a flat array of simple { name, duration }
|
||||
* objects */
|
||||
let expanded = expand(scene);
|
||||
let expanded = expand(this.scene.roll);
|
||||
|
||||
/* transform the array obtained into an array of functions */
|
||||
let functionalized = functionalize(expanded);
|
||||
|
|
|
@ -1,108 +1,89 @@
|
|||
{
|
||||
"frames": {
|
||||
"anal_initial": [
|
||||
"room",
|
||||
"anal_base",
|
||||
"anal_frame1"
|
||||
],
|
||||
"anal_frame1": [
|
||||
"anal_frame1"
|
||||
],
|
||||
"anal_frame2": [
|
||||
"anal_frame2"
|
||||
],
|
||||
"anal_balloon_grosso": [
|
||||
"anal_balloon_grosso"
|
||||
],
|
||||
"anal_balloon_clear": [
|
||||
"anal_balloon_clear"
|
||||
],
|
||||
"anal_balloon_aaaa": [
|
||||
"anal_balloon_aaaa"
|
||||
],
|
||||
"anal_balloon_grosso_aaaa": [
|
||||
"anal_balloon_grosso",
|
||||
"anal_balloon_aaaa"
|
||||
]
|
||||
},
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"anal_base",
|
||||
"anal_frame1"
|
||||
],
|
||||
"duration": 750
|
||||
},
|
||||
{
|
||||
"repeat": 10,
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_frame1",
|
||||
"images": "anal_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "anal_frame2",
|
||||
"images": "anal_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "anal_balloon_grosso"
|
||||
"images": "anal_balloon_grosso"
|
||||
},
|
||||
{
|
||||
"repeat": 5,
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_frame1",
|
||||
"images": "anal_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "anal_frame2",
|
||||
"images": "anal_frame2",
|
||||
"duration": 250
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "anal_balloon_clear"
|
||||
"images": "anal_balloon_clear"
|
||||
},
|
||||
{
|
||||
"repeat": 5,
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_frame1",
|
||||
"images": "anal_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "anal_frame2",
|
||||
"images": "anal_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "anal_balloon_aaaa"
|
||||
"images": "anal_balloon_aaaa"
|
||||
},
|
||||
{
|
||||
"repeat": 5,
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_frame1",
|
||||
"images": "anal_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "anal_frame2",
|
||||
"images": "anal_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "anal_balloon_grosso_aaaa"
|
||||
"images": [
|
||||
"anal_balloon_grosso",
|
||||
"anal_balloon_aaaa"
|
||||
]
|
||||
},
|
||||
{
|
||||
"repeat": 5,
|
||||
"roll": [
|
||||
{
|
||||
"name": "anal_frame1",
|
||||
"images": "anal_frame1",
|
||||
"duration": 100
|
||||
},
|
||||
{
|
||||
"name": "anal_frame2",
|
||||
"images": "anal_frame2",
|
||||
"duration": 100
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,42 +1,12 @@
|
|||
{
|
||||
"frames": {
|
||||
"choice_initial": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"choice_balloon_queres"
|
||||
],
|
||||
"choice_anal": [
|
||||
"choice_balloon_anal"
|
||||
],
|
||||
"choice_vaginal": [
|
||||
"choice_balloon_vaginal"
|
||||
],
|
||||
"choice_oral": [
|
||||
"choice_balloon_oral"
|
||||
]
|
||||
},
|
||||
"roll": [
|
||||
{ "name": "choice_initial" }
|
||||
],
|
||||
"choices": {
|
||||
"anal": [
|
||||
{
|
||||
"name": "choice_anal",
|
||||
"duration": 750
|
||||
}
|
||||
],
|
||||
"vaginal": [
|
||||
{
|
||||
"name": "choice_vaginal",
|
||||
"duration": 750
|
||||
}
|
||||
],
|
||||
"oral": [
|
||||
{
|
||||
"name": "choice_oral",
|
||||
"duration": 750
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"choice_balloon_queres"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"roll": [
|
||||
{
|
||||
"images": "choice_balloon_anal",
|
||||
"duration": 1500
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"roll": [
|
||||
{
|
||||
"images": "choice_balloon_oral",
|
||||
"duration": 1500
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"roll": [
|
||||
{
|
||||
"images": "choice_balloon_vaginal",
|
||||
"duration": 1500
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,50 +1,38 @@
|
|||
{
|
||||
"frames": {
|
||||
"oral_initial": [
|
||||
"room",
|
||||
"oral_base",
|
||||
"oral_frame1"
|
||||
],
|
||||
"oral_frame1": [
|
||||
"oral_frame1"
|
||||
],
|
||||
"oral_frame2": [
|
||||
"oral_frame2"
|
||||
],
|
||||
"oral_balloon_chupa": [
|
||||
"oral_balloon_chupa"
|
||||
]
|
||||
},
|
||||
"roll": [
|
||||
{
|
||||
"name": "oral_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"oral_base",
|
||||
"oral_frame1"
|
||||
],
|
||||
"duration": 750
|
||||
},
|
||||
{
|
||||
"repeat":20,
|
||||
"repeat": 20,
|
||||
"roll": [
|
||||
{
|
||||
"name": "oral_frame1",
|
||||
"images": "oral_frame1",
|
||||
"duration": 250
|
||||
},
|
||||
{
|
||||
"name": "oral_frame2",
|
||||
"images": "oral_frame2",
|
||||
"duration": 250
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "oral_balloon_chupa"
|
||||
"images": "oral_balloon_chupa"
|
||||
},
|
||||
{
|
||||
"repeat": 10,
|
||||
"roll": [
|
||||
{
|
||||
"name": "oral_frame1",
|
||||
"images": "oral_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "oral_frame2",
|
||||
"images": "oral_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,132 +1,121 @@
|
|||
{
|
||||
"frames": {
|
||||
"reinaldo_initial": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero"
|
||||
],
|
||||
"reinaldo_balloon_sao_1000": [
|
||||
"reinaldo_balloon_sao_1000"
|
||||
],
|
||||
"reinaldo_balloon_nao_tenho": [
|
||||
"reinaldo_balloon_nao_tenho"
|
||||
],
|
||||
"reinaldo_baloon_ho_reinaldo": [
|
||||
"reinaldo_balloon_ho_reinaldo"
|
||||
],
|
||||
"reinaldo_cabeca": [
|
||||
"reinaldo_cabeca"
|
||||
],
|
||||
"reinaldo_balloon_cu_cu": [
|
||||
"reinaldo_balloon_cu_cu"
|
||||
],
|
||||
"reinaldo_violar_initial": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"reinaldo"
|
||||
],
|
||||
"reinaldo_balloon_o_que_foi": [
|
||||
"reinaldo_balloon_o_que_foi"
|
||||
],
|
||||
"reinaldo_balloon_nao_quer_pagar": [
|
||||
"reinaldo_balloon_nao_quer_pagar"
|
||||
],
|
||||
"reinaldo_balloon_ja_vai_ver": [
|
||||
"reinaldo_balloon_ja_vai_ver"
|
||||
],
|
||||
"reinaldo_violar_base": [
|
||||
"room",
|
||||
"whore",
|
||||
"reinaldo_violar_base"
|
||||
],
|
||||
"reinaldo_violar_frame1": [
|
||||
"reinaldo_violar_frame1"
|
||||
],
|
||||
"reinaldo_violar_frame2": [
|
||||
"reinaldo_violar_frame2"
|
||||
],
|
||||
"reinaldo_balloon_caralhinho": [
|
||||
"reinaldo_balloon_caralhinho"
|
||||
]
|
||||
},
|
||||
"roll": [
|
||||
{
|
||||
"name": "reinaldo_initial",
|
||||
"duration": 1000
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero"
|
||||
],
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_sao_1000",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_sao_1000",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_initial",
|
||||
"duration": 1000
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero"
|
||||
],
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_nao_tenho",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_nao_tenho",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_initial",
|
||||
"duration": 150
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero"
|
||||
],
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_baloon_ho_reinaldo",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_ho_reinaldo",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_initial",
|
||||
"duration": 150
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero"
|
||||
],
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_cabeca",
|
||||
"images": "reinaldo_cabeca",
|
||||
"duration": 250
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_cu_cu",
|
||||
"images": "reinaldo_balloon_cu_cu",
|
||||
"duration": 750
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"reinaldo"
|
||||
],
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_o_que_foi",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_o_que_foi",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"reinaldo"
|
||||
],
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_nao_quer_pagar",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_nao_quer_pagar",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"reinaldo"
|
||||
],
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_ja_vai_ver",
|
||||
"duration": 1000
|
||||
"images": "reinaldo_balloon_ja_vai_ver",
|
||||
"duration": 1500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_initial",
|
||||
"duration": 150
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"hero",
|
||||
"reinaldo"
|
||||
],
|
||||
"duration": 500
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_base"
|
||||
"images": [
|
||||
"room",
|
||||
"whore",
|
||||
"reinaldo_violar_base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"repeat": 7,
|
||||
"roll": [
|
||||
{
|
||||
"name": "reinaldo_violar_frame1",
|
||||
"images": "reinaldo_violar_frame1",
|
||||
"duration": 250
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_frame2",
|
||||
"images": "reinaldo_violar_frame2",
|
||||
"duration": 250
|
||||
}
|
||||
]
|
||||
|
@ -135,27 +124,27 @@
|
|||
"repeat": 3,
|
||||
"roll": [
|
||||
{
|
||||
"name": "reinaldo_violar_frame1",
|
||||
"images": "reinaldo_violar_frame1",
|
||||
"duration": 250
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_frame2",
|
||||
"images": "reinaldo_violar_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_balloon_caralhinho"
|
||||
"images": "reinaldo_balloon_caralhinho"
|
||||
},
|
||||
{
|
||||
"repeat": 15,
|
||||
"roll": [
|
||||
{
|
||||
"name": "reinaldo_violar_frame1",
|
||||
"images": "reinaldo_violar_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "reinaldo_violar_frame2",
|
||||
"images": "reinaldo_violar_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,34 +1,22 @@
|
|||
{
|
||||
"frames": {
|
||||
"vaginal_initial": [
|
||||
"room",
|
||||
"vaginal_base",
|
||||
"vaginal_frame1"
|
||||
],
|
||||
"vaginal_frame1": [
|
||||
"vaginal_frame1"
|
||||
],
|
||||
"vaginal_frame2": [
|
||||
"vaginal_frame2"
|
||||
],
|
||||
"vaginal_balloon_venho": [
|
||||
"vaginal_balloon_venho"
|
||||
]
|
||||
},
|
||||
"roll": [
|
||||
{
|
||||
"name": "vaginal_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"vaginal_base",
|
||||
"vaginal_frame1"
|
||||
],
|
||||
"duration": 750
|
||||
},
|
||||
{
|
||||
"repeat": 10,
|
||||
"roll": [
|
||||
{
|
||||
"name": "vaginal_frame1",
|
||||
"images": "vaginal_frame1",
|
||||
"duration": 150
|
||||
},
|
||||
{
|
||||
"name": "vaginal_frame2",
|
||||
"images": "vaginal_frame2",
|
||||
"duration": 150
|
||||
}
|
||||
]
|
||||
|
@ -37,33 +25,37 @@
|
|||
"repeat": 5,
|
||||
"roll": [
|
||||
{
|
||||
"name": "vaginal_frame1",
|
||||
"images": "vaginal_frame1",
|
||||
"duration": 50
|
||||
},
|
||||
{
|
||||
"name": "vaginal_frame2",
|
||||
"images": "vaginal_frame2",
|
||||
"duration": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vaginal_balloon_venho"
|
||||
"images": "vaginal_balloon_venho"
|
||||
},
|
||||
{
|
||||
"repeat": 6,
|
||||
"roll": [
|
||||
{
|
||||
"name": "vaginal_frame1",
|
||||
"images": "vaginal_frame1",
|
||||
"duration": 250
|
||||
},
|
||||
{
|
||||
"name": "vaginal_frame2",
|
||||
"images": "vaginal_frame2",
|
||||
"duration": 250
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vaginal_initial",
|
||||
"images": [
|
||||
"room",
|
||||
"vaginal_base",
|
||||
"vaginal_frame1"
|
||||
],
|
||||
"duration": 2500
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue