function einsatzErhoehen (gesetzt) {
if(gesEinsatz+einsatzHoehe<=maxEinsatz&&credits-einsatzHoehe>=0){
gesetzt=gesetzt+einsatzHoehe;
gesEinsatz=gesEinsatz+einsatzHoehe;
credits=credits-einsatzHoehe;
coinWählen(einsatzHoehe);
soundAbspielen("coinAblegen");
}
return gesetzt;
}
function coinsLoeschen (tn,loeschen){
for ( n=tn.n; n>=0; n-- ) {
name = "coin" add tn.name add n;
removeMovieClip (name);
}
tn.n=0;
if(loeschen==true){ tn.einsatz=0; }
}
function coinssetzten (tn,gesetzt) {
coinsLoeschen(tn,false);
[b]anz_500 = Math.floor(gesetzt/500); // die beiden nullen weggenommen (also nur 5 statt 500)[/b]
anz_200 = Math.floor((gesetzt-(500*anz_500))/200);
anz_100 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200))/100);
anz_50 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100))/50);
anz_20 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100)-(50*anz_50))/20);
anz_10 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100)-(50*anz_50)-(20*anz_20))/10);
[b] for ( i=0; i<anz_500; i++ ) {// die beiden nullen weggenommen (also nur 5 statt 500)[/b]
name = "coin" add tn.name add tn.n;
attachMovie ("coin500", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
for ( i=0; i<anz_200; i++ ) {
name = "coin" add tn.name add tn.n;
attachMovie ("coin200", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
for ( i=0; i<anz_100; i++ ) {
name = "coin" add tn.name add tn.n;
attachMovie ("coin100", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
for ( i=0; i<anz_50; i++ ) {
name = "coin" add tn.name add tn.n;
attachMovie ("coin50", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
for ( i=0; i<anz_20; i++ ) {
name = "coin" add tn.name add tn.n;
attachMovie ("coin20", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
for ( i=0; i<anz_10; i++ ) {
name = "coin" add tn.name add tn.n;
attachMovie ("coin10", name, tn.reihe*200+tn.n);
setProperty (name, _x, getProperty ( tn, _x ));
setProperty (name, _y, getProperty ( tn, _y )-(tn.n*2.5));
var nam = eval(name);
nam.tn=tn;
tn.n++;
}
}
function coinsBewegen (tn,gesetzt) {
[b] anz_500 = Math.floor(gesetzt/500); // die beiden nullen weggenommen (also nur 5 statt 500)[/b]
anz_200 = Math.floor((gesetzt-(500*anz_500))/200);
anz_100 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200))/100);
anz_50 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100))/50);
anz_20 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100)-(50*anz_50))/20);
anz_10 = Math.floor((gesetzt-(500*anz_500)-(200*anz_200)-(100*anz_100)-(50*anz_50)-(20*anz_20))/10);
if(anz_10>0)coinWählen(10);
else if(anz_20>0)coinWählen(20);
else if(anz_50>0)coinWählen(50);
else if(anz_100>0)coinWählen(100);
else if(anz_200>0)coinWählen(200);
[b] else coinWählen(500); // die beiden nullen weggenommen (also nur 5 statt 500)[/b]
gesEinsatz=gesEinsatz-einsatzHoehe;
credits=credits+einsatzHoehe;
gesetzt=gesetzt-einsatzHoehe;
return gesetzt;
}