Zahlreiche Animationen geadded, Punkte geadded, mehr Tiere, neue Sounds

This commit is contained in:
Carsten Hilmer
2016-11-11 07:58:14 +01:00
parent 36a997e83e
commit 2d63ab9a2a
100 changed files with 23615 additions and 107 deletions

View File

@@ -1,17 +1,35 @@
appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler ) {
appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia, $state, backgroundsounds_mediahandler, $timeout ) {
/*
* Mentor-Anitmation ausschalten
*/
$scope.showmentor=false;
$scope.CSSKlickSuchspiel=false;
$scope.CSSFarmhaus=false;
$scope.CSSWindrad=false;
$scope.CSSKornspeicher=false;
$scope.baumhauszufallaction=99;
/*
* Hintergrundmusik laden und starten
*/
$ionicPlatform.ready(function() {
var mediastartesuchspiel = new Media('/android_asset/www/sounds/suchspiel.mp3', suchspiel_intro_finish,null);
$scope.baumhaus_action=[];
var mediastartesuchspiel = new Media('/android_asset/www/sounds/soundsneu/spiel_intro.mp3', suchspiel_intro_finish,null);
var baumhaus_action1 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_1.mp3', baumhaus_mentor,null);
var baumhaus_action2 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_2.mp3', baumhaus_mentor,null);
var baumhaus_action3 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_3.mp3', baumhaus_mentor,null);
var baumhaus_action4 = new Media('/android_asset/www/sounds/soundsneu/baumhaus_action_4.mp3', baumhaus_mentor,null);
$scope.mediastartesuchspiel=mediastartesuchspiel;
backgroundsounds_mediahandler.playbackgroundmusic();
$scope.baumhaus_action.push(baumhaus_action1);
$scope.baumhaus_action.push(baumhaus_action2);
$scope.baumhaus_action.push(baumhaus_action3);
$scope.baumhaus_action.push(baumhaus_action4);
});
/*
@@ -34,4 +52,63 @@ appControllers.controller('home', function($scope, $ionicPlatform, $cordovaMedia
$state.go('suchspiel');
}
$scope.animate_farmhaus=function(){
$scope.CSSFarmhaus=true;
$timeout(function () {
$scope.CSSFarmhaus=false;
}, 5000);
}
$scope.animate_windrad=function(){
$scope.CSSWindrad=true;
$timeout(function () {
$scope.CSSWindrad=false;
}, 5000);
}
$scope.animate_kornspeicher=function(){
$scope.CSSKornspeicher=true;
$timeout(function () {
$scope.CSSKornspeicher=false;
}, 5000);
}
$scope.baumhaus_actiondo=function(){
$scope.baumhauszufallaction=getRandomInt(1,5);
if ($scope.baumhauszufallaction==3){
$scope.showmentor=true;
$scope.baumhaus_action[getRandomInt(0,3)].play();
$scope.mediastartesuchspiel.setVolume('1.0');
}
}
function baumhaus_mentor(){
$timeout(function () {
$scope.showmentor=false;
}, 0);
}
/*
* Zufall für Baumhausaction
*/
function getRandomInt(min, max) {
var tmpInt=0;
min = Math.ceil(min);
max = Math.floor(max);
tmpInt = Math.floor(Math.random() * (max - min + 1)) + min;
if (tmpInt > max){
tmpInt=max;
}
if (tmpInt < min){
tmpInt=min;
}
return tmpInt;
}
});

View File

@@ -12,15 +12,15 @@ angular.module('kinderspiel.services', [])
*/
var backgroundmusic='';
$ionicPlatform.ready(function() {
var mybackground_music = new Media('/android_asset/www/sounds/TORN.MID', loopbackgroundmusic ,null);
var mybackground_music = new Media('/android_asset/www/sounds/background/backgound4.mid', loopbackgroundmusic ,null);
backgroundmusic=mybackground_music;
});
function loopbackgroundmusic(){
if (inbackground == false){
backgroundmusic.release();
backgroundmusic=mybackground_music;
//backgroundmusic.release();
//backgroundmusic=mybackground_music;
backgroundmusic.play();
backgroundmusic.setVolume('0.3');
}

View File

@@ -11,6 +11,7 @@ $scope.showmentorbravo=false;
//Kartenarray + ListenAnsichtArray
$scope.spiele=[];
$scope.spielealletiere=[];
$scope.spielelistensort=[];
//Zufallsgenerator ID = TierindexID
@@ -36,6 +37,16 @@ $scope.showgametimer = false;
$scope.spielvorbei=false;
$scope.beantwortet=false;
//Mentor Zufallseinblendung
$scope.randomMentor=0;
$scope.punkte=0;
$scope.punktebonus=0;
//Zeitmessung für PunkteBonus
$scope.rundenstart = '';
$scope.rundenende = '';
$ionicPlatform.ready(function() {
@@ -44,43 +55,64 @@ $ionicPlatform.ready(function() {
* Sounds definieren
*/
$scope.sounds=[];
$scope.bravosounds=[];
$scope.falschsounds=[];
$scope.aufloesung='';
/*
* Sounds laden
*/
var tiersound1 = new Media('/android_asset/www/sounds/finde_elefant.mp3', mentorausblenden,null);
var tiersound2 = new Media('/android_asset/www/sounds/finde_esel.mp3', mentorausblenden,null);
var tiersound3 = new Media('/android_asset/www/sounds/finde_hahn.mp3', mentorausblenden,null);
var tiersound4 = new Media('/android_asset/www/sounds/finde_hund.mp3', mentorausblenden,null);
var tiersound5 = new Media('/android_asset/www/sounds/finde_katze.mp3', mentorausblenden,null);
var tiersound6 = new Media('/android_asset/www/sounds/finde_kuh.mp3', mentorausblenden,null);
var tiersound7 = new Media('/android_asset/www/sounds/finde_maus.mp3', mentorausblenden,null);
var tiersound8 = new Media('/android_asset/www/sounds/finde_schaf.mp3', mentorausblenden,null);
var tiersound1 = new Media('/android_asset/www/sounds/soundsneu/finde_affe.mp3', mentorausblenden,null);
var tiersound2 = new Media('/android_asset/www/sounds/soundsneu/finde_esel.mp3', mentorausblenden,null);
var tiersound3 = new Media('/android_asset/www/sounds/soundsneu/finde_hase.mp3', mentorausblenden,null);
var tiersound4 = new Media('/android_asset/www/sounds/soundsneu/finde_hund.mp3', mentorausblenden,null);
var tiersound5 = new Media('/android_asset/www/sounds/soundsneu/finde_kamel.mp3', mentorausblenden,null);
var tiersound6 = new Media('/android_asset/www/sounds/soundsneu/finde_katze.mp3', mentorausblenden,null);
var tiersound7 = new Media('/android_asset/www/sounds/soundsneu/finde_krokodil.mp3', mentorausblenden,null);
var tiersound8 = new Media('/android_asset/www/sounds/soundsneu/finde_kuh.mp3', mentorausblenden,null);
var tiersound9 = new Media('/android_asset/www/sounds/soundsneu/finde_loewe.mp3', mentorausblenden,null);
var tiersound10 = new Media('/android_asset/www/sounds/soundsneu/finde_maus.mp3', mentorausblenden,null);
var tiersound11 = new Media('/android_asset/www/sounds/soundsneu/finde_nashorn.mp3', mentorausblenden,null);
var tiersound12 = new Media('/android_asset/www/sounds/soundsneu/finde_nilpferd.mp3', mentorausblenden,null);
var tiersound13 = new Media('/android_asset/www/sounds/soundsneu/finde_schaf.mp3', mentorausblenden,null);
var tiersound14 = new Media('/android_asset/www/sounds/soundsneu/finde_schildkroete.mp3', mentorausblenden,null);
var tiersound15 = new Media('/android_asset/www/sounds/soundsneu/finde_schwein.mp3', mentorausblenden,null);
var tiersound16 = new Media('/android_asset/www/sounds/soundsneu/finde_stier.mp3', mentorausblenden,null);
var bravosound = new Media('/android_asset/www/sounds/bravo.mp3', karteausblenden,null);
var falschsound = new Media('/android_asset/www/sounds/falsch.mp3', null,null);
var bravosound1 = new Media('/android_asset/www/sounds/soundsneu/erfolg_1.mp3', karteausblenden,null);
var bravosound2 = new Media('/android_asset/www/sounds/soundsneu/erfolg_2.mp3', karteausblenden,null);
var bravosound3 = new Media('/android_asset/www/sounds/soundsneu/erfolg_3.mp3', karteausblenden,null);
var bravosound4 = new Media('/android_asset/www/sounds/soundsneu/erfolg_4.mp3', karteausblenden,null);
var bravosound5 = new Media('/android_asset/www/sounds/soundsneu/erfolg_5.mp3', karteausblenden,null);
var falschsound1 = new Media('/android_asset/www/sounds/soundsneu/niederlage_1.mp3', mentorausblenden,null);
var falschsound2 = new Media('/android_asset/www/sounds/soundsneu/niederlage_2.mp3', mentorausblenden,null);
var falschsound3 = new Media('/android_asset/www/sounds/soundsneu/niederlage_3.mp3', mentorausblenden,null);
var falschsound4 = new Media('/android_asset/www/sounds/soundsneu/niederlage_4.mp3', mentorausblenden,null);
var falschsound5 = new Media('/android_asset/www/sounds/soundsneu/niederlage_5.mp3', mentorausblenden,null);
var kartegebensound = new Media('/android_asset/www/sounds/karte.mp3', kartegeben,null);
var aufloesungsound = new Media('/android_asset/www/sounds/soundsneu/aufloesung.mp3', aufloesung,null);
/*
* Sounds in $Scope referenzieren
*/
$scope.bravosound=bravosound;
$scope.falschsound=falschsound;
$scope.kartegebensound=kartegebensound;
$scope.aufloesung=aufloesungsound;
$scope.sounds.push(tiersound1);
$scope.sounds.push(tiersound2);
$scope.sounds.push(tiersound3);
$scope.sounds.push(tiersound4);
$scope.sounds.push(tiersound5);
$scope.sounds.push(tiersound6);
$scope.sounds.push(tiersound7);
$scope.sounds.push(tiersound8);
$scope.bravosounds.push(bravosound1);
$scope.bravosounds.push(bravosound2);
$scope.bravosounds.push(bravosound3);
$scope.bravosounds.push(bravosound4);
$scope.bravosounds.push(bravosound5);
});
$scope.falschsounds.push(falschsound1);
$scope.falschsounds.push(falschsound2);
$scope.falschsounds.push(falschsound3);
$scope.falschsounds.push(falschsound4);
$scope.falschsounds.push(falschsound5);
/*
@@ -88,113 +120,204 @@ $ionicPlatform.ready(function() {
*/
var tier = {
id: 0,
bild: 'elefant.jpg',
sound1: 'sound_elefant.mp3',
antwort: '',
bild: 'Affe.png',
sound1: tiersound1,
display: false,
einblendecssid: 'elefantein',
ausblendecssid: 'elefantaus',
einblendecssid: 'affeein',
ausblendecssid: 'affeaus',
sortid: 0
};
$scope.spiele.push(tier);
$scope.spielealletiere.push(tier);
var tier1 = {
id: 1,
bild: 'esel.jpg',
sound1: 'sound_esel.mp3',
antwort: '',
bild: 'Esel.png',
sound1: tiersound2,
display: false,
einblendecssid: 'eselein',
ausblendecssid: 'eselaus',
sortid: 0
};
$scope.spiele.push(tier1);
$scope.spielealletiere.push(tier1);
var tier2 = {
id: 2,
bild: 'hahn.jpg',
sound1: 'sound_hahn.mp3',
antwort: '',
bild: 'Hase.png',
sound1: tiersound3,
display: false,
einblendecssid: 'hahnein',
ausblendecssid: 'hahnaus',
einblendecssid: 'haseein',
ausblendecssid: 'haseaus',
sortid: 0
};
$scope.spiele.push(tier2);
$scope.spielealletiere.push(tier2);
var tier3 = {
id: 3,
bild: 'hund.jpg',
sound1: 'sound_hund.mp3',
sound2: '',
bild: 'Hund.png',
sound1: tiersound4,
display: false,
einblendecssid: 'hundein',
ausblendecssid: 'hundaus',
sortid: 0
};
$scope.spiele.push(tier3);
$scope.spielealletiere.push(tier3);
var tier4 = {
id: 4,
bild: 'katze.jpg',
sound1: 'sound_katze.mp3',
sound2: '',
bild: 'Kamel.png',
sound1: tiersound5,
display: false,
einblendecssid: 'kamelein',
ausblendecssid: 'kamelaus',
sortid: 0
};
$scope.spielealletiere.push(tier4);
var tier5 = {
id: 5,
bild: 'Katze.png',
sound1: tiersound6,
display: false,
einblendecssid: 'katzeein',
ausblendecssid: 'katzeaus',
sortid: 0
};
$scope.spiele.push(tier4);
$scope.spielealletiere.push(tier5);
var tier5 = {
id: 5,
bild: 'kuh.jpg',
sound1: 'sound_kuh.mp3',
sound2: '',
var tier6 = {
id: 6,
bild: 'Krokodil.png',
sound1: tiersound7,
display: false,
einblendecssid: 'krokodilein',
ausblendecssid: 'krokodilaus',
sortid: 0
};
$scope.spielealletiere.push(tier6);
var tier7 = {
id: 7,
bild: 'Kuh.png',
sound1: tiersound8,
display: false,
einblendecssid: 'kuhein',
ausblendecssid: 'kuhaus',
sortid: 0
};
$scope.spiele.push(tier5);
$scope.spielealletiere.push(tier7);
var tier6 = {
id: 6,
bild: 'maus.jpg',
sound1: 'sound_maus.mp3',
sound2: '',
var tier8 = {
id: 8,
bild: 'Loewe.png',
sound1: tiersound9,
display: false,
einblendecssid: 'loeweein',
ausblendecssid: 'loeweaus',
sortid: 0
};
$scope.spielealletiere.push(tier8);
var tier9 = {
id: 9,
bild: 'Maus.png',
sound1: tiersound10,
display: false,
einblendecssid: 'mausein',
ausblendecssid: 'mausaus',
sortid: 0
};
$scope.spiele.push(tier6);
$scope.spielealletiere.push(tier9);
var tier10 = {
id: 10,
bild: 'Nashorn.png',
sound1: tiersound11,
display: false,
einblendecssid: 'nashornein',
ausblendecssid: 'nashornaus',
sortid: 0
};
$scope.spielealletiere.push(tier10);
var tier7 = {
id: 7,
bild: 'schaf.jpg',
sound1: 'sound_schaf.mp3',
sound2: '',
var tier11 = {
id: 11,
bild: 'Nilpferd.png',
sound1: tiersound12,
display: false,
einblendecssid: 'nilpferdein',
ausblendecssid: 'nilpferdaus',
sortid: 0
};
$scope.spielealletiere.push(tier11);
var tier12 = {
id: 12,
bild: 'Schaf.png',
sound1: tiersound13,
display: false,
einblendecssid: 'schafein',
ausblendecssid: 'schafaus',
sortid: 0
};
$scope.spiele.push(tier7);
$scope.spielealletiere.push(tier12);
var tier13 = {
id: 13,
bild: 'Schildkroete.png',
sound1: tiersound14,
display: false,
einblendecssid: 'schildkroeteein',
ausblendecssid: 'schildkroeteaus',
sortid: 0
};
$scope.spielealletiere.push(tier13);
var tier14 = {
id: 14,
bild: 'Schwein.png',
sound1: tiersound15,
display: false,
einblendecssid: 'schweinein',
ausblendecssid: 'schweinaus',
sortid: 0
};
$scope.spielealletiere.push(tier14);
var tier15 = {
id: 15,
bild: 'Stier.png',
sound1: tiersound16,
display: false,
einblendecssid: 'stierein',
ausblendecssid: 'stieraus',
sortid: 0
};
$scope.spielealletiere.push(tier15);
});
/*
* Wiederholung der Aufgabe
*/
$scope.hilfe = function() {
console.log("Hilfe geklickt");
$scope.showmentor=true;
$scope.sounds[$scope.randomid].play();
$scope.spiele[$scope.randomid].sound1.play();
}
@@ -228,10 +351,26 @@ $scope.PlayerAnswer = function(src) {
$scope.beantwortet=true;
if (src==$scope.randomid){
$timeout(function () {
$scope.showmentorbravo=true;
$scope.punkte=$scope.punkte + 1000;
$scope.rundenende = new Date().getTime();
//Zeitbonus
$scope.punktebonus=1000 / (($scope.rundenende - $scope.rundenstart)/1000);
console.log($scope.rundenende - $scope.rundenstart + " Start:" + $scope.rundenstart + " Ende:" + $scope.rundenende);
$scope.punktebonus=Math.round($scope.punktebonus);
$scope.punkte = $scope.punkte + $scope.punktebonus;
$scope.randomMentor=getRandomInt(1, 2);
if ($scope.randomMentor==2){
$scope.showmentorbravo=true;
}
else{
$scope.showmentor=true;
}
$scope.cardindex=0;
}, 0);
$scope.bravosound.play();
$scope.bravosounds[getRandomInt(0, 4)].play();
}
else{
@@ -248,18 +387,15 @@ $scope.PlayerAnswer = function(src) {
/*
* Nach 3 sekunden Fehler zurücksetzen und Karten neu vergeben
*/
$timeout(function () {
$scope.CSSErrorCode=99;
$scope.cardindex=0;
karteausblenden();
}, 3000);
$scope.showmentor=true;
$scope.aufloesung.play();
}
else {
/*
* Antwort ist falsch
*/
$scope.falschsound.play();
$scope.showmentor=true;
$scope.falschsounds[getRandomInt(0, 4)].play();
$scope.CSSFalscheAntwort = true;
$timeout(function () {
$scope.CSSFalscheAntwort = false;
@@ -320,13 +456,17 @@ function kartegeben(){
$scope.randomid=getRandomInt(0, 7);
$scope.randomid=getRandomInt(0, 7);
$scope.rundenstart = new Date().getTime();
/*
* Mentor anzeigen und Sound wiedergeben
*/
$scope.showmentor=true;
$scope.sounds[$scope.randomid].play();
$scope.spiele[$scope.randomid].sound1.play();
console.log("ELSE-Zweig Einblende -ID: " + $scope.CSSEinblendung);
console.log("CardIndex: " + $scope.cardindex);
console.log("Zufallsid: " + $scope.randomid);
console.log("Tiersuchen: " + $scope.spiele[$scope.randomid].bild);
}
console.log("Einblende funktion ID: " + $scope.CSSEinblendung);
}
@@ -335,7 +475,7 @@ function kartegeben(){
* Karten wieder einsammeln, runde beendet
*/
function karteausblenden(){
$timeout(function () { $scope.showmentorbravo=false; }, 0);
$timeout(function () { $scope.showmentorbravo=false; $scope.showmentor=false;}, 0);
if ($scope.spielvorbei==false){
@@ -388,17 +528,34 @@ function SpieleTimer(){
}
function aufloesung(){
$scope.CSSErrorCode=99;
$scope.cardindex=0;
karteausblenden();
}
/*
* Drei mal mischen :)
*/
function kartenmischen(){
$scope.spiele=shuffleArray($scope.spiele);
$scope.spiele=shuffleArray($scope.spiele);
$scope.spiele=shuffleArray($scope.spiele);
$scope.spielealletiere=shuffleArray($scope.spielealletiere);
$scope.spielealletiere=shuffleArray($scope.spielealletiere);
$scope.spielealletiere=shuffleArray($scope.spielealletiere);
$scope.spiele=[];
for(var i = 0; i < 8; i++) {
var data= $scope.spielealletiere[i];
data.id=i;
$scope.spiele.push(data);
}
$scope.spielelistensort=[];
for(var i = 0; i < $scope.spiele.length; i++) {
//for(var i = 0; i < $scope.spiele.length; i++) {
for(var i = 0; i < 8; i++) {
var data= $scope.spiele[i];
data.sortid=i;
$scope.spielelistensort.push(data);
@@ -475,7 +632,7 @@ $timeout(function () {
function inittimer(){
$scope.CCSInittimer=true;
if ($scope.inittimercounter > 0){
if ($scope.inittimercounter > 1){
$scope.inittimercounter=$scope.inittimercounter - 1;
$timeout(function () {
@@ -491,7 +648,7 @@ function inittimer(){
$scope.showgametimer = true;
SpieleTimer();
goto_newspiel();
}, 1500);
}, 1000);
}
}