function treffer(obj, pkt) {
// wenn flugobjekt von sprungobjekt getroffen
// dann punkte vergeben und wieder nach links positionieren
if (obj.hitTest(_root.objekt.mund)) {
if (obj.kind == "moehre") {
// Punkte hochzählen
_root.punkte = _root.punkte + (pkt*2);
}
if (obj.kind == "traube") {
// Punkte hochzählen
_root.punkte = _root.punkte + pkt;
}
if (obj.kind == "pilz" and _root.punkte <> 0) {
// Punkte hochzählen
_root.punkte =Math.ceil (_root.Punkte/2);
_root.objekt.pilz =true;
}
// Sprungobjekt sagen, dass es wieder nach unten fliegen soll
_root.objekt.spring = 2;
_root.objekt.treffer = true;
// Flugobjekte wieder an ihrer Ausgangsposition positionieren
if (obj.startwo == "links") {
obj._x = -22;
} else {
obj._x = 660;
}
// startvariable vorsichtshalber auf Null setzen, damit das Ding nicht gleich wieder losfliegt
obj.start_this =0;
}
}
function bewege(obj) {
// gesteuert per random wandert das flugobjekt von links nach rechts
if (obj.start_this <> 1) {
obj.start_this = random(15);
obj.wohin = random(15);
if (obj.wohin < 3) {
obj.gotoAndStop(3);
} else if (obj.wohin > 3 and obj.wohin < 8) {
obj.gotoAndStop(2);
} else {
obj.gotoAndStop(1);
}
} else {
if (obj.startwo == "rechts") {
obj._x = obj._x - 11;
}
if (obj.startwo == "links") {
obj._x = obj._x + 11;
}
}
// wenn das flugobjekt über den Rand hinaus ist, soll es wieder zu seinem Ausgangspunkt zurück
if (obj.startwo == "links" and obj._x > 666) {
obj._x = -33;
obj.start_this =2;
}
if (obj.startwo == "rechts" and obj._x < 0) {
obj._x = 660;
obj.start_this =2;
}
}
_root.punkte = 0;