| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| Lük problem
Vielleicht kann mir jemand weiter helfen mit folgendem problem. Ich hab eine art Drag und Drop gebaut die jetzt nur richtig gelegt werden kann! Es sollte aber so sien das man auch falsch droppen kan und das dan die drops auch schön centriert hinfallen auf die targets. Erst auf knopf druck wird dann kontroliert ob alles gut oder falsch liegt. Ich glaub das spiel kennt man auch in D unter den name Lük! Code: #include "111_002_002_002.txt"
allDragged = 0;
//links rechts associatie
dragSetup(drop1, target9);
dragSetup(drop2, target7);
dragSetup(drop3, target12);
dragSetup(drop4, target10);
dragSetup(drop5, target5);
dragSetup(drop6, target8);
dragSetup(drop7, target1);
dragSetup(drop8, target3);
dragSetup(drop9, target11);
dragSetup(drop10, target6);
dragSetup(drop11, target4);
dragSetup(drop12, target2);
dragSetup(drop13, target16);
dragSetup(drop14, target15);
dragSetup(drop15, target13);
dragSetup(drop16, target14);
//
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged = true;
this.swapDepths(_root.getNextHighestDepth());
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged = false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
// targ.gotoAndStop("goed");
} else {
this.onTarget = false;
// targ.gotoAndStop("fout");
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/3;
this._y -= (this._y-this.myHomeY)/3;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/3;
this._y -= (this._y-this.myFinalY)/3;
}
};
}
//check if all stones are dragged
_root.onEnterFrame = function() {
if (_root.allDragged == 16) {
_root.endComment = "Nog een keer?";
}
};
// control button
control.onPress = function() {
if (_root.drop1._droptarget == "/target9") {
drop1._visible = false;
_root.target9.gotoAndStop("goed");
} else {
_root.target9.gotoAndStop("fout");
}
if (_root.drop2._droptarget == "/target7") {
drop2._visible = false;
_root.target7.gotoAndStop("goed");
} else {
_root.target7.gotoAndStop("fout");
}
if (_root.drop3._droptarget == "/target12") {
drop3._visible = false;
_root.target12.gotoAndStop("goed");
} else {
_root.target12.gotoAndStop("fout");
}
if (_root.drop4._droptarget == "/target10") {
drop4._visible = false;
_root.target10.gotoAndStop("goed");
} else {
_root.target10.gotoAndStop("fout");
}
if (_root.drop5._droptarget == "/target5") {
drop5._visible = false;
_root.target5.gotoAndStop("goed");
} else {
_root.target5.gotoAndStop("fout");
}
if (_root.drop6._droptarget == "/target8") {
drop6._visible = false;
_root.target8.gotoAndStop("goed");
} else {
_root.target8.gotoAndStop("fout");
}
if (_root.drop7._droptarget == "/target1") {
drop7._visible = false;
_root.target1.gotoAndStop("goed");
} else {
_root.target1.gotoAndStop("fout");
}
if (_root.drop8._droptarget == "/target3") {
drop8._visible = false;
_root.target3.gotoAndStop("goed");
} else {
_root.target3.gotoAndStop("fout");
}
if (_root.drop9._droptarget == "/target11") {
drop9._visible = false;
_root.target11.gotoAndStop("goed");
} else {
_root.target11.gotoAndStop("fout");
}
if (_root.drop10._droptarget == "/target6") {
drop10._visible = false;
_root.target6.gotoAndStop("goed");
} else {
_root.target6.gotoAndStop("fout");
}
if (_root.drop11._droptarget == "/target4") {
drop11._visible = false;
_root.target4.gotoAndStop("goed");
} else {
_root.target4.gotoAndStop("fout");
}
if (_root.drop12._droptarget == "/target2") {
drop12._visible = false;
_root.target2.gotoAndStop("goed");
} else {
_root.target2.gotoAndStop("fout");
}
if (_root.drop13._droptarget == "/target16") {
drop13._visible = false;
_root.target16.gotoAndStop("goed");
} else {
_root.target16.gotoAndStop("fout");
}
if (_root.drop14._droptarget == "/target15") {
drop14._visible = false;
_root.target15.gotoAndStop("goed");
} else {
_root.target15.gotoAndStop("fout");
}
if (_root.drop15._droptarget == "/target13") {
drop15._visible = false;
_root.target13.gotoAndStop("goed");
} else {
_root.target13.gotoAndStop("fout");
}
if (_root.drop16._droptarget == "/target14") {
drop16._visible = false;
_root.target14.gotoAndStop("goed");
} else {
_root.target14.gotoAndStop("fout");
}
}; |
| | |
| | #2 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
|
Soweit bin ich selber bis jetzt gekommen aber es funkt immer noch nicht! SWF datei ist als beispiel im zip. PHP-Code: |
| | |
| | #3 (permalink) |
| Flashbitch Registriert seit: Oct 2003 Ort: Hannover
Beiträge: 279
|
AUA! Das hätte man aber auch kürzer machen können :x
__________________ Fuchtelworld |
| | |
| | #4 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| Wie?
Oké kurzer wäre schon! Aber erst muss der Fehler raus. Im clip springen immer noch alle drops auf target16. Also bin mir noch nicht sicher ob dei hittest in die onEnterframe funktion soll. So wie sie jetzt steht laufts nicht! |
| | |
| | #5 (permalink) |
| Flashbitch Registriert seit: Oct 2003 Ort: Hannover
Beiträge: 279
|
schmiess die 1000 if abfragen aus und ersetze sie mit schleifen. anders macht es kein sin sowas zu debuggen!
__________________ Fuchtelworld |
| | |
| | #6 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| nur die function PHP-Code: |
| | |
| | #7 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| Bis sowiet klapt es jetzt PHP-Code: |
| | |
| | #8 (permalink) | |
| Flashbitch Registriert seit: Oct 2003 Ort: Hannover
Beiträge: 279
| Zitat:
__________________ Fuchtelworld | |
| | |
| | #9 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| ohne evals PHP-Code: PHP-Code: Help? |
| | |
| | #10 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| so? PHP-Code: PHP-Code: richtig geschrieben? aber irgendwie nicht das gleiche?! |
| | |
| | #11 (permalink) |
| Flashbitch Registriert seit: Oct 2003 Ort: Hannover
Beiträge: 279
|
Ok ich sehe das haben die in der HIlfe auch so gemacht.. hae noch nie mit droptarget gearbeitet deshalb ..
__________________ Fuchtelworld |
| | |
| | #13 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| bis soweit PHP-Code: |
| | |
| | #14 (permalink) |
| muh Registriert seit: Apr 2002 Ort: Freiburg / Stuttgart
Beiträge: 4.338
|
"Schleife" heitßt das Zauberwort ![]() Damit kannst du das letzte If-Gedöns loswerden, falls sich die Kombinationen nicht berechnen lassen, legst du sie in einem Array (oder einem Objekt) ab, und gehst dieses dann in einer Schleife durch. Das switch PHP-Code: PHP-Code:
__________________ »Carpe diem«, sagte der Graf. (Terry Pratchett: Ruhig Blut!) |
| | |
| | #15 (permalink) |
| Neuer User Registriert seit: Jun 2003 Ort: Venlo Niederlande
Beiträge: 23
| Schleiffe oké - macht sin! Aber? PHP-Code: Probleem isst das PHP-Code: |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |