amazing
This commit is contained in:
@@ -5,12 +5,12 @@ const defaults = {
|
||||
arrows:{
|
||||
r: len => ({ type: 'image', value: '/static/textures/arrow.png', position:[-.5,.44,len+.96], rotation:[0,Math.PI, 0], scale: [0.03, 0.03, 0.03] }),
|
||||
l: len => ({ type: 'image', value: '/static/textures/arrow.png', position:[.5,.44,len+.96], rotation:[0,Math.PI, Math.PI], scale: [0.03, 0.03, 0.03] }),
|
||||
f: len => ({ type: 'image', value: '/static/textures/arrow.png', position:[0,.73,len+.96], rotation:[0,Math.PI, Math.PI/2], scale: [0.03, 0.03, 0.03] })
|
||||
f: len => ({ type: 'image', value: '/static/textures/arrow.png', position:[0,.7,len+.96], rotation:[0,Math.PI, Math.PI/2], scale: [0.03, 0.03, 0.03] })
|
||||
},
|
||||
answers:{
|
||||
r: (len, text) => ({ type: 'text', text, position:[-.5,.3,len+.9], rotation:[0,Math.PI, 0] }),
|
||||
l: (len, text) => ({ type: 'text', text, position:[.5,.3,len+.9], rotation:[0,Math.PI, 0] }),
|
||||
f: (len, text) => ({ type: 'text', text, position:[0,.7,len+.9], rotation:[0,Math.PI, 0] })
|
||||
r: (len, text) => ({ type: 'text', width:0.5, text, fontSize:0.025, position:[-.5,.3,len+.9], rotation:[0,Math.PI, 0] }),
|
||||
l: (len, text) => ({ type: 'text', width:0.5, text, fontSize:0.025, position:[.5,.3,len+.9], rotation:[0,Math.PI, 0] }),
|
||||
f: (len, text) => ({ type: 'text', width:0.5, text, fontSize:0.025, position:[0,.55,len+.9], rotation:[0,Math.PI, 0] })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,16 +28,16 @@ class MazeQuizGame {
|
||||
return this.object;
|
||||
}
|
||||
|
||||
generate(questions, idx = 0){
|
||||
generate(questions, idx = 0, len){
|
||||
let cq = questions[idx]
|
||||
if (!cq) return {};
|
||||
let len = Math.round(Math.random()*tl) + 2;
|
||||
len = len || Math.round(Math.random()*tl) + 2;
|
||||
|
||||
let l = {
|
||||
l: Math.round(Math.random()*tl) + 2,
|
||||
r: Math.round(Math.random()*tl) + 2,
|
||||
f: Math.round(Math.random()*tl) + 2
|
||||
}
|
||||
// let l = {
|
||||
// l: Math.round(Math.random()*tl) + 2,
|
||||
// r: Math.round(Math.random()*tl) + 2,
|
||||
// f: Math.round(Math.random()*tl/2) + 2
|
||||
// }
|
||||
|
||||
let directions = Utils.shuffleArray( ['l', 'r', 'f'] )
|
||||
|
||||
@@ -45,7 +45,7 @@ class MazeQuizGame {
|
||||
len,
|
||||
objects:[
|
||||
{
|
||||
type: 'text', text: cq.q, position:[0,.4,len + .96], rotation:[0,Math.PI, 0]
|
||||
type: 'text', text: cq.q, fontSize:0.033, width:0.5, position:[0,.33,len + .96], rotation:[0,Math.PI, 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -58,33 +58,36 @@ class MazeQuizGame {
|
||||
)
|
||||
let dd;
|
||||
if (d == 'f'){
|
||||
dd = l.l > l.r ? 'l' : 'r';
|
||||
dd = Math.round() > 0.5 ? 'l' : 'r';
|
||||
}else {
|
||||
dd = d == 'l' ? 'r' : 'l'
|
||||
}
|
||||
if (i == 0){
|
||||
mo[d] = {
|
||||
len: l[d],
|
||||
[dd]: this.generate(questions, idx + 1)
|
||||
len: 4,
|
||||
[dd]: this.generate(questions, idx + 1, 3)
|
||||
}
|
||||
}else{
|
||||
mo[d] = {
|
||||
len: l[d],
|
||||
len: 4,
|
||||
[dd]: {
|
||||
len: 8 - l[d],
|
||||
len: 2,
|
||||
objects:[
|
||||
{
|
||||
type: 'text', text: cq.h, position:[0,.44,8 - l[d]+.96], rotation:[0,Math.PI, 0]
|
||||
type: 'text', width:0.5, color:0xff0000, text: cq.h, fontSize:0.033, position:[0,.44,2+.96], rotation:[0,Math.PI, 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d == 'f'){
|
||||
let path = mo[d][dd];
|
||||
mo[d][dd] = {
|
||||
len: 1,
|
||||
[dd == 'r' ? 'l' : 'r']: path
|
||||
mo[d].len = 2;
|
||||
if (i == 0){
|
||||
let path = mo[d][dd];
|
||||
mo[d][dd] = {
|
||||
len: 1,
|
||||
[dd == 'r' ? 'l' : 'r']: path
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user