Commit 7d565b85 by Oriol Gómez

boo

parent e0aa6b81
......@@ -13,6 +13,8 @@ plugins:[
new webpack.ProvidePlugin(
{
$: 'jquery',
KeyEvent: 'keycodes',
KeyboardInput: 'input',
}
)
]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
"use strict";
import {randomInt} from 'util'
import {Insect} from 'insect'
export var ins=null;
import 'keycodes';
export default class Game {
import {Timer} from 'timer'
import {KeyEvent} from 'keycodes'
import {KeyboardInput} from 'input'
class Game {
constructor() {
this.musicVolume=1;
this.rewart=new Timer()
......@@ -155,4 +159,5 @@ case 3:pan.set(1); break;
game.score-=game.level*10;
}//hit not
}
}
\ No newline at end of file
}
export {Game}
\ No newline at end of file
'use strict';
export default class KeyboardInput {
import $ from 'jquery'
class KeyboardInput {
constructor() {
this.keyDown = [];
this.justPressed = [];
......@@ -57,3 +58,4 @@ export default class KeyboardInput {
return false;
}
}
export {KeyboardInput}
\ No newline at end of file
import {soundObject} from 'soundObject'
import sono from 'sono'
import {game} from 'main'
import {randomInt} from 'util'
class Insect {
constructor() {
this.vol=0.1
this.position=null;
......
"use strict";
import {TTS,useWebTTS} from 'tts'
if (typeof speech == "undefined") var speech = new TTS();
import $ from 'jquery'
import 'keycodes';
import {KeyEvent} from 'keycodes';
import 'header';
import Strings from 'strings';
import 'menu';
import 'menuItem'
import {Menu} from 'menu';
import {menuTypes, MenuItem} from 'menuItem'
var strings=new Strings();
var tick=null;
var sKill;
......@@ -14,9 +16,9 @@ var timeToLoad=0;
var sndProgress=null;
var isMobile=false
$(document).ready(playIntro);
import 'input'
import {KeyboardInput} from 'input'
var inp=new KeyboardInput;
import 'game'
import {Game,ins} from 'game'
var game=new Game;
game.mode="insects"
var progress=0;
......@@ -102,7 +104,7 @@ speakProg(progress);
})
soundObject.loadQueue();
}
function playGame() {
export function playGame() {
soundObject.setCallback(null);
soundObject.setQueueCallback(null);
inp=new KeyboardInput()
......@@ -126,4 +128,5 @@ if (sndProgress == null) sndProgress = soundObject.create("ui/loading");
sndProgress.playbackRate = 0.2+progress*2;
if (sndProgress.playbackRate > 2) sndProgress.playbackRate = 2;
if (!sndProgress.playing) sndProgress.play();
}//speakProg
\ No newline at end of file
}//speakProg
export {game}
\ No newline at end of file
"use strict";
export default class Menu {
import {speech} from 'scrollingText'
import {TTS,useWebTTS} from 'tts'
if (typeof speech == "undefined") var speech = new TTS();
import $ from 'jquery'
import {soundObject} from 'soundObject.js'
import {TTS} from 'tts'
import {MenuTypes,MenuItem} from 'menuItem'
import {KeyEvent} from 'keycodes'
import {KeyboardInput} from 'input'
class Menu {
constructor(name, menuData) {
this.menuData = menuData;
this.cursor = 0;
......@@ -16,7 +25,7 @@ export default class Menu {
this.sndWrap = soundObject.create("ui/menuWrap");
this.selectCallback = null;
var id = document.getElementById("touchArea");
this.hammer = new Hammer(id);
//this.hammer = new Hammer(id);
......@@ -101,7 +110,7 @@ export default class Menu {
$(document).off("keydown");
$(document).off("keypress");
this.hammer.destroy();
//this.hammer.destroy();
var that = this;
setTimeout(function() { that.destroySounds(); }, 500);
}
......@@ -144,12 +153,13 @@ export default class Menu {
var that = this;
$(document).on("keypress", function(event) { that.handleInput(event) });
$(document).on("keydown", function(event) { that.handleKeys(event) });
/*
this.hammer.on("swipeleft", function(event) { that.handleSwipe(0); });
this.hammer.on("swiperight", function(event) { that.handleSwipe(1); });
this.hammer.on("panup", function(event) { that.handleSwipe(3); });
this.hammer.on("pandown", function(event) { that.handleSwipe(4); });
this.hammer.on("tap", function(event) { that.handleSwipe(2); });
*/
speech.speak(this.name);
this.sndOpen.play();
......@@ -217,3 +227,4 @@ export default class Menu {
}
}
export {Menu}
\ No newline at end of file
"use strict";
export var MenuTypes={
import {TTS,useWebTTS} from 'tts'
if (typeof speech == "undefined") var speech = new TTS();
var MenuTypes={
NORMAL:0,
SELECTOR:1,
SLIDER:2,
EDIT:3
}
export default class MenuItem {
class MenuItem {
constructor(id, name) {
this.name = name;
this.id = id;
......@@ -125,3 +127,4 @@ class EditItem extends MenuItem {
}
export {MenuItem,MenuTypes}
\ No newline at end of file
'use strict';
import {soundObject} from 'soundObject'
import {TTS,useWebTTS} from 'tts'
if (typeof speech == "undefined") var speech = new TTS();
if (runningText == undefined) var runningText = 0;
class ScrollingText {
......@@ -69,4 +71,4 @@ class ScrollingText {
}
}
export {ScrollingText}
\ No newline at end of file
export {ScrollingText,speech}
\ No newline at end of file
import sono from 'sono';
import {playGame} from 'main'
import {isElectron} from 'header';
var playOnceTimer;
class SoundObjectItem {
......
......@@ -30,4 +30,5 @@ resume() {
this.paused=false;
this.lastTime+=performance.now()-this.pauseWhen
}
}
\ No newline at end of file
}
export {Timer}
\ No newline at end of file
'use strict';
var useWebTTS = true;
export {useWebTTS}
export default class TTS {
class TTS {
constructor(webTTS=false) {
this.synth = window.speechSynthesis;
this.webTTS = webTTS;
......@@ -29,4 +29,4 @@ export default class TTS {
}
} // end class
export {useWebTTS,TTS}
\ No newline at end of file
'use strict';
function distance3D(x1, y1, z1, x2, y2, z2) {
export function distance3D(x1, y1, z1, x2, y2, z2) {
return Math.sqrt((x2-x1)*(x2-x1) +
(y2-y1)*(y2-y1) +
(z2-z1)*(z2-z1));
}
function distance(jx, jy, kx, ky) {
export function distance(jx, jy, kx, ky) {
//return Math.hypot(jx-kx, jy-ky)
return Math.sqrt(((jx - kx) * (jx - kx)) + ((jy - ky)) * (jy - ky))
}
function calculateAngle(x1, y1, x2, y2) {
export function calculateAngle(x1, y1, x2, y2) {
var angle = Math.atan2((y2-y1), (x2-x1));
angle = (angle >= 0) ? 0 : (2*Math.PI) + angle;
return angle;
// return Math.atan2((y2 - y1),(x2 - x1));
}
function isCollide3D(a, b)
export function isCollide3D(a, b)
{
return(a.x <= (b.x+b.width) && (a.x+a.width) >= b.x)&&(a.y <= (b.y+b.height) && (a.y+a.height) >= b.y)&&(a.z <= (b.z+b.depth) && (a.z+a.depth) >= b.z);
}
function randomInt(min, max) {
export function randomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function getRandomArbitrary(min, max) {
export function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment