Bestimmte Bereiche dürfen nicht klickbar sein. [Flash 7]
| | 19.06.2011, 17:46
Huhu Leute,
Ich versuche gerade ein Spiel zu programmieren und bin auf ein Problem gestoßen den ich nicht lösen kann.
Es gibt ein Schiff und ein z.b ein Chat und wenn man auf dem Chat klickt folgt das Schiff auch es soll nur bestimmte Stellen bewegen könnte mir jemand helfen hier ist ein Code:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | var speed = 8;
onMouseDown = function() {
attachMovie("ziel", "ziel", 20);
ziel._x = _xmouse;
ziel._y = _ymouse;
bewegen = true;
_y -= _ymouse;
_x -= _xmouse;
}
Shiplevel1.onEnterFrame = function() {
var a = this._x - ziel._x;
var b = this._y - ziel._y;
if(bewegen) {
this._rotation = Math.atan2(a, b) / Math.PI * -0.001;
this._x += speed * Math.sin((this._rotation) * Math.PI / 0.001);
this._y += -speed * Math.cos((this._rotation) * Math.PI / 0.001);
this._y += _root.clip._x * Math.cos((this._rotation) * Math.PI / 0.001);
}
if(this.hitTest(ziel)) {
removeMovieClip(ziel);
bewegen = false;
}
}
|
Gruß | Geändert von hamza1 am 19.06.11 um 17:47 Uhr | |
| | Beiträge: 3000 Wohnort: Köln Registriert: Oct 2007
| 21.06.2011, 11:01
|
|