hilfe, der hittest will mich vernichten.. oder sagen wirs so: ich hab n problem ^^
hab seit monaten ein problem mit einem spiel in dem sich die map verschiebt wenn man an den rand kommt.
eigentlich sollte man mit einem männchen via hitTest und getBounds an den kanten der map anlaufen können. das funktioniert auch, nur sobald sich die map bewegt bewegen sich die bounds nicht mit.
ich sitz seit monaten dran, hab den lehrer gefragt der daran verzweifelt ist.
hat irgendwer von euch ne ahnung wie das funktioniert?
;
//bewegungs script
if (Key.isDown(Key.DOWN)) {
_root.map.figur._y += _root.speed;
_root.map.figur.gotoAndStop(1);
}
if (Key.isDown(Key.DOWN) and Key.isDown(Key.LEFT)) {
_root.map.figur._x += _root.speed;
_root.map.figur.gotoAndStop(2);
}
if (Key.isDown(Key.DOWN) and Key.isDown(Key.RIGHT)) {
_root.map.figur._x -= _root.speed;
_root.map.figur.gotoAndStop(2);
}
if (Key.isDown(Key.UP)) {
_root.map.figur._y -= _root.speed;
_root.map.figur.gotoAndStop(3);
}
if (Key.isDown(Key.RIGHT)) {
_root.map.figur._x += _root.speed;
_root.map.figur.gotoAndStop(4);
}
if (Key.isDown(Key.LEFT)) {
_root.map.figur._x -= _root.speed;
_root.map.figur.gotoAndStop(2);
}
//verchieben der map
if (_root.map.figur.hitTest(_root.unten)) {
_root.map._y -= speed;
_root.verschieb._y += speed;
}
if (_root.map.figur.hitTest(_root.up)) {
_root.map._y += speed;
_root.verschieb._y -= speed;
}
if (_root.map.figur.hitTest(_root.links)) {
_root.map._x += speed;
_root.verschieb._x -= speed;
}
if (_root.map.figur.hitTest(_root.rechts)) {
_root.map._x -= speed;
_root.verschieb._x += speed;
}
// wände
with (_root.map.figur) {
if (this.hitTest(getBounds(_root.verschieb).xMax, _y, true)) {
_root.map.figur._x -= _root.speed;
}
if (this.hitTest(getBounds(_root.verschieb).xMin, _y , true)) {
_root.map.figur._x += _root.speed;
}
if (this.hitTest(_x, getBounds(_root.verschieb).yMax, true)) {
_root.map.figur._y -= _root.speed;
}
if (this.hitTest(_x, getBounds(_root.verschieb).yMin, true)) {
_root.map.figur._y += _root.speed;
}
}
das ganze ist im as2.0 programmiert und in flashMX 2004
hoff nur dass mri jetzt überhaupt wer antwortet weil der post so lang ist
dankeschön leute schon im vorhinein
www.silber.at.tt
eigentlich sollte man mit einem männchen via hitTest und getBounds an den kanten der map anlaufen können. das funktioniert auch, nur sobald sich die map bewegt bewegen sich die bounds nicht mit.
ich sitz seit monaten dran, hab den lehrer gefragt der daran verzweifelt ist.
hat irgendwer von euch ne ahnung wie das funktioniert?
;//bewegungs script
if (Key.isDown(Key.DOWN)) {
_root.map.figur._y += _root.speed;
_root.map.figur.gotoAndStop(1);
}
if (Key.isDown(Key.DOWN) and Key.isDown(Key.LEFT)) {
_root.map.figur._x += _root.speed;
_root.map.figur.gotoAndStop(2);
}
if (Key.isDown(Key.DOWN) and Key.isDown(Key.RIGHT)) {
_root.map.figur._x -= _root.speed;
_root.map.figur.gotoAndStop(2);
}
if (Key.isDown(Key.UP)) {
_root.map.figur._y -= _root.speed;
_root.map.figur.gotoAndStop(3);
}
if (Key.isDown(Key.RIGHT)) {
_root.map.figur._x += _root.speed;
_root.map.figur.gotoAndStop(4);
}
if (Key.isDown(Key.LEFT)) {
_root.map.figur._x -= _root.speed;
_root.map.figur.gotoAndStop(2);
}
//verchieben der map
if (_root.map.figur.hitTest(_root.unten)) {
_root.map._y -= speed;
_root.verschieb._y += speed;
}
if (_root.map.figur.hitTest(_root.up)) {
_root.map._y += speed;
_root.verschieb._y -= speed;
}
if (_root.map.figur.hitTest(_root.links)) {
_root.map._x += speed;
_root.verschieb._x -= speed;
}
if (_root.map.figur.hitTest(_root.rechts)) {
_root.map._x -= speed;
_root.verschieb._x += speed;
}
// wände
with (_root.map.figur) {
if (this.hitTest(getBounds(_root.verschieb).xMax, _y, true)) {
_root.map.figur._x -= _root.speed;
}
if (this.hitTest(getBounds(_root.verschieb).xMin, _y , true)) {
_root.map.figur._x += _root.speed;
}
if (this.hitTest(_x, getBounds(_root.verschieb).yMax, true)) {
_root.map.figur._y -= _root.speed;
}
if (this.hitTest(_x, getBounds(_root.verschieb).yMin, true)) {
_root.map.figur._y += _root.speed;
}
}
das ganze ist im as2.0 programmiert und in flashMX 2004
hoff nur dass mri jetzt überhaupt wer antwortet weil der post so lang ist

dankeschön leute schon im vorhinein

www.silber.at.tt
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Silber« (20. April 2008, 17:06)
Ähnliche Themen
-
Flash »-
jump&run hittest problem
(26. Juni 2004, 12:24)
-
Flash »-
hittest aus mc heraus
(16. Mai 2004, 11:29)
-
Flash »-
hittest einbinden
(11. Februar 2004, 12:38)
-
Feedback-Forum »-
Bitte mal bewerten
(11. Januar 2003, 14:59)


